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

drm/amdgpu/ttm: Use GART helper to map VRAM pages (v2)

Use the GART helper function introduced in the previous commit
to map the VRAM pages of the transfer window to GART.
No functional changes, just code cleanup.

Split this into a separate commit to make it easier to bisect,
in case there are problems in the future.

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
43a0ca33 15bd4958

+2 -10
+2 -10
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
··· 188 188 struct amdgpu_job *job; 189 189 void *cpu_addr; 190 190 uint64_t flags; 191 - unsigned int i; 192 191 int r; 193 192 194 193 BUG_ON(adev->mman.buffer_funcs->copy_max_bytes < ··· 254 255 dma_addr = &bo->ttm->dma_address[mm_cur->start >> PAGE_SHIFT]; 255 256 amdgpu_gart_map(adev, 0, num_pages, dma_addr, flags, cpu_addr); 256 257 } else { 257 - dma_addr_t dma_address; 258 + u64 pa = mm_cur->start + adev->vm_manager.vram_base_offset; 258 259 259 - dma_address = mm_cur->start; 260 - dma_address += adev->vm_manager.vram_base_offset; 261 - 262 - for (i = 0; i < num_pages; ++i) { 263 - amdgpu_gart_map(adev, i << PAGE_SHIFT, 1, &dma_address, 264 - flags, cpu_addr); 265 - dma_address += PAGE_SIZE; 266 - } 260 + amdgpu_gart_map_vram_range(adev, pa, 0, num_pages, flags, cpu_addr); 267 261 } 268 262 269 263 dma_fence_put(amdgpu_job_submit(job));