amdgpu_gart_map_vram_range() expects the number of pages (num_pages) in 4K page units. However, in amdgpu_ttm_map_buffer(), the number of pages is calculated based on the system page size. On systems with non-4K page sizes, this results in an incorrect number of pages being passed to amdgpu_gart_map_vram_range().
Fix this by calculating the number of pages correctly before passing it to amdgpu_gart_map_vram_range(). Signed-off-by: Donet Tom <[email protected]> --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 3d2e00efc741..2904a9400605 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -269,6 +269,7 @@ static int amdgpu_ttm_map_buffer(struct amdgpu_ttm_buffer_entity *entity, amdgpu_gart_map(adev, 0, num_pages, dma_addr, flags, cpu_addr); } else { u64 pa = mm_cur->start + adev->vm_manager.vram_base_offset; + num_pages *= AMDGPU_GPU_PAGES_IN_CPU_PAGE; amdgpu_gart_map_vram_range(adev, pa, 0, num_pages, flags, cpu_addr); } -- 2.47.3
