Skip to contentSkip to conversation

drm/amdgpu: skip unload tmr when tmr is not loaded

PATCH In review Tong Liu01 2 participants 2 messages Mar 22, 2023

Subsystems (2)
lore
Share & tools
lore

Tong Liu01

author
#0 lore raw

PATCH 1/1 drm/amdgpu: skip unload tmr when tmr is not loaded

[why]
For Navi12 and CHIP_SIENNA_CICHLID SRIOV, TMR is not loaded. Should also skip tmr unload

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +9 -1
index 0b9e99c35a05..0a3d9f7e277b 100644
@@ -839,7 +839,15 @@ static void psp_prep_tmr_unload_cmd_buf(struct psp_context *psp,
 static int psp_tmr_unload(struct psp_context *psp)
 {
 	int ret;
-	struct psp_gfx_cmd_resp *cmd = acquire_psp_cmd_buf(psp);
+	struct psp_gfx_cmd_resp *cmd;
+
+	/* For Navi12 and CHIP_SIENNA_CICHLID SRIOV, do not set up TMR.
+	 * Already set up by host driver.
+	 */
+	if (amdgpu_sriov_vf(psp->adev) && psp_skip_tmr(psp))
+		return 0;
+
+	cmd = acquire_psp_cmd_buf(psp);
 
 	psp_prep_tmr_unload_cmd_buf(psp, cmd);
 	dev_dbg(psp->adev->dev, "free PSP TMR buffer\n");
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 31 lines

-----Original Message-----
From: Tong Liu01 <[email protected]>
Sent: Wednesday, March 22, 2023 10:37 AM
To: [email protected]
Cc: Quan, Evan <[email protected]>; Chen, Horace <[email protected]>; Tuikov, Luben <[email protected]>; Koenig, Christian <[email protected]>; Deucher, Alexander <[email protected]>; Xiao, Jack <[email protected]>; Zhang, Hawking <[email protected]>; Liu, Monk <[email protected]>; Xu, Feifei <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Chen, Guchun <[email protected]>; Liu01, Tong (Esther) <[email protected]>
Subject: [PATCH] drm/amdgpu: skip unload tmr when tmr is not loaded

[why]
For Navi12 and CHIP_SIENNA_CICHLID SRIOV, TMR is not loaded. Should also skip tmr unload

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0 -0
index 0b9e99c35a05..0a3d9f7e277b 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c static void psp_prep_tmr_unload_cmd_buf(struct · line 845

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +5 -1
@@ -839,7 +839,15 @@ static void psp_prep_tmr_unload_cmd_buf(struct
 psp_context *psp,  static int psp_tmr_unload(struct psp_context *psp)  {
 	int ret;
-	struct psp_gfx_cmd_resp *cmd = acquire_psp_cmd_buf(psp);
+	struct psp_gfx_cmd_resp *cmd;
+
+	/* For Navi12 and CHIP_SIENNA_CICHLID SRIOV, do not set up TMR.
+	 * Already set up by host driver.
+	 */

I would say something like "skip TMR unload for Navi12 and CHIP_SIENNA_CICHLID SRIOV, as TMR is not loaded at all."

With above comment improved, the patch is:

Regards,
Guchun

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +4 -1
+	if (amdgpu_sriov_vf(psp->adev) && psp_skip_tmr(psp))
+		return 0;
+
+	cmd = acquire_psp_cmd_buf(psp);
 
 	psp_prep_tmr_unload_cmd_buf(psp, cmd);
 	dev_dbg(psp->adev->dev, "free PSP TMR buffer\n");
--

2.34.1