From a9a7e4f0187a5c45cc9caa6b22f6458bbb694011 Mon Sep 17 00:00:00 2001 From: Ramesh Mylavarapu Date: Thu, 29 Apr 2021 14:05:46 +0530 Subject: [PATCH] gpu: nvgpu: allocate wpr reserve space for NVRISCV pmu Falcon image is cleanly partitioned between a code and data section where we don't need extra reserved space. NVRISCV image has no clear partition for code and data section, so we need reserved wpr space for runtime use. Bug 200709761 Signed-off-by: Ramesh Mylavarapu Change-Id: I80fa89fc10d0a0fd2fb8b74bae499b66d5563e00 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2509553 Reviewed-by: Mahantesh Kumbar Reviewed-by: Seema Khowala Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: Vijayakumar Subbu Reviewed-by: mobile promotions Tested-by: mobile promotions GVS: Gerrit_Virtual_Submit --- .../gpu/nvgpu/common/acr/acr_blob_construct.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/nvgpu/common/acr/acr_blob_construct.c b/drivers/gpu/nvgpu/common/acr/acr_blob_construct.c index 9b9d8142a..1285d77e1 100644 --- a/drivers/gpu/nvgpu/common/acr/acr_blob_construct.c +++ b/drivers/gpu/nvgpu/common/acr/acr_blob_construct.c @@ -54,6 +54,10 @@ #endif #ifdef CONFIG_NVGPU_LS_PMU +#if defined(CONFIG_NVGPU_NEXT) +#define PMU_NVRISCV_WPR_RSVD_BYTES (0x8000) +#endif + int nvgpu_acr_lsf_pmu_ucode_details(struct gk20a *g, void *lsf_ucode_img) { struct lsf_ucode_desc *lsf_desc; @@ -771,7 +775,17 @@ static int lsf_gen_wpr_requirements(struct gk20a *g, pnode->lsb_header.app_data_size = pnode->lsb_header.data_size; } - +#if defined(CONFIG_NVGPU_NEXT) + /* Falcon image is cleanly partitioned between a code and + * data section where we don't need extra reserved space. + * NVRISCV image has no clear partition for code and data + * section, so need to reserve wpr space. + */ + if (pnode->wpr_header.falcon_id == FALCON_ID_PMU_NEXT_CORE) { + wpr_offset = nvgpu_safe_add_u32(wpr_offset, + (u32)PMU_NVRISCV_WPR_RSVD_BYTES); + } +#endif pnode = pnode->next; }