Browse Source

drm/nouveau/secboot: let LS post_run hooks return error

A LS post-run hook can meet an error meaning the failure of secure boot.
Make sure this can be reported.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Alexandre Courbot 8 years ago
parent
commit
d424d278b2

+ 5 - 2
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c

@@ -920,8 +920,11 @@ acr_r352_bootstrap(struct acr_r352 *acr, struct nvkm_secboot *sb)
 		const struct acr_r352_ls_func *func =
 		const struct acr_r352_ls_func *func =
 						  acr->func->ls_func[falcon_id];
 						  acr->func->ls_func[falcon_id];
 
 
-		if (func->post_run)
-			func->post_run(&acr->base, sb);
+		if (func->post_run) {
+			ret = func->post_run(&acr->base, sb);
+			if (ret)
+				return ret;
+		}
 	}
 	}
 
 
 	/* Re-start ourselves if we are managed */
 	/* Re-start ourselves if we are managed */

+ 1 - 1
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.h

@@ -61,7 +61,7 @@ struct acr_r352_ls_func {
 	void (*generate_bl_desc)(const struct nvkm_acr *,
 	void (*generate_bl_desc)(const struct nvkm_acr *,
 				 const struct ls_ucode_img *, u64, void *);
 				 const struct ls_ucode_img *, u64, void *);
 	u32 bl_desc_size;
 	u32 bl_desc_size;
-	void (*post_run)(const struct nvkm_acr *, const struct nvkm_secboot *);
+	int (*post_run)(const struct nvkm_acr *, const struct nvkm_secboot *);
 	u32 lhdr_flags;
 	u32 lhdr_flags;
 };
 };
 
 

+ 2 - 2
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/ls_ucode.h

@@ -150,8 +150,8 @@ struct fw_bl_desc {
 int acr_ls_ucode_load_fecs(const struct nvkm_secboot *, struct ls_ucode_img *);
 int acr_ls_ucode_load_fecs(const struct nvkm_secboot *, struct ls_ucode_img *);
 int acr_ls_ucode_load_gpccs(const struct nvkm_secboot *, struct ls_ucode_img *);
 int acr_ls_ucode_load_gpccs(const struct nvkm_secboot *, struct ls_ucode_img *);
 int acr_ls_ucode_load_pmu(const struct nvkm_secboot *, struct ls_ucode_img *);
 int acr_ls_ucode_load_pmu(const struct nvkm_secboot *, struct ls_ucode_img *);
-void acr_ls_pmu_post_run(const struct nvkm_acr *, const struct nvkm_secboot *);
+int acr_ls_pmu_post_run(const struct nvkm_acr *, const struct nvkm_secboot *);
 int acr_ls_ucode_load_sec2(const struct nvkm_secboot *, struct ls_ucode_img *);
 int acr_ls_ucode_load_sec2(const struct nvkm_secboot *, struct ls_ucode_img *);
-void acr_ls_sec2_post_run(const struct nvkm_acr *, const struct nvkm_secboot *);
+int acr_ls_sec2_post_run(const struct nvkm_acr *, const struct nvkm_secboot *);
 
 
 #endif
 #endif

+ 18 - 5
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/ls_ucode_msgqueue.c

@@ -73,7 +73,7 @@ acr_ls_ucode_load_msgqueue(const struct nvkm_subdev *subdev, const char *name,
 	return 0;
 	return 0;
 }
 }
 
 
-static void
+static int
 acr_ls_msgqueue_post_run(struct nvkm_msgqueue *queue,
 acr_ls_msgqueue_post_run(struct nvkm_msgqueue *queue,
 			 struct nvkm_falcon *falcon, u32 addr_args)
 			 struct nvkm_falcon *falcon, u32 addr_args)
 {
 {
@@ -85,6 +85,8 @@ acr_ls_msgqueue_post_run(struct nvkm_msgqueue *queue,
 	nvkm_falcon_load_dmem(falcon, buf, addr_args, cmdline_size, 0);
 	nvkm_falcon_load_dmem(falcon, buf, addr_args, cmdline_size, 0);
 	/* rearm the queue so it will wait for the init message */
 	/* rearm the queue so it will wait for the init message */
 	nvkm_msgqueue_reinit(queue);
 	nvkm_msgqueue_reinit(queue);
+
+	return 0;
 }
 }
 
 
 int
 int
@@ -106,14 +108,19 @@ acr_ls_ucode_load_pmu(const struct nvkm_secboot *sb, struct ls_ucode_img *img)
 	return 0;
 	return 0;
 }
 }
 
 
-void
+int
 acr_ls_pmu_post_run(const struct nvkm_acr *acr, const struct nvkm_secboot *sb)
 acr_ls_pmu_post_run(const struct nvkm_acr *acr, const struct nvkm_secboot *sb)
 {
 {
 	struct nvkm_device *device = sb->subdev.device;
 	struct nvkm_device *device = sb->subdev.device;
 	struct nvkm_pmu *pmu = device->pmu;
 	struct nvkm_pmu *pmu = device->pmu;
 	u32 addr_args = pmu->falcon->data.limit - NVKM_MSGQUEUE_CMDLINE_SIZE;
 	u32 addr_args = pmu->falcon->data.limit - NVKM_MSGQUEUE_CMDLINE_SIZE;
+	int ret;
+
+	ret = acr_ls_msgqueue_post_run(pmu->queue, pmu->falcon, addr_args);
+	if (ret)
+		return ret;
 
 
-	acr_ls_msgqueue_post_run(pmu->queue, pmu->falcon, addr_args);
+	return 0;
 }
 }
 
 
 int
 int
@@ -135,13 +142,19 @@ acr_ls_ucode_load_sec2(const struct nvkm_secboot *sb, struct ls_ucode_img *img)
 	return 0;
 	return 0;
 }
 }
 
 
-void
+int
 acr_ls_sec2_post_run(const struct nvkm_acr *acr, const struct nvkm_secboot *sb)
 acr_ls_sec2_post_run(const struct nvkm_acr *acr, const struct nvkm_secboot *sb)
 {
 {
 	struct nvkm_device *device = sb->subdev.device;
 	struct nvkm_device *device = sb->subdev.device;
 	struct nvkm_sec2 *sec = device->sec2;
 	struct nvkm_sec2 *sec = device->sec2;
 	/* on SEC arguments are always at the beginning of EMEM */
 	/* on SEC arguments are always at the beginning of EMEM */
 	u32 addr_args = 0x01000000;
 	u32 addr_args = 0x01000000;
+	int ret;
+
+	ret = acr_ls_msgqueue_post_run(sec->queue, sec->falcon, addr_args);
+	if (ret)
+		return ret;
 
 
-	acr_ls_msgqueue_post_run(sec->queue, sec->falcon, addr_args);
+
+	return 0;
 }
 }