amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: skip unload tmr when tmr is not loaded
@ 2023-03-22  2:36 Tong Liu01
  2023-03-22  3:26 ` Chen, Guchun
  0 siblings, 1 reply; 5+ messages in thread
From: Tong Liu01 @ 2023-03-22  2:36 UTC (permalink / raw)
  To: amd-gfx
  Cc: Jack Xiao, guchun.chen, Feifei Xu, horace.chen, Kevin Wang,
	Tong Liu01, Tuikov Luben, Deucher Alexander, Evan Quan,
	Christian König, Monk Liu, Hawking Zhang

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

Signed-off-by: Tong Liu01 <Tong.Liu01@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index 0b9e99c35a05..0a3d9f7e277b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -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");
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [PATCH] drm/amdgpu: skip unload tmr when tmr is not loaded
  2023-03-22  2:36 [PATCH] drm/amdgpu: skip unload tmr when tmr is not loaded Tong Liu01
@ 2023-03-22  3:26 ` Chen, Guchun
  0 siblings, 0 replies; 5+ messages in thread
From: Chen, Guchun @ 2023-03-22  3:26 UTC (permalink / raw)
  To: Liu01, Tong (Esther), amd-gfx
  Cc: Xiao, Jack, Wang, Yang(Kevin),
	Xu, Feifei, Chen, Horace, Liu01, Tong (Esther),
	Tuikov, Luben, Deucher, Alexander, Quan, Evan, Koenig, Christian,
	Liu, Monk, Zhang, Hawking



> -----Original Message-----
> From: Tong Liu01 <Tong.Liu01@amd.com>
> Sent: Wednesday, March 22, 2023 10:37 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: Quan, Evan <Evan.Quan@amd.com>; Chen, Horace
> <Horace.Chen@amd.com>; Tuikov, Luben <Luben.Tuikov@amd.com>;
> Koenig, Christian <Christian.Koenig@amd.com>; Deucher, Alexander
> <Alexander.Deucher@amd.com>; Xiao, Jack <Jack.Xiao@amd.com>; Zhang,
> Hawking <Hawking.Zhang@amd.com>; Liu, Monk <Monk.Liu@amd.com>; Xu,
> Feifei <Feifei.Xu@amd.com>; Wang, Yang(Kevin)
> <KevinYang.Wang@amd.com>; Chen, Guchun <Guchun.Chen@amd.com>;
> Liu01, Tong (Esther) <Tong.Liu01@amd.com>
> 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
> 
> Signed-off-by: Tong Liu01 <Tong.Liu01@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> index 0b9e99c35a05..0a3d9f7e277b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> @@ -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:
Reviewed-by: Guchun Chen <guchun.chen@amd.com>

Regards,
Guchun

> +	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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] drm/amdgpu: skip unload tmr when tmr is not loaded
  2023-03-21 14:30 ` Deucher, Alexander
@ 2023-03-22  1:40   ` Chen, Guchun
  0 siblings, 0 replies; 5+ messages in thread
From: Chen, Guchun @ 2023-03-22  1:40 UTC (permalink / raw)
  To: Deucher, Alexander, Liu01, Tong (Esther), amd-gfx
  Cc: Xiao, Jack, Chen, Horace, Tuikov, Luben, Quan, Evan, Koenig,
	Christian, Zhang, Hawking

