[PATCH v2 1/2] drm/amd: Invert APU check for amdgpu_device_evict_resources()

Mario Limonciello mario.limonciello at amd.com
Fri Nov 22 19:08:16 UTC 2024


On 11/22/2024 11:00, Alex Deucher wrote:
> On Fri, Nov 22, 2024 at 11:17 AM Mario Limonciello
> <mario.limonciello at amd.com> wrote:
>>
>> Resource eviction isn't needed for s3 or s2idle on APUs, but should
>> be run for S4. As amdgpu_device_evict_resources() will be called
>> by prepare notifier adjust logic so that APUs only cover S4.
>>
>> Suggested-by: Lijo Lazar <lijo.lazar at amd.com>
>> Signed-off-by: Mario Limonciello <mario.limonciello at amd.com>
>> --
>> v2:
>>   * New patch
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> index 11d344166ba7..d511ba949dff 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> @@ -4744,8 +4744,8 @@ static int amdgpu_device_evict_resources(struct amdgpu_device *adev)
>>   {
>>          int ret;
>>
>> -       /* No need to evict vram on APUs for suspend to ram or s2idle */
>> -       if ((adev->in_s3 || adev->in_s0ix) && (adev->flags & AMD_IS_APU))
>> +       /* No need to evict vram on APUs unless going to S4 */
>> +       if (!adev->in_s4 && (adev->flags & AMD_IS_APU))
> 
> Will the in_s4 flag be set at this point?

It won't, so this would mean APU's to S4 wouldn't be covered.  It looks 
like a gap in the prepare() implementation too.

I've adjusted it in v3.

> 
> Alex
> 
>>                  return 0;
>>
>>          ret = amdgpu_ttm_evict_resources(adev, TTM_PL_VRAM);
>> --
>> 2.34.1
>>



More information about the amd-gfx mailing list