Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: Fix allocating extra dwords for rings (v2)

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>

authored by

Timur Kristóf and committed by
Alex Deucher
ae5c2bee 156db7d3

+16 -4
+2 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
··· 364 364 365 365 /* Allocate ring buffer */ 366 366 if (ring->ring_obj == NULL) { 367 - r = amdgpu_bo_create_kernel(adev, ring->ring_size + ring->funcs->extra_dw, PAGE_SIZE, 367 + r = amdgpu_bo_create_kernel(adev, ring->ring_size + ring->funcs->extra_bytes, 368 + PAGE_SIZE, 368 369 AMDGPU_GEM_DOMAIN_GTT, 369 370 &ring->ring_obj, 370 371 &ring->gpu_addr,
+12 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
··· 211 211 bool support_64bit_ptrs; 212 212 bool no_user_fence; 213 213 bool secure_submission_supported; 214 - unsigned extra_dw; 214 + 215 + /** 216 + * @extra_bytes: 217 + * 218 + * Optional extra space in bytes that is added to the ring size 219 + * when allocating the BO that holds the contents of the ring. 220 + * This space isn't used for command submission to the ring, 221 + * but is just there to satisfy some hardware requirements or 222 + * implement workarounds. It's up to the implementation of each 223 + * specific ring to initialize this space. 224 + */ 225 + unsigned extra_bytes; 215 226 216 227 /* ring read/write ptr handling */ 217 228 u64 (*get_rptr)(struct amdgpu_ring *ring);
+1 -1
drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c
··· 557 557 .nop = PACKET0(0x81ff, 0), 558 558 .support_64bit_ptrs = false, 559 559 .no_user_fence = true, 560 - .extra_dw = 64, 560 + .extra_bytes = 256, 561 561 .get_rptr = jpeg_v1_0_decode_ring_get_rptr, 562 562 .get_wptr = jpeg_v1_0_decode_ring_get_wptr, 563 563 .set_wptr = jpeg_v1_0_decode_ring_set_wptr,
+1 -1
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c
··· 1977 1977 .type = AMDGPU_RING_TYPE_VCN_ENC, 1978 1978 .align_mask = 0x3f, 1979 1979 .nop = VCN_ENC_CMD_NO_OP, 1980 - .extra_dw = sizeof(struct amdgpu_vcn_rb_metadata), 1980 + .extra_bytes = sizeof(struct amdgpu_vcn_rb_metadata), 1981 1981 .get_rptr = vcn_v4_0_unified_ring_get_rptr, 1982 1982 .get_wptr = vcn_v4_0_unified_ring_get_wptr, 1983 1983 .set_wptr = vcn_v4_0_unified_ring_set_wptr,