Skip to content

Commit 43a0ca3

Browse files
Timur Kristófalexdeucher
authored andcommitted
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>
1 parent 15bd495 commit 43a0ca3

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo,
188188
struct amdgpu_job *job;
189189
void *cpu_addr;
190190
uint64_t flags;
191-
unsigned int i;
192191
int r;
193192

194193
BUG_ON(adev->mman.buffer_funcs->copy_max_bytes <
@@ -255,16 +254,9 @@ static int amdgpu_ttm_map_buffer(struct ttm_buffer_object *bo,
255254
dma_addr = &bo->ttm->dma_address[mm_cur->start >> PAGE_SHIFT];
256255
amdgpu_gart_map(adev, 0, num_pages, dma_addr, flags, cpu_addr);
257256
} else {
258-
dma_addr_t dma_address;
259-
260-
dma_address = mm_cur->start;
261-
dma_address += adev->vm_manager.vram_base_offset;
257+
u64 pa = mm_cur->start + adev->vm_manager.vram_base_offset;
262258

263-
for (i = 0; i < num_pages; ++i) {
264-
amdgpu_gart_map(adev, i << PAGE_SHIFT, 1, &dma_address,
265-
flags, cpu_addr);
266-
dma_address += PAGE_SIZE;
267-
}
259+
amdgpu_gart_map_vram_range(adev, pa, 0, num_pages, flags, cpu_addr);
268260
}
269261

270262
dma_fence_put(amdgpu_job_submit(job));

0 commit comments

Comments
 (0)