[PATCH 03/13] drm/amdgpu: add lru backend for amdgpu driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Change-Id: I4ee2abf1ddf5c0fe59c5803da51e99bb57388d05
Signed-off-by: Chunming Zhou <david1.zhou at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c |  4 ++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c  | 25 +++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h  |  9 +++++++++
 3 files changed, 38 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index dfd22db13fb1..0bbb1dfdceff 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1279,6 +1279,10 @@ static struct ttm_bo_driver amdgpu_bo_driver = {
 	.invalidate_caches = &amdgpu_invalidate_caches,
 	.init_mem_type = &amdgpu_init_mem_type,
 	.eviction_valuable = amdgpu_ttm_bo_eviction_valuable,
+	.get_evictable_bo = &amdgpu_vm_get_evictable_bo,
+	.add_to_lru = &amdgpu_vm_add_to_lru,
+	.del_from_lru = &amdgpu_vm_del_from_lru,
+	.move_to_lru_tail = &amdgpu_vm_move_to_lru_tail,
 	.evict_flags = &amdgpu_evict_flags,
 	.move = &amdgpu_bo_move,
 	.verify_access = &amdgpu_verify_access,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 8e71d3984016..cc6093233ae7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -124,6 +124,31 @@ static void amdgpu_vm_bo_base_init(struct amdgpu_vm_bo_base *base,
 	spin_unlock(&vm->status_lock);
 }
 
+struct ttm_buffer_object *amdgpu_vm_get_evictable_bo(struct ttm_bo_device *bdev,
+						     uint32_t mem_type,
+						     const struct ttm_place *place,
+						     struct ttm_operation_ctx *ctx,
+						     bool *locked)
+{
+
+}
+
+void amdgpu_vm_add_to_lru(struct ttm_buffer_object *bo)
+{
+
+}
+
+void amdgpu_vm_del_from_lru(struct ttm_buffer_object *bo)
+{
+
+}
+
+void amdgpu_vm_move_to_lru_tail(struct ttm_buffer_object *bo)
+{
+
+}
+
+
 /**
  * amdgpu_vm_level_shift - return the addr shift for each level
  *
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
index 30f080364c97..0c965683faba 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
@@ -256,6 +256,15 @@ struct amdgpu_vm_manager {
 	spinlock_t				pasid_lock;
 };
 
+struct ttm_buffer_object *amdgpu_vm_get_evictable_bo(struct ttm_bo_device *bdev,
+						     uint32_t mem_type,
+						     const struct ttm_place *place,
+						     struct ttm_operation_ctx *ctx,
+						     bool *locked);
+void amdgpu_vm_add_to_lru(struct ttm_buffer_object *bo);
+void amdgpu_vm_del_from_lru(struct ttm_buffer_object *bo);
+void amdgpu_vm_move_to_lru_tail(struct ttm_buffer_object *bo);
+
 void amdgpu_vm_manager_init(struct amdgpu_device *adev);
 void amdgpu_vm_manager_fini(struct amdgpu_device *adev);
 int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
-- 
2.14.1



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux