aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2017-12-01 07:28:46 -0500
committerAlex Deucher <alexander.deucher@amd.com>2017-12-12 14:45:54 -0500
commite3a1b32a12ef83e260a307e678d053d5f4570acd (patch)
treeb1a1d6d9a715ac30a68a75cceb768896aec731e8
parent2ffe31deb27579e2f2c9444e01f4d8abf385d145 (diff)
drm/amdgpu: avoid the modulo in amdgpu_vm_get_entry
We can do this with a simple mask as well. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Chunming Zhou <david1.zhou@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 1c3dd6e0ed33..bd6296a6dab1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1285,11 +1285,11 @@ void amdgpu_vm_get_entry(struct amdgpu_pte_update_params *p, uint64_t addr,
1285 *parent = NULL; 1285 *parent = NULL;
1286 *entry = &p->vm->root; 1286 *entry = &p->vm->root;
1287 while ((*entry)->entries) { 1287 while ((*entry)->entries) {
1288 unsigned idx = addr >> amdgpu_vm_level_shift(p->adev, level++); 1288 unsigned shift = amdgpu_vm_level_shift(p->adev, level++);
1289 1289
1290 idx %= amdgpu_bo_size((*entry)->base.bo) / 8;
1291 *parent = *entry; 1290 *parent = *entry;
1292 *entry = &(*entry)->entries[idx]; 1291 *entry = &(*entry)->entries[addr >> shift];
1292 addr &= (1ULL << shift) - 1;
1293 } 1293 }
1294 1294
1295 if (level != p->adev->vm_manager.num_level) 1295 if (level != p->adev->vm_manager.num_level)