From 3de579438edaaf8fa62510ea0d20ff25bf9f56d4 Mon Sep 17 00:00:00 2001 From: mpoojary Date: Fri, 9 Aug 2024 14:51:12 +0000 Subject: [PATCH] gpu: nvgpu: Add lsf encrypt check for ACR blob prep Add lsf encrypt flag check for ACR blob preparation NVGPU will pass the same previous blob during recovery sequence instead of 0 blob size, if any of ucode image is encrypted. BUG 4617207 Bug 4786365 Change-Id: I7a76cc426dda90930e8b7eded9656af9f2eb952a Signed-off-by: mpoojary Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/3191453 Reviewed-by: Mahantesh Kumbar GVS: buildbot_gerritrpt --- drivers/gpu/nvgpu/common/acr/acr.c | 1 + drivers/gpu/nvgpu/common/acr/acr_priv.h | 1 + drivers/gpu/nvgpu/common/acr/acr_sw_ga10b.c | 26 +++++++++++++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/common/acr/acr.c b/drivers/gpu/nvgpu/common/acr/acr.c index bf68ed99f..101b1c892 100644 --- a/drivers/gpu/nvgpu/common/acr/acr.c +++ b/drivers/gpu/nvgpu/common/acr/acr.c @@ -148,6 +148,7 @@ int nvgpu_acr_init(struct gk20a *g) nvgpu_gv11b_acr_sw_init(g, g->acr); break; case NVGPU_GPUID_GA10B: + g->acr->is_lsf_encrypt_support = true; nvgpu_ga10b_acr_sw_init(g, g->acr); break; #ifdef CONFIG_NVGPU_DGPU diff --git a/drivers/gpu/nvgpu/common/acr/acr_priv.h b/drivers/gpu/nvgpu/common/acr/acr_priv.h index 1dda2005b..4fd9eefe9 100644 --- a/drivers/gpu/nvgpu/common/acr/acr_priv.h +++ b/drivers/gpu/nvgpu/common/acr/acr_priv.h @@ -136,6 +136,7 @@ struct nvgpu_acr { /* LSF properties */ u64 lsf_enable_mask; + bool is_lsf_encrypt_support; struct acr_lsf_config lsf[FALCON_ID_END]; /* diff --git a/drivers/gpu/nvgpu/common/acr/acr_sw_ga10b.c b/drivers/gpu/nvgpu/common/acr/acr_sw_ga10b.c index b800ce274..5e56d1a3f 100644 --- a/drivers/gpu/nvgpu/common/acr/acr_sw_ga10b.c +++ b/drivers/gpu/nvgpu/common/acr/acr_sw_ga10b.c @@ -102,8 +102,19 @@ static int ga10b_acr_patch_wpr_info_to_ucode(struct gk20a *g, nvgpu_err(g, "invalid mem acr_falcon2_sysmem_desc"); return -EINVAL; } - acr_sysmem_desc->nonwpr_ucode_blob_size = + /* + * In T234 the CTXSW LS ucodes are encrypted. ACR will perform the + * decryption and the decrypted content will be written back + * into the same WPR location. So on recovery with LSPMU absence + * and on warm boot case, to perform the authentication , the ucode + * blob needs to be copied into the WPR from sysmem always. + * Below are the LS ucodes authentication type + * LSPMU - Encrypted and Signed + */ + if (!acr->is_lsf_encrypt_support) { + acr_sysmem_desc->nonwpr_ucode_blob_size = RECOVERY_UCODE_BLOB_SIZE; + } } else #endif { @@ -121,8 +132,19 @@ static int ga10b_acr_patch_wpr_info_to_ucode(struct gk20a *g, goto end; } } else { - acr_sysmem_desc->nonwpr_ucode_blob_size = + /* + * In T234 the CTXSW LS ucodes are encrypted. ACR will perform the + * decryption and the decrypted content will be written back + * into the same WPR location. So on recovery with LSPMU absence + * and on warm boot case, to perform the authentication , the ucode + * blob needs to be copied into the WPR from sysmem always. + * Below are the LS ucodes authentication type + * LSPMU - Encrypted and Signed + */ + if (!acr->is_lsf_encrypt_support) { + acr_sysmem_desc->nonwpr_ucode_blob_size = RECOVERY_UCODE_BLOB_SIZE; + } goto load; }