]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: Introduce cached_rptr and is_guilty callback in amdgpu_ring
authorJesse.zhang@amd.com <Jesse.zhang@amd.com>
Thu, 13 Feb 2025 02:30:07 +0000 (10:30 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 25 Feb 2025 16:43:59 +0000 (11:43 -0500)
This patch introduces the following changes:
- Add `cached_rptr` to the `amdgpu_ring` structure to store the read pointer before a reset.
- Add `is_guilty` callback to the `amdgpu_ring_funcs` structure to check if a ring is guilty of causing a timeout.

Suggested-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jesse Zhang <jesse.zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h

index f53887e2f52873189357b3d0d8a13bb63fa7001c..81a7d4faac9c882fbe355f5fd3b10cfc823bef69 100644 (file)
@@ -349,6 +349,8 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
        ring->buf_mask = (ring->ring_size / 4) - 1;
        ring->ptr_mask = ring->funcs->support_64bit_ptrs ?
                0xffffffffffffffff : ring->buf_mask;
+       /*  Initialize cached_rptr to 0 */
+       ring->cached_rptr = 0;
 
        /* Allocate ring buffer */
        if (ring->is_mes_queue) {
index 7372e4aed6b0205209caa84c36d280de74fb311a..52f7a9a79e7bf902bb75a722ec12549fd65ede1f 100644 (file)
@@ -238,6 +238,7 @@ struct amdgpu_ring_funcs {
        void (*patch_de)(struct amdgpu_ring *ring, unsigned offset);
        int (*reset)(struct amdgpu_ring *ring, unsigned int vmid);
        void (*emit_cleaner_shader)(struct amdgpu_ring *ring);
+       bool (*is_guilty)(struct amdgpu_ring *ring);
 };
 
 struct amdgpu_ring {
@@ -307,6 +308,8 @@ struct amdgpu_ring {
 
        bool            is_sw_ring;
        unsigned int    entry_index;
+       /* store the cached rptr to restore after reset */
+       uint64_t cached_rptr;
 
 };