On 12/12/25 2:23 PM, Christian König wrote:
On 12/12/25 07:40, Donet Tom wrote:
The SDMA engine has a hardware limitation of 4 MB maximum transfer
size per operation.
That is not correct. This is only true on ancient HW.

What problems are you seeing here?

AMDGPU_GTT_MAX_TRANSFER_SIZE was hardcoded to
512 pages, which worked correctly on systems with 4K pages but fails
on systems with larger page sizes.

This patch divides the max transfer size / AMDGPU_GPU_PAGES_IN_CPU_PAGE
to match with non-4K page size systems.
That is actually a bad idea. The value was meant to match the PMD size.


Hi Christian

Thank you for the reply.

In svm_migrate_copy_memory_gart(), the number of bytes to copy passed to amdgpu_copy_buffer() is based on the PMD size. On systems with a 4K page size, the PMD size is calculated correctly because AMDGPU_GTT_MAX_TRANSFER_SIZE is 512, and 512 × 4K = 2MB.

On systems with a 64K page size, however, the calculation becomes 512 × 64K = 32MB. As a result, amdgpu_copy_buffer() ends up copying data in 4MB chunks instead of PMD-sized chunks. To ensure consistent behavior across both 64K and 4K page-size systems, we adjusted the transfer size so that the maximum transfer remains 2MB, matching the PMD size.

The issue we observed was that the rocr-debug-agent test triggered SDMA hangs. This happened because an incorrect size was being passed when copying the GART mapping in svm_migrate_gart_map(). That problem was addressed in patch 3/8. While root-causing that issue, we also identified this inconsistency between 4K and 64K systems, So we felt that this change was needed to align the behavior with 4K system page sizes.




Regards,
Christian.

Signed-off-by: Donet Tom <[email protected]>
Signed-off-by: Ritesh Harjani (IBM) <[email protected]>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
index 0be2728aa872..9d038feb25b0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
@@ -37,7 +37,7 @@
  #define AMDGPU_PL_MMIO_REMAP  (TTM_PL_PRIV + 5)
  #define __AMDGPU_PL_NUM       (TTM_PL_PRIV + 6)
-#define AMDGPU_GTT_MAX_TRANSFER_SIZE 512
+#define AMDGPU_GTT_MAX_TRANSFER_SIZE   (512 / AMDGPU_GPU_PAGES_IN_CPU_PAGE)
  #define AMDGPU_GTT_NUM_TRANSFER_WINDOWS       2
extern const struct attribute_group amdgpu_vram_mgr_attr_group;

Reply via email to