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

Guo, Shikai Shikai.Guo at amd.com
Thu Nov 24 04:00:52 UTC 2022


[AMD Official Use Only - General]

Reviewed-by: shikaguo <shikai.guo at amd.com>

-----Original Message-----
From: Deucher, Alexander <Alexander.Deucher at amd.com> 
Sent: Wednesday, November 23, 2022 10:00 PM
To: amd-gfx at lists.freedesktop.org
Cc: Deucher, Alexander <Alexander.Deucher at amd.com>; Guo, Shikai <Shikai.Guo at amd.com>
Subject: [PATCH] drm/amdgpu/psp: always call psp_load_toc()

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 17647 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20221124/03dcefe5/attachment-0001.bin>


More information about the amd-gfx mailing list