<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#0000FF;margin:5pt;" align="Left">
[AMD Official Use Only - General]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
GFX PG is a pre-requisite for gfxoff IIRC.  We shouldn't disable it on s2idle I think.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Alex</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Mario Limonciello <mario.limonciello@amd.com><br>
<b>Sent:</b> Friday, May 19, 2023 12:24 AM<br>
<b>To:</b> Quan, Evan <Evan.Quan@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Tsao, Anson <anson.tsao@amd.com>; Martinez, Juan <Juan.Martinez@amd.com>; Gong, Richard <Richard.Gong@amd.com>; Huang, Tim <Tim.Huang@amd.com><br>
<b>Subject:</b> Re: [PATCH v4] drm/amd: Flush any delayed gfxoff on suspend entry</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Yeah; that seems like a reasonable way to accomplish the same result.<br>
I'll experiment with this.<br>
<br>
On 5/18/23 22:33, Quan, Evan wrote:<br>
> [AMD Official Use Only - General]<br>
> <br>
> If I understand correctly, similar job is already performed in "amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE);"<br>
> Maybe you just need to undo the "skip PG for GFX on S0ix"?<br>
> <br>
>                  /* skip PG for GFX, SDMA on S0ix */<br>
>                  if (adev->in_s0ix &&<br>
>                      (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GFX ||<br>
>                       adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SDMA))<br>
>                          continue;<br>
> <br>
> Evan<br>
>> -----Original Message-----<br>
>> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Mario<br>
>> Limonciello<br>
>> Sent: Friday, May 19, 2023 12:53 AM<br>
>> To: amd-gfx@lists.freedesktop.org<br>
>> Cc: Tsao, Anson <anson.tsao@amd.com>; Huang, Tim<br>
>> <Tim.Huang@amd.com>; Martinez, Juan <Juan.Martinez@amd.com>;<br>
>> Limonciello, Mario <Mario.Limonciello@amd.com>; Gong, Richard<br>
>> <Richard.Gong@amd.com><br>
>> Subject: [PATCH v4] drm/amd: Flush any delayed gfxoff on suspend entry<br>
>><br>
>> DCN 3.1.4 is reported to hang on s2idle entry if graphics activity<br>
>> is happening during entry.  This is because GFXOFF was scheduled as<br>
>> delayed but RLC gets disabled in s2idle entry sequence which will<br>
>> hang GFX IP if not already in GFXOFF.<br>
>><br>
>> To help this problem, flush any delayed work for GFXOFF early in<br>
>> s2idle entry sequence to ensure that it's off when RLC is changed.<br>
>><br>
>> commit 3964b0c2e843 ("drm/amdgpu: complete gfxoff allow signal during<br>
>> suspend without delay") modified power gating flow so that if called<br>
>> in s0ix that it ensured that GFXOFF wasn't put in work queue but<br>
>> instead processed immediately.<br>
>><br>
>> This is dead code due to commit 5d70a549d00d ("drm/amdgpu: skip<br>
>> CG/PG for gfx during S0ix") because GFXOFF will now not be explicitly<br>
>> called as part of the suspend entry code.  Remove that dead code.<br>
>><br>
>> Cc: stable@vger.kernel.org # 6.1+<br>
>> Suggested-by: Tim Huang <tim.huang@amd.com><br>
>> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com><br>
>> ---<br>
>> v3->v4:<br>
>>   * Drop patches 2-4<br>
>> ---<br>
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 +<br>
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c    | 9 +--------<br>
>>   2 files changed, 2 insertions(+), 8 deletions(-)<br>
>><br>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
>> index a9d9bbe8586b..059139f1f973 100644<br>
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
>> @@ -4316,6 +4316,7 @@ int amdgpu_device_suspend(struct drm_device<br>
>> *dev, bool fbcon)<br>
>>                drm_fb_helper_set_suspend_unlocked(adev_to_drm(adev)-<br>
>>> fb_helper, true);<br>
>><br>
>>        cancel_delayed_work_sync(&adev->delayed_init_work);<br>
>> +     flush_delayed_work(&adev->gfx.gfx_off_delay_work);<br>
>><br>
>>        amdgpu_ras_suspend(adev);<br>
>><br>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c<br>
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c<br>
>> index f2d0b1d55d77..b1190eb0e9c7 100644<br>
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c<br>
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c<br>
>> @@ -692,15 +692,8 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_device<br>
>> *adev, bool enable)<br>
>><br>
>>                if (adev->gfx.gfx_off_req_count == 0 &&<br>
>>                    !adev->gfx.gfx_off_state) {<br>
>> -                     /* If going to s2idle, no need to wait */<br>
>> -                     if (adev->in_s0ix) {<br>
>> -                             if<br>
>> (!amdgpu_dpm_set_powergating_by_smu(adev,<br>
>> -                                             AMD_IP_BLOCK_TYPE_GFX,<br>
>> true))<br>
>> -                                     adev->gfx.gfx_off_state = true;<br>
>> -                     } else {<br>
>> -                             schedule_delayed_work(&adev-<br>
>>> gfx.gfx_off_delay_work,<br>
>> +                     schedule_delayed_work(&adev-<br>
>>> gfx.gfx_off_delay_work,<br>
>>                                              delay);<br>
>> -                     }<br>
>>                }<br>
>>        } else {<br>
>>                if (adev->gfx.gfx_off_req_count == 0) {<br>
>> --<br>
>> 2.34.1<br>
> <br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>