[v5,15/18] secboot: fix WPR descriptor generation

Submitted by Alexandre Courbot on Dec. 14, 2016, 8:02 a.m.

Details

Message ID d5daf98d1c2ea90359006fe7757fdaabf8435a3e.1481702469.git-series.acourbot@nvidia.com
State New
Headers show
Series "Secure Boot refactoring" ( rev: 1 ) in Nouveau

Not browsing as part of any series.

Commit Message

Alexandre Courbot Dec. 14, 2016, 8:02 a.m.
Generate the WPR descriptor closer to what RM does. In particular, set
the expected masks, and only set the ucode members on Tegra.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drm/nouveau/nvkm/subdev/secboot/acr_r352.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drm/nouveau/nvkm/subdev/secboot/acr_r352.c b/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
index 82e325bb1431..d4f04239b124 100644
--- a/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
+++ b/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
@@ -496,19 +496,22 @@  acr_r352_fixup_hs_desc(struct acr_r352 *acr, struct nvkm_secboot *sb,
 {
 	struct nvkm_gpuobj *ls_blob = acr->ls_blob;
 
-	desc->ucode_blob_base = ls_blob->addr;
-	desc->ucode_blob_size = ls_blob->size;
-
-	desc->wpr_offset = 0;
-
 	/* WPR region information if WPR is not fixed */
 	if (sb->wpr_size == 0) {
+		u32 wpr_start = ls_blob->addr;
+		u32 wpr_end = wpr_start + ls_blob->size;
+
 		desc->wpr_region_id = 1;
-		desc->regions.no_regions = 1;
+		desc->regions.no_regions = 2;
+		desc->regions.region_props[0].start_addr = wpr_start >> 8;
+		desc->regions.region_props[0].end_addr = wpr_end >> 8;
 		desc->regions.region_props[0].region_id = 1;
-		desc->regions.region_props[0].start_addr = ls_blob->addr >> 8;
-		desc->regions.region_props[0].end_addr =
-					   (ls_blob->addr + ls_blob->size) >> 8;
+		desc->regions.region_props[0].read_mask = 0xf;
+		desc->regions.region_props[0].write_mask = 0xc;
+		desc->regions.region_props[0].client_mask = 0x2;
+	} else {
+		desc->ucode_blob_base = ls_blob->addr;
+		desc->ucode_blob_size = ls_blob->size;
 	}
 }