[-- Attachment #1: Type: text/plain, Size: 2986 bytes --]

[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 <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Deucher, Alexander
Sent: Tuesday, March 21, 2023 10:30 PM
To: Liu01, Tong (Esther) <Tong.Liu01@amd.com>; amd-gfx@lists.freedesktop.org
Cc: Xiao, Jack <Jack.Xiao@amd.com>; Chen, Horace <Horace.Chen@amd.com>; Tuikov, Luben <Luben.Tuikov@amd.com>; Quan, Evan <Evan.Quan@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com>
Subject: Re: [PATCH] drm/amdgpu: skip unload tmr when tmr is not loaded


[Public]


[Public]

Reviewed-by: Alex Deucher <alexander.deucher@amd.com<mailto:alexander.deucher@amd.com>>
________________________________
From: Tong Liu01 <Tong.Liu01@amd.com<mailto:Tong.Liu01@amd.com>>
Sent: Tuesday, March 21, 2023 5:19 AM
To: amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org> <amd-gfx@lists.freedesktop.org<mailto:amd-gfx@lists.freedesktop.org>>
Cc: Quan, Evan <Evan.Quan@amd.com<mailto:Evan.Quan@amd.com>>; Chen, Horace <Horace.Chen@amd.com<mailto:Horace.Chen@amd.com>>; Tuikov, Luben <Luben.Tuikov@amd.com<mailto:Luben.Tuikov@amd.com>>; Koenig, Christian <Christian.Koenig@amd.com<mailto:Christian.Koenig@amd.com>>; Deucher, Alexander <Alexander.Deucher@amd.com<mailto:Alexander.Deucher@amd.com>>; Xiao, Jack <Jack.Xiao@amd.com<mailto:Jack.Xiao@amd.com>>; Zhang, Hawking <Hawking.Zhang@amd.com<mailto:Hawking.Zhang@amd.com>>; Liu01, Tong (Esther) <Tong.Liu01@amd.com<mailto:Tong.Liu01@amd.com>>
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

Signed-off-by: Tong Liu01 <Tong.Liu01@amd.com<mailto:Tong.Liu01@amd.com>>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index 0b9e99c35a05..69addf2751aa 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -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

[-- Attachment #2: Type: text/html, Size: 7550 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/amdgpu: skip unload tmr when tmr is not loaded
  2023-03-21  9:19 Tong Liu01
@ 2023-03-21 14:30 ` Deucher, Alexander
  2023-03-22  1:40   ` Chen, Guchun
  0 siblings, 1 reply; 5+ messages in thread
From: Deucher, Alexander @ 2023-03-21 14:30 UTC (permalink / raw)
  To: Liu01, Tong (Esther), amd-gfx
  Cc: Xiao, Jack, Chen, Horace, Tuikov, Luben, Quan, Evan, Koenig,
	Christian, Zhang,  Hawking

[-- Attachment #1: Type: text/plain, Size: 1616 bytes --]

[Public]

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
________________________________
From: Tong Liu01 <Tong.Liu01@amd.com>
Sent: Tuesday, March 21, 2023 5:19 AM
To: amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>
Cc: Quan, Evan <Evan.Quan@amd.com>; Chen, Horace <Horace.Chen@amd.com>; Tuikov, Luben <Luben.Tuikov@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com>; Xiao, Jack <Jack.Xiao@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com>; Liu01, Tong (Esther) <Tong.Liu01@amd.com>
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

Signed-off-by: Tong Liu01 <Tong.Liu01@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index 0b9e99c35a05..69addf2751aa 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -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


[-- Attachment #2: Type: text/html, Size: 3103 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] drm/amdgpu: skip unload tmr when tmr is not loaded
@ 2023-03-21  9:19 Tong Liu01
  2023-03-21 14:30 ` Deucher, Alexander
  0 siblings, 1 reply; 5+ messages in thread
From: Tong Liu01 @ 2023-03-21  9:19 UTC (permalink / raw)
  To: amd-gfx
  Cc: Jack Xiao, horace.chen, Tong Liu01, Tuikov Luben,
	Deucher Alexander, Evan Quan, Christian König,
	Hawking Zhang

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

Signed-off-by: Tong Liu01 <Tong.Liu01@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index 0b9e99c35a05..69addf2751aa 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-22  3:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22  2:36 [PATCH] drm/amdgpu: skip unload tmr when tmr is not loaded Tong Liu01
2023-03-22  3:26 ` Chen, Guchun
  -- strict thread matches above, loose matches on Subject: below --
2023-03-21  9:19 Tong Liu01
2023-03-21 14:30 ` Deucher, Alexander
2023-03-22  1:40   ` Chen, Guchun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).