On 01.09.25 12:00, Timur Kristóf wrote:
> SDMA v3-v5 can copy almost 4 MiB in a single copy operation.
> Use the same value as PAL and Mesa for copy_max_bytes.
>
> For reference, see oss2DmaCmdBuffer.cpp in PAL:
> "Due to HW limitation, the maximum count may not be 2^n-1,
> can only be 2^n - 1 - start_addr[4:2]"
Is that public available? If yes better reference AMDVLK here.
Apart from that looks good to me.
Regards,
Christian.
>
> See also sid.h in Mesa:
> "There is apparently an undocumented HW limitation that
> prevents the HW from copying the last 255 bytes of (1 << 22) - 1"
>
> Fixes: dfe5c2b76b2a ("drm/amdgpu: Correct bytes limit for SDMA 3.0 copy and
> fill")
> Signed-off-by: Timur Kristóf <[email protected]>
> ---
> drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
> b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
> index 1c076bd1cf73..9302cf0b5e4b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
> @@ -1659,11 +1659,11 @@ static void sdma_v3_0_emit_fill_buffer(struct
> amdgpu_ib *ib,
> }
>
> static const struct amdgpu_buffer_funcs sdma_v3_0_buffer_funcs = {
> - .copy_max_bytes = 0x3fffe0, /* not 0x3fffff due to HW limitation */
> + .copy_max_bytes = 0x3fff00, /* not 0x3fffff due to HW limitation */
> .copy_num_dw = 7,
> .emit_copy_buffer = sdma_v3_0_emit_copy_buffer,
>
> - .fill_max_bytes = 0x3fffe0, /* not 0x3fffff due to HW limitation */
> + .fill_max_bytes = 0x3fff00, /* not 0x3fffff due to HW limitation */
> .fill_num_dw = 5,
> .emit_fill_buffer = sdma_v3_0_emit_fill_buffer,
> };