]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amdgpu/sdma6: implement ring reset callback for sdma6
authorJiadong Zhu <Jiadong.Zhu@amd.com>
Tue, 10 Sep 2024 03:27:02 +0000 (11:27 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 26 Sep 2024 21:06:16 +0000 (17:06 -0400)
Implement sdma queue reset callback using mes_reset_queue_mmio.

v2: check instance id before reset queue.

Signed-off-by: Jiadong Zhu <Jiadong.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c

index b2efc678b7e91b08d727b0882dbac2b0c6572c99..581fa550ef29f4e37dc197d552f94c92d0611cd8 100644 (file)
@@ -1491,6 +1491,31 @@ static int sdma_v6_0_ring_preempt_ib(struct amdgpu_ring *ring)
        return r;
 }
 
+static int sdma_v6_0_reset_queue(struct amdgpu_ring *ring, unsigned int vmid)
+{
+       struct amdgpu_device *adev = ring->adev;
+       int i, r;
+
+       if (amdgpu_sriov_vf(adev))
+               return -EINVAL;
+
+       for (i = 0; i < adev->sdma.num_instances; i++) {
+               if (ring == &adev->sdma.instance[i].ring)
+                       break;
+       }
+
+       if (i == adev->sdma.num_instances) {
+               DRM_ERROR("sdma instance not found\n");
+               return -EINVAL;
+       }
+
+       r = amdgpu_mes_reset_legacy_queue(adev, ring, vmid, true);
+       if (r)
+               return r;
+
+       return sdma_v6_0_gfx_resume_instance(adev, i, true);
+}
+
 static int sdma_v6_0_set_trap_irq_state(struct amdgpu_device *adev,
                                        struct amdgpu_irq_src *source,
                                        unsigned type,
@@ -1674,6 +1699,7 @@ static const struct amdgpu_ring_funcs sdma_v6_0_ring_funcs = {
        .emit_reg_write_reg_wait = sdma_v6_0_ring_emit_reg_write_reg_wait,
        .init_cond_exec = sdma_v6_0_ring_init_cond_exec,
        .preempt_ib = sdma_v6_0_ring_preempt_ib,
+       .reset = sdma_v6_0_reset_queue,
 };
 
 static void sdma_v6_0_set_ring_funcs(struct amdgpu_device *adev)