]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amd: Only run s3 or s0ix if system is configured properly
authorMario Limonciello <mario.limonciello@amd.com>
Wed, 26 Jan 2022 03:37:57 +0000 (21:37 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 2 Feb 2022 23:35:00 +0000 (18:35 -0500)
This will cause misconfigured systems to not run the GPU suspend
routines.

* In APUs that are properly configured system will go into s2idle.
* In APUs that are intended to be S3 but user selects
  s2idle the GPU will stay fully powered for the suspend.
* In APUs that are intended to be s2idle and system misconfigured
  the GPU will stay fully powered for the suspend.
* In systems that are intended to be s2idle, but AMD dGPU is also
  present, the dGPU will go through S3

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

index 4c83f1db8a244427ae65c23bc8af6f9b31a7fdfc..17747252e72213a6fd51cbf1855dd0246cb92d31 100644 (file)
@@ -2246,6 +2246,7 @@ static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work)
 static int amdgpu_pmops_prepare(struct device *dev)
 {
        struct drm_device *drm_dev = dev_get_drvdata(dev);
+       struct amdgpu_device *adev = drm_to_adev(drm_dev);
 
        /* Return a positive number here so
         * DPM_FLAG_SMART_SUSPEND works properly
@@ -2254,6 +2255,13 @@ static int amdgpu_pmops_prepare(struct device *dev)
                return pm_runtime_suspended(dev) &&
                        pm_suspend_via_firmware();
 
+       /* if we will not support s3 or s2i for the device
+        *  then skip suspend
+        */
+       if (!amdgpu_acpi_is_s0ix_active(adev) &&
+           !amdgpu_acpi_is_s3_active(adev))
+               return 1;
+
        return 0;
 }