[PATCH] drm/amdgpu/psp: always call psp_load_toc()

Alex Deucher alexander.deucher at amd.com
Wed Nov 23 14:00:25 UTC 2022


We need to always call psp_load_toc() regardless of
whether we re-allocate the TMR buffer or not. Fixes
S4.

Fixes: 36238df85ade ("drm/amdgpu/psp: don't free PSP buffers on suspend")
Reported-by: Skikai Guo <shikai.guo at amd.com>
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 42 ++++++++++++-------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index 621723f510a9..7978307e1d6d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -750,29 +750,29 @@ static int psp_tmr_init(struct psp_context *psp)
 	void *tmr_buf;
 	void **pptr;
 
-	if (!psp->tmr_bo) {
-		/*
-		 * According to HW engineer, they prefer the TMR address be "naturally
-		 * aligned" , e.g. the start address be an integer divide of TMR size.
-		 *
-		 * Note: this memory need be reserved till the driver
-		 * uninitializes.
-		 */
-		tmr_size = PSP_TMR_SIZE(psp->adev);
-
-		/* For ASICs support RLC autoload, psp will parse the toc
-		 * and calculate the total size of TMR needed */
-		if (!amdgpu_sriov_vf(psp->adev) &&
-		    psp->toc.start_addr &&
-		    psp->toc.size_bytes &&
-		    psp->fw_pri_buf) {
-			ret = psp_load_toc(psp, &tmr_size);
-			if (ret) {
-				DRM_ERROR("Failed to load toc\n");
-				return ret;
-			}
+	/*
+	 * According to HW engineer, they prefer the TMR address be "naturally
+	 * aligned" , e.g. the start address be an integer divide of TMR size.
+	 *
+	 * Note: this memory need be reserved till the driver
+	 * uninitializes.
+	 */
+	tmr_size = PSP_TMR_SIZE(psp->adev);
+
+	/* For ASICs support RLC autoload, psp will parse the toc
+	 * and calculate the total size of TMR needed */
+	if (!amdgpu_sriov_vf(psp->adev) &&
+	    psp->toc.start_addr &&
+	    psp->toc.size_bytes &&
+	    psp->fw_pri_buf) {
+		ret = psp_load_toc(psp, &tmr_size);
+		if (ret) {
+			DRM_ERROR("Failed to load toc\n");
+			return ret;
 		}
+	}
 
+	if (!psp->tmr_bo) {
 		pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL;
 		ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_ALIGNMENT,
 					      AMDGPU_GEM_DOMAIN_VRAM,
-- 
2.38.1



More information about the amd-gfx mailing list