aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
diff options
context:
space:
mode:
authorAlex Xie <AlexBin.Xie@amd.com>2016-06-06 18:13:26 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-07-07 14:51:26 -0400
commit677131a16d84d522fb096ff489034471588661a5 (patch)
tree31616354c9234425ee689f28a6e8fa860b02b50b /drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
parentb314f9a997dd1d1e1fb607b68387c1e92e914e66 (diff)
drm/amdgpu: Change some variable names to make code easier understood
Add comment to describe some variables otherwise. Signed-off-by: Alex Xie <AlexBin.Xie@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index d19e9386d97b..00cb58905e94 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -748,7 +748,7 @@ static void amdgpu_vm_frag_ptes(struct amdgpu_device *adev,
748 * @vm: requested vm 748 * @vm: requested vm
749 * @start: start of GPU address range 749 * @start: start of GPU address range
750 * @end: end of GPU address range 750 * @end: end of GPU address range
751 * @dst: destination address to map to 751 * @dst: destination address to map to, the next dst inside the function
752 * @flags: mapping flags 752 * @flags: mapping flags
753 * 753 *
754 * Update the page tables in the range @start - @end. 754 * Update the page tables in the range @start - @end.
@@ -762,43 +762,43 @@ static void amdgpu_vm_update_ptes(struct amdgpu_device *adev,
762{ 762{
763 const uint64_t mask = AMDGPU_VM_PTE_COUNT - 1; 763 const uint64_t mask = AMDGPU_VM_PTE_COUNT - 1;
764 764
765 uint64_t last_pe_start = ~0, last_pe_end = ~0, last_dst = ~0; 765 uint64_t cur_pe_start = ~0, cur_pe_end = ~0, cur_dst = ~0;
766 uint64_t addr; 766 uint64_t addr; /* next GPU address to be updated */
767 767
768 /* walk over the address space and update the page tables */ 768 /* walk over the address space and update the page tables */
769 for (addr = start; addr < end; ) { 769 for (addr = start; addr < end; ) {
770 uint64_t pt_idx = addr >> amdgpu_vm_block_size; 770 uint64_t pt_idx = addr >> amdgpu_vm_block_size;
771 struct amdgpu_bo *pt = vm->page_tables[pt_idx].entry.robj; 771 struct amdgpu_bo *pt = vm->page_tables[pt_idx].entry.robj;
772 unsigned nptes; 772 unsigned nptes; /* next number of ptes to be updated */
773 uint64_t pe_start; 773 uint64_t next_pe_start;
774 774
775 if ((addr & ~mask) == (end & ~mask)) 775 if ((addr & ~mask) == (end & ~mask))
776 nptes = end - addr; 776 nptes = end - addr;
777 else 777 else
778 nptes = AMDGPU_VM_PTE_COUNT - (addr & mask); 778 nptes = AMDGPU_VM_PTE_COUNT - (addr & mask);
779 779
780 pe_start = amdgpu_bo_gpu_offset(pt); 780 next_pe_start = amdgpu_bo_gpu_offset(pt);
781 pe_start += (addr & mask) * 8; 781 next_pe_start += (addr & mask) * 8;
782 782
783 if (last_pe_end != pe_start) { 783 if (cur_pe_end != next_pe_start) {
784 784
785 amdgpu_vm_frag_ptes(adev, vm_update_params, 785 amdgpu_vm_frag_ptes(adev, vm_update_params,
786 last_pe_start, last_pe_end, 786 cur_pe_start, cur_pe_end,
787 last_dst, flags); 787 cur_dst, flags);
788 788
789 last_pe_start = pe_start; 789 cur_pe_start = next_pe_start;
790 last_pe_end = pe_start + 8 * nptes; 790 cur_pe_end = next_pe_start + 8 * nptes;
791 last_dst = dst; 791 cur_dst = dst;
792 } else { 792 } else {
793 last_pe_end += 8 * nptes; 793 cur_pe_end += 8 * nptes;
794 } 794 }
795 795
796 addr += nptes; 796 addr += nptes;
797 dst += nptes * AMDGPU_GPU_PAGE_SIZE; 797 dst += nptes * AMDGPU_GPU_PAGE_SIZE;
798 } 798 }
799 799
800 amdgpu_vm_frag_ptes(adev, vm_update_params, last_pe_start, 800 amdgpu_vm_frag_ptes(adev, vm_update_params, cur_pe_start,
801 last_pe_end, last_dst, flags); 801 cur_pe_end, cur_dst, flags);
802} 802}
803 803
804/** 804/**