summaryrefslogtreecommitdiff
path: root/amdgpu
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-08-05 13:47:52 -0400
commit12802da74f0e480bbde5a11df689329910893e87 (patch)
treecfeb02aff684d0227e8b3a84cb6e8b054b9b1cf6 /amdgpu
parent23fab59ba56233cd7142d43eace9348b9f5d72c2 (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>
Diffstat (limited to 'amdgpu')
-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 fcd12b3e847c..a38e488eec7d 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 faffba206d0e..d6ec9b4f0156 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;