[PATCH 08/19] drm/amdgpu: add shadow_entity for shadow page table updates
Chunming Zhou
David1.Zhou at amd.com
Fri Aug 5 09:38:35 UTC 2016
Change-Id: Id1bcb6701f1663e409b8ebe533ea9f8e7194227b
Signed-off-by: Chunming Zhou <David1.Zhou at amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 ++-
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 11 ++++++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 9cb6fda..90805b4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -921,7 +921,8 @@ struct amdgpu_vm {
/* client id */
u64 client_id;
-
+ /* Scheduler entity for shadow page table updates */
+ struct amd_sched_entity shadow_entity;
struct fence *shadow_sync_fence;
};
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index d6a2ddb..daf4098 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1577,11 +1577,17 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)
ring_instance = atomic_inc_return(&adev->vm_manager.vm_pte_next_ring);
ring_instance %= adev->vm_manager.vm_pte_num_rings;
ring = adev->vm_manager.vm_pte_rings[ring_instance];
+ rq = &ring->sched.sched_rq[AMD_SCHED_PRIORITY_NORMAL];
+ r = amd_sched_entity_init(&ring->sched, &vm->shadow_entity,
+ rq, amdgpu_sched_jobs);
+ if (r)
+ goto err;
+
rq = &ring->sched.sched_rq[AMD_SCHED_PRIORITY_KERNEL];
r = amd_sched_entity_init(&ring->sched, &vm->entity,
rq, amdgpu_sched_jobs);
if (r)
- goto err;
+ goto err1;
vm->page_directory_fence = NULL;
@@ -1613,6 +1619,8 @@ error_free_page_directory:
error_free_sched_entity:
amd_sched_entity_fini(&ring->sched, &vm->entity);
+err1:
+ amd_sched_entity_fini(&ring->sched, &vm->shadow_entity);
err:
drm_free_large(vm->page_tables);
@@ -1633,6 +1641,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
struct amdgpu_bo_va_mapping *mapping, *tmp;
int i;
+ amd_sched_entity_fini(vm->shadow_entity.sched, &vm->shadow_entity);
amd_sched_entity_fini(vm->entity.sched, &vm->entity);
if (!RB_EMPTY_ROOT(&vm->va)) {
--
1.9.1
More information about the amd-gfx
mailing list