drm/amd: Only run s3 or s0ix if system is configured properly
authorjsg <jsg@openbsd.org>
Thu, 24 Feb 2022 12:45:37 +0000 (12:45 +0000)
committerjsg <jsg@openbsd.org>
Thu, 24 Feb 2022 12:45:37 +0000 (12:45 +0000)
From Mario Limonciello
38108fd273acbc6248870a7a3e61714398af6f94 in linux 5.15.y/5.15.25
04ef860469fda6a646dc841190d05b31fae68e8c in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c

index 8511b65..0914e14 100644 (file)
@@ -1503,6 +1503,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
@@ -1510,6 +1511,13 @@ static int amdgpu_pmops_prepare(struct device *dev)
        if (amdgpu_device_supports_boco(drm_dev))
                return pm_runtime_suspended(dev);
 
+       /* 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;
 }