amdgpu: make vamgr global

This is the first sub-patch of va interface task, the va task is
about adding more va management interfaces for UMD, by design, the
vamgr should be per-process rather than per-device.

Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
diff --git a/amdgpu/amdgpu_internal.h b/amdgpu/amdgpu_internal.h
index 77b1244..c1cd4da 100644
--- a/amdgpu/amdgpu_internal.h
+++ b/amdgpu/amdgpu_internal.h
@@ -49,6 +49,7 @@
 };
 
 struct amdgpu_bo_va_mgr {
+	atomic_t refcount;
 	/* the start virtual address */
 	uint64_t va_offset;
 	uint64_t va_max;
@@ -70,9 +71,9 @@
 	struct util_hash_table *bo_flink_names;
 	/** This protects all hash tables. */
 	pthread_mutex_t bo_table_mutex;
-	struct amdgpu_bo_va_mgr vamgr;
 	struct drm_amdgpu_info_device dev_info;
 	struct amdgpu_gpu_info info;
+	struct amdgpu_bo_va_mgr *vamgr;
 };
 
 struct amdgpu_bo {
@@ -142,13 +143,15 @@
 
 void amdgpu_bo_free_internal(amdgpu_bo_handle bo);
 
-void amdgpu_vamgr_init(struct amdgpu_device *dev);
+struct amdgpu_bo_va_mgr* amdgpu_vamgr_get_global(struct amdgpu_device *dev);
+
+void amdgpu_vamgr_reference(struct amdgpu_bo_va_mgr **dst, struct amdgpu_bo_va_mgr *src);
 
 uint64_t amdgpu_vamgr_find_va(struct amdgpu_bo_va_mgr *mgr,
-                               uint64_t size, uint64_t alignment);
+				uint64_t size, uint64_t alignment);
 
-void amdgpu_vamgr_free_va(struct amdgpu_bo_va_mgr *mgr, uint64_t va,
-                           uint64_t size);
+void amdgpu_vamgr_free_va(struct amdgpu_bo_va_mgr *mgr, uint64_t va, 
+				uint64_t size);
 
 int amdgpu_query_gpu_info_init(amdgpu_device_handle dev);