]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amdgpu: Fix allocating extra dwords for rings (v2)
authorTimur Kristóf <timur.kristof@gmail.com>
Tue, 9 Sep 2025 14:49:35 +0000 (16:49 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 15 Sep 2025 20:52:52 +0000 (16:52 -0400)
Rename extra_dw to extra_bytes and document what it's for.

The value is already used as if it were bytes in vcn_v4_0.c
and in amdgpu_ring_init. Just adjust the dword count in
jpeg_v1_0.c so that it becomes a byte count.

v2:
Rename extra_dw to extra_bytes as discussed during review.

Fixes: c8c1a1d2ef04 ("drm/amdgpu: define and add extra dword for jpeg ring")
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Christian König <christian.koenig@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
drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c

index 486c3646710cc4f9b7949080b335a91aa0195720..8f6ce948c6841d751ad82712dfe0976ed2ef1713 100644 (file)
@@ -364,7 +364,8 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
 
        /* Allocate ring buffer */
        if (ring->ring_obj == NULL) {
-               r = amdgpu_bo_create_kernel(adev, ring->ring_size + ring->funcs->extra_dw, PAGE_SIZE,
+               r = amdgpu_bo_create_kernel(adev, ring->ring_size + ring->funcs->extra_bytes,
+                                           PAGE_SIZE,
                                            AMDGPU_GEM_DOMAIN_GTT,
                                            &ring->ring_obj,
                                            &ring->gpu_addr,
index 80b85547c810be86ee4442cb68c31d5252d69b3c..4116dfb034999ec7cde151628fa90eee963af7c4 100644 (file)
@@ -211,7 +211,18 @@ struct amdgpu_ring_funcs {
        bool                    support_64bit_ptrs;
        bool                    no_user_fence;
        bool                    secure_submission_supported;
-       unsigned                extra_dw;
+
+       /**
+        * @extra_bytes:
+        *
+        * Optional extra space in bytes that is added to the ring size
+        * when allocating the BO that holds the contents of the ring.
+        * This space isn't used for command submission to the ring,
+        * but is just there to satisfy some hardware requirements or
+        * implement workarounds. It's up to the implementation of each
+        * specific ring to initialize this space.
+        */
+       unsigned                extra_bytes;
 
        /* ring read/write ptr handling */
        u64 (*get_rptr)(struct amdgpu_ring *ring);
index 9e428e669ada6faf85e25243a5d7aeed884f233d..b5bb7f4d607c145ba8d33a86f6f1219187111dc1 100644 (file)
@@ -557,7 +557,7 @@ static const struct amdgpu_ring_funcs jpeg_v1_0_decode_ring_vm_funcs = {
        .nop = PACKET0(0x81ff, 0),
        .support_64bit_ptrs = false,
        .no_user_fence = true,
-       .extra_dw = 64,
+       .extra_bytes = 256,
        .get_rptr = jpeg_v1_0_decode_ring_get_rptr,
        .get_wptr = jpeg_v1_0_decode_ring_get_wptr,
        .set_wptr = jpeg_v1_0_decode_ring_set_wptr,
index 8d3f18b55fc26b8d20b22445e989dc3ef647cb76..3ae666522d570fe78e44017ec9273be44d7faeb9 100644 (file)
@@ -1977,7 +1977,7 @@ static struct amdgpu_ring_funcs vcn_v4_0_unified_ring_vm_funcs = {
        .type = AMDGPU_RING_TYPE_VCN_ENC,
        .align_mask = 0x3f,
        .nop = VCN_ENC_CMD_NO_OP,
-       .extra_dw = sizeof(struct amdgpu_vcn_rb_metadata),
+       .extra_bytes = sizeof(struct amdgpu_vcn_rb_metadata),
        .get_rptr = vcn_v4_0_unified_ring_get_rptr,
        .get_wptr = vcn_v4_0_unified_ring_get_wptr,
        .set_wptr = vcn_v4_0_unified_ring_set_wptr,