[v5,6/18] secboot: add LS flags to LS func structure

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

Details

Message ID 3eeb75bdbc2023a88e59a25e106603ab1b4bdaaf.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.
Add a flag that can be set when declaring how a LS firmware should be
loaded. This allows us to remove falcon-specific code in the loader.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drm/nouveau/nvkm/subdev/secboot/acr_r352.c | 10 ++++------
 drm/nouveau/nvkm/subdev/secboot/acr_r352.h |  2 ++
 drm/nouveau/nvkm/subdev/secboot/acr_r361.c |  2 ++
 3 files changed, 8 insertions(+), 6 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 d8cf06d4efd0..0d44575ea272 100644
--- a/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
+++ b/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
@@ -266,13 +266,9 @@  ls_ucode_img_fill_headers(struct acr_r352 *acr, struct ls_ucode_img *img,
 			     desc->app_resident_data_offset;
 	lhdr->app_data_size = desc->app_resident_data_size;
 
-	lhdr->flags = 0;
+	lhdr->flags = func->lhdr_flags;
 	if (img->falcon_id == acr->base.boot_falcon)
-		lhdr->flags = LSF_FLAG_DMACTL_REQ_CTX;
-
-	/* GPCCS will be loaded using PRI */
-	if (img->falcon_id == NVKM_SECBOOT_FALCON_GPCCS)
-		lhdr->flags |= LSF_FLAG_FORCE_PRIV_LOAD;
+		lhdr->flags |= LSF_FLAG_DMACTL_REQ_CTX;
 
 	/* Align and save off BL descriptor size */
 	lhdr->bl_data_size = ALIGN(func->bl_desc_size, LSF_BL_DATA_SIZE_ALIGN);
@@ -862,6 +858,8 @@  acr_r352_ls_gpccs_func = {
 	.load = acr_ls_ucode_load_gpccs,
 	.generate_bl_desc = acr_r352_generate_flcn_bl_desc,
 	.bl_desc_size = sizeof(struct acr_r352_flcn_bl_desc),
+	/* GPCCS will be loaded using PRI */
+	.lhdr_flags = LSF_FLAG_FORCE_PRIV_LOAD,
 };
 
 const struct acr_r352_func
diff --git a/drm/nouveau/nvkm/subdev/secboot/acr_r352.h b/drm/nouveau/nvkm/subdev/secboot/acr_r352.h
index 031bd09fd50a..9323ed0ae040 100644
--- a/drm/nouveau/nvkm/subdev/secboot/acr_r352.h
+++ b/drm/nouveau/nvkm/subdev/secboot/acr_r352.h
@@ -52,12 +52,14 @@  struct hsf_load_header {
  * @generate_bl_desc: function called on a block of bl_desc_size to generate the
  *		      proper bootloader descriptor for this LS firmware
  * @bl_desc_size: size of the bootloader descriptor
+ * @lhdr_flags: LS flags
  */
 struct acr_r352_ls_func {
 	int (*load)(const struct nvkm_subdev *, struct ls_ucode_img *);
 	void (*generate_bl_desc)(const struct nvkm_acr *,
 				 const struct ls_ucode_img *, u64, void *);
 	u32 bl_desc_size;
+	u32 lhdr_flags;
 };
 
 /**
diff --git a/drm/nouveau/nvkm/subdev/secboot/acr_r361.c b/drm/nouveau/nvkm/subdev/secboot/acr_r361.c
index ec1c5589ffce..097e641d3a11 100644
--- a/drm/nouveau/nvkm/subdev/secboot/acr_r361.c
+++ b/drm/nouveau/nvkm/subdev/secboot/acr_r361.c
@@ -115,6 +115,8 @@  acr_r361_ls_gpccs_func = {
 	.load = acr_ls_ucode_load_gpccs,
 	.generate_bl_desc = acr_r361_generate_flcn_bl_desc,
 	.bl_desc_size = sizeof(struct acr_r361_flcn_bl_desc),
+	/* GPCCS will be loaded using PRI */
+	.lhdr_flags = LSF_FLAG_FORCE_PRIV_LOAD,
 };
 
 const struct acr_r352_func