drm/amdgpu: Ensure HDA function is suspended before ASIC reset
authorjsg <jsg@openbsd.org>
Fri, 13 May 2022 03:32:08 +0000 (03:32 +0000)
committerjsg <jsg@openbsd.org>
Fri, 13 May 2022 03:32:08 +0000 (03:32 +0000)
From Kai-Heng Feng
94ca25aed1234eaab273da94f548bf6f52ea2f7a in linux 5.15.y/5.15.39
887f75cfd0da44c19dda93b2ff9e70ca8792cdc1 in mainline linux

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

index ecb90e0..feaa324 100644 (file)
@@ -2250,18 +2250,23 @@ static int amdgpu_pmops_suspend(struct device *dev)
 {
        struct drm_device *drm_dev = dev_get_drvdata(dev);
        struct amdgpu_device *adev = drm_to_adev(drm_dev);
-       int r;
 
        if (amdgpu_acpi_is_s0ix_active(adev))
                adev->in_s0ix = true;
        else
                adev->in_s3 = true;
-       r = amdgpu_device_suspend(drm_dev, true);
-       if (r)
-               return r;
+       return amdgpu_device_suspend(drm_dev, true);
+}
+
+static int amdgpu_pmops_suspend_noirq(struct device *dev)
+{
+       struct drm_device *drm_dev = dev_get_drvdata(dev);
+       struct amdgpu_device *adev = drm_to_adev(drm_dev);
+
        if (!adev->in_s0ix)
-               r = amdgpu_asic_reset(adev);
-       return r;
+               return amdgpu_asic_reset(adev);
+
+       return 0;
 }
 
 static int amdgpu_pmops_resume(struct device *dev)
@@ -2500,6 +2505,7 @@ static const struct dev_pm_ops amdgpu_pm_ops = {
        .prepare = amdgpu_pmops_prepare,
        .complete = amdgpu_pmops_complete,
        .suspend = amdgpu_pmops_suspend,
+       .suspend_noirq = amdgpu_pmops_suspend_noirq,
        .resume = amdgpu_pmops_resume,
        .freeze = amdgpu_pmops_freeze,
        .thaw = amdgpu_pmops_thaw,