summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSabre Shao <Sabre.Shao@amd.com>2015-07-09 13:53:24 +0800
committerAlex Deucher <alexander.deucher@amd.com>2015-07-30 00:11:12 -0400
commit21ce429842e6ce27ff968646a87968f15432d316 (patch)
treeb652c2998e24757dbeec93d6a67ee507e6f5b1fe
parent99d650e498919a15cdb17d45368a981a347ee2c2 (diff)
amdgpu: add va range query interface
amdgpu_va_range_query interface is added so that client can query va range supported by specific device. Signed-off-by: Sabre Shao <Sabre.Shao@amd.com> Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
-rw-r--r--amdgpu/amdgpu.h21
-rw-r--r--amdgpu/amdgpu_vamgr.c11
2 files changed, 32 insertions, 0 deletions
diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
index fcd12b3e..a38e488e 100644
--- a/amdgpu/amdgpu.h
+++ b/amdgpu/amdgpu.h
@@ -1155,4 +1155,25 @@ int amdgpu_va_range_alloc(amdgpu_device_handle dev,
*/
int amdgpu_va_range_free(amdgpu_va_handle va_range_handle);
+/**
+* Query virtual address range
+*
+* UMD can query GPU VM range supported by each device
+* to initialize its own VAM accordingly.
+*
+* \param dev - [in] Device handle. See #amdgpu_device_initialize()
+* \param type - \c [in] Type of virtual address range
+* \param offset - \c [out] Start offset of virtual address range
+* \param size - \c [out] Size of virtual address range
+*
+* \return 0 on success\n
+* <0 - Negative POSIX Error code
+*
+*/
+
+int amdgpu_va_range_query(amdgpu_device_handle dev,
+ enum amdgpu_gpu_va_range type,
+ uint64_t *start,
+ uint64_t *end);
+
#endif /* #ifdef _AMDGPU_H_ */
diff --git a/amdgpu/amdgpu_vamgr.c b/amdgpu/amdgpu_vamgr.c
index faffba20..d6ec9b4f 100644
--- a/amdgpu/amdgpu_vamgr.c
+++ b/amdgpu/amdgpu_vamgr.c
@@ -31,6 +31,17 @@
static struct amdgpu_bo_va_mgr vamgr = {{0}};
+int amdgpu_va_range_query(amdgpu_device_handle dev,
+ enum amdgpu_gpu_va_range type, uint64_t *start, uint64_t *end)
+{
+ if (type == amdgpu_gpu_va_range_general) {
+ *start = dev->dev_info.virtual_address_offset;
+ *end = dev->dev_info.virtual_address_max;
+ return 0;
+ }
+ return -EINVAL;
+}
+
static void amdgpu_vamgr_init(struct amdgpu_bo_va_mgr *mgr, struct amdgpu_device *dev)
{
mgr->va_offset = dev->dev_info.virtual_address_offset;