drm/amdgpu: fix for suspend/resume sequence under sriov
authorVictor Zhao <Victor.Zhao@amd.com>
Wed, 26 Oct 2022 03:48:50 +0000 (11:48 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 4 Nov 2022 20:05:53 +0000 (16:05 -0400)
- clear kiq ring after suspend/resume under sriov to aviod kiq ring
test failure
- update irq after resume to fix kiq interrput loss

Signed-off-by: Victor Zhao <Victor.Zhao@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c

index 522820eeaa596002904ada36fd14214160e53b6a..5b9f992e4607457fedc518b25f0fb3e97d32c902 100644 (file)
@@ -4197,6 +4197,8 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
        }
 
        /* Make sure IB tests flushed */
+       if (amdgpu_sriov_vf(adev))
+               amdgpu_irq_gpu_reset_resume_helper(adev);
        flush_delayed_work(&adev->delayed_init_work);
 
        if (adev->in_s0ix) {
index 7853d3ca58cf7bd50978e9725eef8650a4077a2a..49d34c7bbf20f0a435f4bdfe2f3d38c8a2737e5e 100644 (file)
@@ -6909,6 +6909,8 @@ static int gfx_v10_0_kiq_init_queue(struct amdgpu_ring *ring)
                mutex_unlock(&adev->srbm_mutex);
        } else {
                memset((void *)mqd, 0, sizeof(*mqd));
+               if (amdgpu_sriov_vf(adev) && adev->in_suspend)
+                       amdgpu_ring_clear_ring(ring);
                mutex_lock(&adev->srbm_mutex);
                nv_grbm_select(adev, ring->me, ring->pipe, ring->queue, 0);
                amdgpu_ring_init_mqd(ring);
index 96b9054c790c175a8b50bef7284fdf729aeddead..9447999a3a487030709aa1b1b9f0212d225e0642 100644 (file)
@@ -4004,6 +4004,8 @@ static int gfx_v11_0_kiq_init_queue(struct amdgpu_ring *ring)
                mutex_unlock(&adev->srbm_mutex);
        } else {
                memset((void *)mqd, 0, sizeof(*mqd));
+               if (amdgpu_sriov_vf(adev) && adev->in_suspend)
+                       amdgpu_ring_clear_ring(ring);
                mutex_lock(&adev->srbm_mutex);
                soc21_grbm_select(adev, ring->me, ring->pipe, ring->queue, 0);
                amdgpu_ring_init_mqd(ring);
index 7f0b18b0d4c486e4ae55e49965c0a37a50524808..d47135606e3ef7273bd6f9ab35b7e0fdf1d88d7b 100644 (file)
@@ -4643,6 +4643,8 @@ static int gfx_v8_0_kiq_init_queue(struct amdgpu_ring *ring)
                memset((void *)mqd, 0, sizeof(struct vi_mqd_allocation));
                ((struct vi_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF;
                ((struct vi_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF;
+               if (amdgpu_sriov_vf(adev) && adev->in_suspend)
+                       amdgpu_ring_clear_ring(ring);
                mutex_lock(&adev->srbm_mutex);
                vi_srbm_select(adev, ring->me, ring->pipe, ring->queue, 0);
                gfx_v8_0_mqd_init(ring);
index ab30c18decfbe8dd5098ee06e1455217f060f4b4..676832da75eb15a938a9a0f50210ef8a8daa1070 100644 (file)
@@ -3581,6 +3581,8 @@ static int gfx_v9_0_kiq_init_queue(struct amdgpu_ring *ring)
                memset((void *)mqd, 0, sizeof(struct v9_mqd_allocation));
                ((struct v9_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF;
                ((struct v9_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF;
+               if (amdgpu_sriov_vf(adev) && adev->in_suspend)
+                       amdgpu_ring_clear_ring(ring);
                mutex_lock(&adev->srbm_mutex);
                soc15_grbm_select(adev, ring->me, ring->pipe, ring->queue, 0);
                gfx_v9_0_mqd_init(ring);