Skip to contentSkip to conversation

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

PATCH In review Tong Liu01 3 participants 3 messages Mar 21, 2023 – 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 | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +6 -0
index 0b9e99c35a05..69addf2751aa 100644
@@ -841,6 +841,12 @@ static int psp_tmr_unload(struct psp_context *psp)
 	int ret;
 	struct psp_gfx_cmd_resp *cmd = acquire_psp_cmd_buf(psp);
 
+	/* 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;
+
 	psp_prep_tmr_unload_cmd_buf(psp, cmd);
 	dev_dbg(psp->adev->dev, "free PSP TMR buffer\n");
 
Signature · 1 line
2.34.1
maintainer Reviewed-by on v1 1/1
#1 lore raw

[Public]

________________________________
From: Tong Liu01 <[email protected]>
Sent: Tuesday, March 21, 2023 5:19 AM
To: [email protected] <[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]>; 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 | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +6 -0
index 0b9e99c35a05..69addf2751aa 100644
@@ -841,6 +841,12 @@ static int psp_tmr_unload(struct psp_context *psp)
         int ret;
         struct psp_gfx_cmd_resp *cmd = acquire_psp_cmd_buf(psp);
 
+       /* 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;
+
         psp_prep_tmr_unload_cmd_buf(psp, cmd);
         dev_dbg(psp->adev->dev, "free PSP TMR buffer\n");
 

--
2.34.1

Reviewed-by Alex Deucher
#2 lore raw

[Public]

         struct psp_gfx_cmd_resp *cmd = acquire_psp_cmd_buf(psp);

+ /* 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;

This will lead to a psp lock leak by acquire_psp_cmd_buf. It needs to put 'cmd = acquire_psp_cmd_buf(psp);' after SRIOV check.

Regards,
Guchun

From: amd-gfx <[email protected]> On Behalf Of Deucher, Alexander
Sent: Tuesday, March 21, 2023 10:30 PM
To: Liu01, Tong (Esther) <[email protected]>; [email protected]
Cc: Xiao, Jack <[email protected]>; Chen, Horace <[email protected]>; Tuikov, Luben <[email protected]>; Quan, Evan <[email protected]>; Koenig, Christian <[email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: skip unload tmr when tmr is not loaded

[Public]

[Public]

________________________________
From: Tong Liu01 <[email protected]<mailto:[email protected]>>
Sent: Tuesday, March 21, 2023 5:19 AM
To: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Quan, Evan <[email protected]<mailto:[email protected]>>; Chen, Horace <[email protected]<mailto:[email protected]>>; Tuikov, Luben <[email protected]<mailto:[email protected]>>; Koenig, Christian <[email protected]<mailto:[email protected]>>; Deucher, Alexander <[email protected]<mailto:[email protected]>>; Xiao, Jack <[email protected]<mailto:[email protected]>>; Zhang, Hawking <[email protected]<mailto:[email protected]>>; Liu01, Tong (Esther) <[email protected]<mailto:[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 | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +6 -0
index 0b9e99c35a05..69addf2751aa 100644
@@ -841,6 +841,12 @@ static int psp_tmr_unload(struct psp_context *psp)
         int ret;
         struct psp_gfx_cmd_resp *cmd = acquire_psp_cmd_buf(psp);
 
+       /* 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;
+
         psp_prep_tmr_unload_cmd_buf(psp, cmd);
         dev_dbg(psp->adev->dev, "free PSP TMR buffer\n");
 

--
2.34.1