Re: [PATCH 1/2] drm/amdgpu: move size calculations to the front of the file again

2018-09-02 Thread Zhang, Jerry (Junwei)

On 08/31/2018 09:27 PM, Christian König wrote:

amdgpu_vm_bo_* functions should come much later.

Signed-off-by: Christian König 

Reviewed-by: Junwei Zhang 


---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 90 +-
  1 file changed, 45 insertions(+), 45 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index d59222fb5931..a9275a99d793 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -133,51 +133,6 @@ struct amdgpu_prt_cb {
struct dma_fence_cb cb;
  };

-/**
- * amdgpu_vm_bo_base_init - Adds bo to the list of bos associated with the vm
- *
- * @base: base structure for tracking BO usage in a VM
- * @vm: vm to which bo is to be added
- * @bo: amdgpu buffer object
- *
- * Initialize a bo_va_base structure and add it to the appropriate lists
- *
- */
-static void amdgpu_vm_bo_base_init(struct amdgpu_vm_bo_base *base,
-  struct amdgpu_vm *vm,
-  struct amdgpu_bo *bo)
-{
-   base->vm = vm;
-   base->bo = bo;
-   INIT_LIST_HEAD(>bo_list);
-   INIT_LIST_HEAD(>vm_status);
-
-   if (!bo)
-   return;
-   list_add_tail(>bo_list, >va);
-
-   if (bo->tbo.resv != vm->root.base.bo->tbo.resv)
-   return;
-
-   vm->bulk_moveable = false;
-   if (bo->tbo.type == ttm_bo_type_kernel)
-   list_move(>vm_status, >relocated);
-   else
-   list_move(>vm_status, >idle);
-
-   if (bo->preferred_domains &
-   amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type))
-   return;
-
-   /*
-* we checked all the prerequisites, but it looks like this per vm bo
-* is currently evicted. add the bo to the evicted list to make sure it
-* is validated on next vm use to avoid fault.
-* */
-   list_move_tail(>vm_status, >evicted);
-   base->moved = true;
-}
-
  /**
   * amdgpu_vm_level_shift - return the addr shift for each level
   *
@@ -249,6 +204,51 @@ static unsigned amdgpu_vm_bo_size(struct amdgpu_device 
*adev, unsigned level)
return AMDGPU_GPU_PAGE_ALIGN(amdgpu_vm_num_entries(adev, level) * 8);
  }

+/**
+ * amdgpu_vm_bo_base_init - Adds bo to the list of bos associated with the vm
+ *
+ * @base: base structure for tracking BO usage in a VM
+ * @vm: vm to which bo is to be added
+ * @bo: amdgpu buffer object
+ *
+ * Initialize a bo_va_base structure and add it to the appropriate lists
+ *
+ */
+static void amdgpu_vm_bo_base_init(struct amdgpu_vm_bo_base *base,
+  struct amdgpu_vm *vm,
+  struct amdgpu_bo *bo)
+{
+   base->vm = vm;
+   base->bo = bo;
+   INIT_LIST_HEAD(>bo_list);
+   INIT_LIST_HEAD(>vm_status);
+
+   if (!bo)
+   return;
+   list_add_tail(>bo_list, >va);
+
+   if (bo->tbo.resv != vm->root.base.bo->tbo.resv)
+   return;
+
+   vm->bulk_moveable = false;
+   if (bo->tbo.type == ttm_bo_type_kernel)
+   list_move(>vm_status, >relocated);
+   else
+   list_move(>vm_status, >idle);
+
+   if (bo->preferred_domains &
+   amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type))
+   return;
+
+   /*
+* we checked all the prerequisites, but it looks like this per vm bo
+* is currently evicted. add the bo to the evicted list to make sure it
+* is validated on next vm use to avoid fault.
+* */
+   list_move_tail(>vm_status, >evicted);
+   base->moved = true;
+}
+
  /**
   * amdgpu_vm_get_pd_bo - add the VM PD to a validation list
   *


___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[PATCH 1/2] drm/amdgpu: move size calculations to the front of the file again

2018-08-31 Thread Christian König
amdgpu_vm_bo_* functions should come much later.

Signed-off-by: Christian König 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 90 +-
 1 file changed, 45 insertions(+), 45 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index d59222fb5931..a9275a99d793 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -133,51 +133,6 @@ struct amdgpu_prt_cb {
struct dma_fence_cb cb;
 };
 
-/**
- * amdgpu_vm_bo_base_init - Adds bo to the list of bos associated with the vm
- *
- * @base: base structure for tracking BO usage in a VM
- * @vm: vm to which bo is to be added
- * @bo: amdgpu buffer object
- *
- * Initialize a bo_va_base structure and add it to the appropriate lists
- *
- */
-static void amdgpu_vm_bo_base_init(struct amdgpu_vm_bo_base *base,
-  struct amdgpu_vm *vm,
-  struct amdgpu_bo *bo)
-{
-   base->vm = vm;
-   base->bo = bo;
-   INIT_LIST_HEAD(>bo_list);
-   INIT_LIST_HEAD(>vm_status);
-
-   if (!bo)
-   return;
-   list_add_tail(>bo_list, >va);
-
-   if (bo->tbo.resv != vm->root.base.bo->tbo.resv)
-   return;
-
-   vm->bulk_moveable = false;
-   if (bo->tbo.type == ttm_bo_type_kernel)
-   list_move(>vm_status, >relocated);
-   else
-   list_move(>vm_status, >idle);
-
-   if (bo->preferred_domains &
-   amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type))
-   return;
-
-   /*
-* we checked all the prerequisites, but it looks like this per vm bo
-* is currently evicted. add the bo to the evicted list to make sure it
-* is validated on next vm use to avoid fault.
-* */
-   list_move_tail(>vm_status, >evicted);
-   base->moved = true;
-}
-
 /**
  * amdgpu_vm_level_shift - return the addr shift for each level
  *
@@ -249,6 +204,51 @@ static unsigned amdgpu_vm_bo_size(struct amdgpu_device 
*adev, unsigned level)
return AMDGPU_GPU_PAGE_ALIGN(amdgpu_vm_num_entries(adev, level) * 8);
 }
 
+/**
+ * amdgpu_vm_bo_base_init - Adds bo to the list of bos associated with the vm
+ *
+ * @base: base structure for tracking BO usage in a VM
+ * @vm: vm to which bo is to be added
+ * @bo: amdgpu buffer object
+ *
+ * Initialize a bo_va_base structure and add it to the appropriate lists
+ *
+ */
+static void amdgpu_vm_bo_base_init(struct amdgpu_vm_bo_base *base,
+  struct amdgpu_vm *vm,
+  struct amdgpu_bo *bo)
+{
+   base->vm = vm;
+   base->bo = bo;
+   INIT_LIST_HEAD(>bo_list);
+   INIT_LIST_HEAD(>vm_status);
+
+   if (!bo)
+   return;
+   list_add_tail(>bo_list, >va);
+
+   if (bo->tbo.resv != vm->root.base.bo->tbo.resv)
+   return;
+
+   vm->bulk_moveable = false;
+   if (bo->tbo.type == ttm_bo_type_kernel)
+   list_move(>vm_status, >relocated);
+   else
+   list_move(>vm_status, >idle);
+
+   if (bo->preferred_domains &
+   amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type))
+   return;
+
+   /*
+* we checked all the prerequisites, but it looks like this per vm bo
+* is currently evicted. add the bo to the evicted list to make sure it
+* is validated on next vm use to avoid fault.
+* */
+   list_move_tail(>vm_status, >evicted);
+   base->moved = true;
+}
+
 /**
  * amdgpu_vm_get_pd_bo - add the VM PD to a validation list
  *
-- 
2.14.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx