drm/amd: Don't allow s0ix on APUs older than Raven
authorjsg <jsg@openbsd.org>
Fri, 16 Jun 2023 01:31:34 +0000 (01:31 +0000)
committerjsg <jsg@openbsd.org>
Fri, 16 Jun 2023 01:31:34 +0000 (01:31 +0000)
From Mario Limonciello
6c1fad655b40b0de6ddad30d9c57e61046df262c in linux-6.1.y/6.1.32
ca47518663973083c513cd6b2801dcda0bfaaa99 in mainline linux

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

index 31fc24d..cddd11b 100644 (file)
@@ -1096,6 +1096,9 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
            (pm_suspend_target_state != PM_SUSPEND_TO_IDLE))
                return false;
 
+       if (adev->asic_type < CHIP_RAVEN)
+               return false;
+
        /*
         * If ACPI_FADT_LOW_POWER_S0 is not set in the FADT, it is generally
         * risky to do any special firmware-related preparations for entering
index d54444f..ec52c81 100644 (file)
@@ -2409,8 +2409,10 @@ static int amdgpu_pmops_suspend(struct device *dev)
 
        if (amdgpu_acpi_is_s0ix_active(adev))
                adev->in_s0ix = true;
-       else
+       else if (amdgpu_acpi_is_s3_active(adev))
                adev->in_s3 = true;
+       if (!adev->in_s0ix && !adev->in_s3)
+               return 0;
        return amdgpu_device_suspend(drm_dev, true);
 }
 
@@ -2431,6 +2433,9 @@ static int amdgpu_pmops_resume(struct device *dev)
        struct amdgpu_device *adev = drm_to_adev(drm_dev);
        int r;
 
+       if (!adev->in_s0ix && !adev->in_s3)
+               return 0;
+
        /* Avoids registers access if device is physically gone */
        if (!pci_device_is_present(adev->pdev))
                adev->no_hw_access = true;