[Nouveau] [PATCH v4 27/33] secboot: add LS firmware post-run hooks

Alexandre Courbot acourbot at nvidia.com
Mon Nov 21 08:29:24 UTC 2016


Add the ability for LS firmwares to declare a post-run hook that is
invoked right after the HS firmware is executed. This allows them to
e.g. write some initialization data into the falcon's DMEM.

Signed-off-by: Alexandre Courbot <acourbot at nvidia.com>
---
 drm/nouveau/nvkm/subdev/secboot/acr_r352.c | 11 +++++++++++
 drm/nouveau/nvkm/subdev/secboot/acr_r352.h |  2 ++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drm/nouveau/nvkm/subdev/secboot/acr_r352.c b/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
index 534a2a5ec25b..fd316bd2f0a4 100644
--- a/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
+++ b/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
@@ -768,6 +768,8 @@ acr_r352_bootstrap(struct acr_r352 *acr, struct nvkm_secboot *sb)
 {
 	struct nvkm_subdev *subdev = &sb->subdev;
 	struct nvkm_device *device = subdev->device;
+	unsigned long managed_falcons = acr->base.managed_falcons;
+	int falcon_id;
 	int ret;
 
 	if (sb->wpr_set)
@@ -787,6 +789,15 @@ acr_r352_bootstrap(struct acr_r352 *acr, struct nvkm_secboot *sb)
 
 	sb->wpr_set = true;
 
+	/* Run LS firmwares post_run hooks */
+	for_each_set_bit(falcon_id, &managed_falcons, NVKM_FALCON_END) {
+		const struct acr_r352_ls_func *func =
+						  acr->func->ls_func[falcon_id];
+
+		if (func->post_run)
+			func->post_run(&acr->base, sb);
+	}
+
 	return 0;
 }
 
diff --git a/drm/nouveau/nvkm/subdev/secboot/acr_r352.h b/drm/nouveau/nvkm/subdev/secboot/acr_r352.h
index b92125abfc7b..5962a45ec809 100644
--- a/drm/nouveau/nvkm/subdev/secboot/acr_r352.h
+++ b/drm/nouveau/nvkm/subdev/secboot/acr_r352.h
@@ -157,6 +157,7 @@ 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
+ * @post_run: hook called right after the ACR is executed
  * @lhdr_flags: LS flags
  */
 struct acr_r352_ls_func {
@@ -164,6 +165,7 @@ struct acr_r352_ls_func {
 	void (*generate_bl_desc)(const struct nvkm_acr *,
 				 const struct ls_ucode_img *, u64, void *);
 	u32 bl_desc_size;
+	void (*post_run)(const struct nvkm_acr *, const struct nvkm_secboot *);
 	u32 lhdr_flags;
 };
 
-- 
git-series 0.8.10


More information about the Nouveau mailing list