AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Mario Limonciello (AMD) (kernel.org)" <superm1@kernel.org>
To: Alex Deucher <alexdeucher@gmail.com>
Cc: amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH v5 2/5] drm/amd: Add an unwind for failures in amdgpu_device_ip_suspend_phase1()
Date: Thu, 30 Oct 2025 10:16:48 -0500	[thread overview]
Message-ID: <fbf9fa5c-1c60-423c-a06b-b5e8525590ab@kernel.org> (raw)
In-Reply-To: <CADnq5_NuD-h26B8tjPAKmWPE=48u6iFgYibi3uR9XXZuY=B5EA@mail.gmail.com>



On 10/30/2025 10:14 AM, Alex Deucher wrote:
> Patches 2-4 are:
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

Thanks!

How about patch 1?  Patch 4 builds on it, so if that doesn't go in there 
is another unwind step needed.

> 
> On Sun, Oct 26, 2025 at 12:36 AM Mario Limonciello (AMD)
> <superm1@kernel.org> wrote:
>>
>> If any hardware IPs involved with the first phase of suspend fail, unwind
>> all steps to restore back to original state.
>>
>> Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 18 ++++++++++++++++--
>>   1 file changed, 16 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> index f6850b86e96f..b9ea91b2c92f 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> @@ -178,6 +178,7 @@ struct amdgpu_init_level amdgpu_init_minimal_xgmi = {
>>                  BIT(AMD_IP_BLOCK_TYPE_COMMON) | BIT(AMD_IP_BLOCK_TYPE_IH) |
>>                  BIT(AMD_IP_BLOCK_TYPE_PSP)
>>   };
>> +static int amdgpu_device_ip_resume_phase3(struct amdgpu_device *adev);
>>
>>   static void amdgpu_device_load_switch_state(struct amdgpu_device *adev);
>>
>> @@ -3784,7 +3785,7 @@ static void amdgpu_device_delay_enable_gfx_off(struct work_struct *work)
>>    */
>>   static int amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev)
>>   {
>> -       int i, r;
>> +       int i, r, rec;
>>
>>          amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE);
>>          amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE);
>> @@ -3807,10 +3808,23 @@ static int amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev)
>>
>>                  r = amdgpu_ip_block_suspend(&adev->ip_blocks[i]);
>>                  if (r)
>> -                       return r;
>> +                       goto unwind;
>>          }
>>
>>          return 0;
>> +unwind:
>> +       rec = amdgpu_device_ip_resume_phase3(adev);
>> +       if (rec)
>> +               dev_err(adev->dev,
>> +                       "amdgpu_device_ip_resume_phase3 failed during unwind: %d\n",
>> +                       rec);
>> +
>> +       amdgpu_dpm_set_df_cstate(adev, DF_CSTATE_ALLOW);
>> +
>> +       amdgpu_device_set_pg_state(adev, AMD_PG_STATE_GATE);
>> +       amdgpu_device_set_cg_state(adev, AMD_CG_STATE_GATE);
>> +
>> +       return r;
>>   }
>>
>>   /**
>> --
>> 2.51.1
>>


  reply	other threads:[~2025-10-30 15:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-26  4:29 [PATCH v5 0/5] Unwind failed suspend Mario Limonciello (AMD)
2025-10-26  4:29 ` [PATCH v5 1/5] drm/amdgpu: Drop PMFW RLC notifier from amdgpu_device_suspend() Mario Limonciello (AMD)
2025-10-31 12:01   ` Antheas Kapenekakis
2025-10-31 12:59     ` Mario Limonciello (AMD) (kernel.org)
2025-10-26  4:29 ` [PATCH v5 2/5] drm/amd: Add an unwind for failures in amdgpu_device_ip_suspend_phase1() Mario Limonciello (AMD)
2025-10-30 15:14   ` Alex Deucher
2025-10-30 15:16     ` Mario Limonciello (AMD) (kernel.org) [this message]
2025-10-30 15:18       ` Alex Deucher
2025-10-30 15:20         ` Mario Limonciello (AMD) (kernel.org)
2025-10-26  4:29 ` [PATCH v5 3/5] drm/amd: Add an unwind for failures in amdgpu_device_ip_suspend_phase2() Mario Limonciello (AMD)
2025-10-26  4:29 ` [PATCH v5 4/5] drm/amd: Unwind for failed device suspend Mario Limonciello (AMD)
2025-10-26  4:29 ` [PATCH v5 5/5] drm/amd: Reset the GPU if pmops failed Mario Limonciello (AMD)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fbf9fa5c-1c60-423c-a06b-b5e8525590ab@kernel.org \
    --to=superm1@kernel.org \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox