drm/amdgpu: enable/disable doorbell interrupt in baco entry/exit helper
authorLe Ma <le.ma@amd.com>
Tue, 26 Nov 2019 09:24:56 +0000 (17:24 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 5 Dec 2019 21:25:45 +0000 (16:25 -0500)
This operation is needed when baco entry/exit for ras recovery

Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

index dd46199287d8b8a6e235e617b57dab7b249e41f5..fc53faac41479a62fec2a153970bfdbfa0ee8ec4 100644 (file)
@@ -4306,10 +4306,14 @@ static void amdgpu_device_get_pcie_info(struct amdgpu_device *adev)
 int amdgpu_device_baco_enter(struct drm_device *dev)
 {
        struct amdgpu_device *adev = dev->dev_private;
+       struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
 
        if (!amdgpu_device_supports_baco(adev->ddev))
                return -ENOTSUPP;
 
+       if (ras && ras->supported)
+               adev->nbio.funcs->enable_doorbell_interrupt(adev, false);
+
        if (is_support_sw_smu(adev)) {
                struct smu_context *smu = &adev->smu;
                int ret;
@@ -4317,8 +4321,6 @@ int amdgpu_device_baco_enter(struct drm_device *dev)
                ret = smu_baco_enter(smu);
                if (ret)
                        return ret;
-
-               return 0;
        } else {
                void *pp_handle = adev->powerplay.pp_handle;
                const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
@@ -4329,14 +4331,15 @@ int amdgpu_device_baco_enter(struct drm_device *dev)
                /* enter BACO state */
                if (pp_funcs->set_asic_baco_state(pp_handle, 1))
                        return -EIO;
-
-               return 0;
        }
+
+       return 0;
 }
 
 int amdgpu_device_baco_exit(struct drm_device *dev)
 {
        struct amdgpu_device *adev = dev->dev_private;
+       struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
 
        if (!amdgpu_device_supports_baco(adev->ddev))
                return -ENOTSUPP;
@@ -4349,7 +4352,6 @@ int amdgpu_device_baco_exit(struct drm_device *dev)
                if (ret)
                        return ret;
 
-               return 0;
        } else {
                void *pp_handle = adev->powerplay.pp_handle;
                const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
@@ -4360,7 +4362,10 @@ int amdgpu_device_baco_exit(struct drm_device *dev)
                /* exit BACO state */
                if (pp_funcs->set_asic_baco_state(pp_handle, 0))
                        return -EIO;
-
-               return 0;
        }
+
+       if (ras && ras->supported)
+               adev->nbio.funcs->enable_doorbell_interrupt(adev, true);
+
+       return 0;
 }