aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2016-10-13 09:09:08 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-03-29 23:55:23 -0400
commit49ac8a24caa9579656ea9058c8281d7f668b22dd (patch)
tree22be4105f68d9fe69a249cfc063189b147e89479 /drivers/gpu/drm
parenta24960f321dc5b59db3428733da5021af9bc7973 (diff)
drm/amdgpu: add the VM pointer to the amdgpu_pte_update_params as well
This way we save passing it through the different functions. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 250fa947df31..61701d589238 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -57,6 +57,8 @@
57struct amdgpu_pte_update_params { 57struct amdgpu_pte_update_params {
58 /* amdgpu device we do this update for */ 58 /* amdgpu device we do this update for */
59 struct amdgpu_device *adev; 59 struct amdgpu_device *adev;
60 /* optional amdgpu_vm we do this update for */
61 struct amdgpu_vm *vm;
60 /* address where to copy page table entries from */ 62 /* address where to copy page table entries from */
61 uint64_t src; 63 uint64_t src;
62 /* indirect buffer to fill with commands */ 64 /* indirect buffer to fill with commands */
@@ -804,7 +806,6 @@ error_free:
804 * Update the page tables in the range @start - @end. 806 * Update the page tables in the range @start - @end.
805 */ 807 */
806static void amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params, 808static void amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params,
807 struct amdgpu_vm *vm,
808 uint64_t start, uint64_t end, 809 uint64_t start, uint64_t end,
809 uint64_t dst, uint64_t flags) 810 uint64_t dst, uint64_t flags)
810{ 811{
@@ -820,7 +821,7 @@ static void amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params,
820 /* initialize the variables */ 821 /* initialize the variables */
821 addr = start; 822 addr = start;
822 pt_idx = addr >> amdgpu_vm_block_size; 823 pt_idx = addr >> amdgpu_vm_block_size;
823 pt = vm->page_tables[pt_idx].bo; 824 pt = params->vm->page_tables[pt_idx].bo;
824 if (params->shadow) { 825 if (params->shadow) {
825 if (!pt->shadow) 826 if (!pt->shadow)
826 return; 827 return;
@@ -843,7 +844,7 @@ static void amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params,
843 /* walk over the address space and update the page tables */ 844 /* walk over the address space and update the page tables */
844 while (addr < end) { 845 while (addr < end) {
845 pt_idx = addr >> amdgpu_vm_block_size; 846 pt_idx = addr >> amdgpu_vm_block_size;
846 pt = vm->page_tables[pt_idx].bo; 847 pt = params->vm->page_tables[pt_idx].bo;
847 if (params->shadow) { 848 if (params->shadow) {
848 if (!pt->shadow) 849 if (!pt->shadow)
849 return; 850 return;
@@ -894,7 +895,6 @@ static void amdgpu_vm_update_ptes(struct amdgpu_pte_update_params *params,
894 * @flags: hw mapping flags 895 * @flags: hw mapping flags
895 */ 896 */
896static void amdgpu_vm_frag_ptes(struct amdgpu_pte_update_params *params, 897static void amdgpu_vm_frag_ptes(struct amdgpu_pte_update_params *params,
897 struct amdgpu_vm *vm,
898 uint64_t start, uint64_t end, 898 uint64_t start, uint64_t end,
899 uint64_t dst, uint64_t flags) 899 uint64_t dst, uint64_t flags)
900{ 900{
@@ -928,25 +928,25 @@ static void amdgpu_vm_frag_ptes(struct amdgpu_pte_update_params *params,
928 if (params->src || !(flags & AMDGPU_PTE_VALID) || 928 if (params->src || !(flags & AMDGPU_PTE_VALID) ||
929 (frag_start >= frag_end)) { 929 (frag_start >= frag_end)) {
930 930
931 amdgpu_vm_update_ptes(params, vm, start, end, dst, flags); 931 amdgpu_vm_update_ptes(params, start, end, dst, flags);
932 return; 932 return;
933 } 933 }
934 934
935 /* handle the 4K area at the beginning */ 935 /* handle the 4K area at the beginning */
936 if (start != frag_start) { 936 if (start != frag_start) {
937 amdgpu_vm_update_ptes(params, vm, start, frag_start, 937 amdgpu_vm_update_ptes(params, start, frag_start,
938 dst, flags); 938 dst, flags);
939 dst += (frag_start - start) * AMDGPU_GPU_PAGE_SIZE; 939 dst += (frag_start - start) * AMDGPU_GPU_PAGE_SIZE;
940 } 940 }
941 941
942 /* handle the area in the middle */ 942 /* handle the area in the middle */
943 amdgpu_vm_update_ptes(params, vm, frag_start, frag_end, dst, 943 amdgpu_vm_update_ptes(params, frag_start, frag_end, dst,
944 flags | frag_flags); 944 flags | frag_flags);
945 945
946 /* handle the 4K area at the end */ 946 /* handle the 4K area at the end */
947 if (frag_end != end) { 947 if (frag_end != end) {
948 dst += (frag_end - frag_start) * AMDGPU_GPU_PAGE_SIZE; 948 dst += (frag_end - frag_start) * AMDGPU_GPU_PAGE_SIZE;
949 amdgpu_vm_update_ptes(params, vm, frag_end, end, dst, flags); 949 amdgpu_vm_update_ptes(params, frag_end, end, dst, flags);
950 } 950 }
951} 951}
952 952
@@ -986,6 +986,7 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
986 986
987 memset(&params, 0, sizeof(params)); 987 memset(&params, 0, sizeof(params));
988 params.adev = adev; 988 params.adev = adev;
989 params.vm = vm;
989 params.src = src; 990 params.src = src;
990 991
991 ring = container_of(vm->entity.sched, struct amdgpu_ring, sched); 992 ring = container_of(vm->entity.sched, struct amdgpu_ring, sched);
@@ -1067,9 +1068,9 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
1067 goto error_free; 1068 goto error_free;
1068 1069
1069 params.shadow = true; 1070 params.shadow = true;
1070 amdgpu_vm_frag_ptes(&params, vm, start, last + 1, addr, flags); 1071 amdgpu_vm_frag_ptes(&params, start, last + 1, addr, flags);
1071 params.shadow = false; 1072 params.shadow = false;
1072 amdgpu_vm_frag_ptes(&params, vm, start, last + 1, addr, flags); 1073 amdgpu_vm_frag_ptes(&params, start, last + 1, addr, flags);
1073 1074
1074 amdgpu_ring_pad_ib(ring, params.ib); 1075 amdgpu_ring_pad_ib(ring, params.ib);
1075 WARN_ON(params.ib->length_dw > ndw); 1076 WARN_ON(params.ib->length_dw > ndw);