amdgpu: add amdgpu_bo_va_op for va map/unmap support v3

The following interfaces are changed accordingly:
- amdgpu_bo_alloc
- amdgpu_create_bo_from_user_mem

v2: update the interfaces
v3: remove virtual_mc_base_address from amdgpu_bo

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
index bc6751a..f14b7f4 100644
--- a/amdgpu/amdgpu.h
+++ b/amdgpu/amdgpu.h
@@ -156,19 +156,6 @@
 };
 
 /**
- * Structure describing memory allocation request
- *
- * \sa amdgpu_bo_alloc()
-*/
-struct amdgpu_bo_alloc_result {
-	/** Assigned virtual MC Base Address */
-	uint64_t virtual_mc_base_address;
-
-	/** Handle of allocated memory to be used by the given process only. */
-	amdgpu_bo_handle buf_handle;
-};
-
-/**
  * Special UMD specific information associated with buffer.
  *
  * It may be need to pass some buffer charactersitic as part
@@ -213,13 +200,6 @@
 	 */
 	uint64_t phys_alignment;
 
-	/**
-	 * Assigned virtual MC Base Address.
-	 * \note  This information will be returned only if this buffer was
-	 * allocated in the same process otherwise 0 will be returned.
-	*/
-	uint64_t virtual_mc_base_address;
-
 	/** Heap where to allocate memory. */
 	uint32_t preferred_heap;
 
@@ -242,9 +222,6 @@
 
 	 /** Buffer size */
 	uint64_t alloc_size;
-
-	 /** Assigned virtual MC Base Address */
-	uint64_t virtual_mc_base_address;
 };
 
 /**
@@ -558,8 +535,7 @@
  *				   See #amdgpu_device_initialize()
  * \param   alloc_buffer - \c [in] Pointer to the structure describing an
  *				   allocation request
- * \param   info	 - \c [out] Pointer to structure which return
- *				    information about allocated memory
+ * \param   buf_handle	- \c [out] Allocated buffer handle
  *
  * \return   0 on success\n
  *          <0 - Negative POSIX Error code
@@ -568,7 +544,7 @@
 */
 int amdgpu_bo_alloc(amdgpu_device_handle dev,
 		    struct amdgpu_bo_alloc_request *alloc_buffer,
-		    struct amdgpu_bo_alloc_result *info);
+		    amdgpu_bo_handle *buf_handle);
 
 /**
  * Associate opaque data with buffer to be queried by another UMD
@@ -652,7 +628,7 @@
  * want to map to GPU address space (make GPU accessible)
  * (This address must be correctly aligned).
  * \param size - [in] Size of allocation (must be correctly aligned)
- * \param amdgpu_bo_alloc_result - [out] Handle of allocation to be passed as
+ * \param buf_handle - [out] Buffer handle for the userptr memory
  * resource on submission and be used in other operations.
  *
  *
@@ -677,7 +653,7 @@
 */
 int amdgpu_create_bo_from_user_mem(amdgpu_device_handle dev,
 				    void *cpu, uint64_t size,
-				    struct amdgpu_bo_alloc_result *info);
+				    amdgpu_bo_handle *buf_handle);
 
 /**
  * Free previosuly allocated memory
@@ -1173,4 +1149,26 @@
 			  uint64_t *start,
 			  uint64_t *end);
 
+/**
+ *  VA mapping/unmapping for the buffer object
+ *
+ * \param  bo		- \c [in] BO handle
+ * \param  offset	- \c [in] Start offset to map
+ * \param  size		- \c [in] Size to map
+ * \param  addr		- \c [in] Start virtual address.
+ * \param  flags	- \c [in] Supported flags for mapping/unmapping
+ * \param  ops		- \c [in] AMDGPU_VA_OP_MAP or AMDGPU_VA_OP_UNMAP
+ *
+ * \return   0 on success\n
+ *          <0 - Negative POSIX Error code
+ *
+*/
+
+int amdgpu_bo_va_op(amdgpu_bo_handle bo,
+		    uint64_t offset,
+		    uint64_t size,
+		    uint64_t addr,
+		    uint64_t flags,
+		    uint32_t ops);
+
 #endif /* #ifdef _AMDGPU_H_ */