]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drm/amdgpu/gfx10: rework reset sequence
authorAlex Deucher <alexander.deucher@amd.com>
Mon, 1 Jul 2024 22:14:14 +0000 (18:14 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 2 Sep 2024 15:40:55 +0000 (11:40 -0400)
To match other GFX IPs.

Acked-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c

index ad113fb67a85bd19f626f561b92473e5dde9d1c3..05f8b1495714750b5b9c3d9a9d2e5b5c462f7cca 100644 (file)
@@ -6692,13 +6692,13 @@ static int gfx_v10_0_gfx_mqd_init(struct amdgpu_device *adev, void *m,
        return 0;
 }
 
-static int gfx_v10_0_gfx_init_queue(struct amdgpu_ring *ring)
+static int gfx_v10_0_kgq_init_queue(struct amdgpu_ring *ring, bool reset)
 {
        struct amdgpu_device *adev = ring->adev;
        struct v10_gfx_mqd *mqd = ring->mqd_ptr;
        int mqd_idx = ring - &adev->gfx.gfx_ring[0];
 
-       if (!amdgpu_in_reset(adev) && !adev->in_suspend) {
+       if (!reset && !amdgpu_in_reset(adev) && !adev->in_suspend) {
                memset((void *)mqd, 0, sizeof(*mqd));
                mutex_lock(&adev->srbm_mutex);
                nv_grbm_select(adev, ring->me, ring->pipe, ring->queue, 0);
@@ -6750,7 +6750,7 @@ static int gfx_v10_0_cp_async_gfx_ring_resume(struct amdgpu_device *adev)
 
                r = amdgpu_bo_kmap(ring->mqd_obj, (void **)&ring->mqd_ptr);
                if (!r) {
-                       r = gfx_v10_0_gfx_init_queue(ring);
+                       r = gfx_v10_0_kgq_init_queue(ring, false);
                        amdgpu_bo_kunmap(ring->mqd_obj);
                        ring->mqd_ptr = NULL;
                }
@@ -9460,10 +9460,22 @@ static int gfx_v10_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid)
        if (r)
                return r;
 
-       /* reset the ring */
-       ring->wptr = 0;
-       *ring->wptr_cpu_addr = 0;
-       amdgpu_ring_clear_ring(ring);
+       r = amdgpu_bo_reserve(ring->mqd_obj, false);
+       if (unlikely(r != 0)) {
+               DRM_ERROR("fail to resv mqd_obj\n");
+               return r;
+       }
+       r = amdgpu_bo_kmap(ring->mqd_obj, (void **)&ring->mqd_ptr);
+       if (!r) {
+               r = gfx_v10_0_kgq_init_queue(ring, true);
+               amdgpu_bo_kunmap(ring->mqd_obj);
+               ring->mqd_ptr = NULL;
+       }
+       amdgpu_bo_unreserve(ring->mqd_obj);
+       if (r) {
+               DRM_ERROR("fail to unresv mqd_obj\n");
+               return r;
+       }
 
        return amdgpu_ring_test_ring(ring);
 }