summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSabre Shao <Sabre.Shao@amd.com>2015-07-09 13:53:24 +0800
committerMarek Olšák <marek.olsak@amd.com>2015-07-22 13:52:02 +0200
commit7b10d479bce23ef5ba9fd8f3dfb8bf68c11e6a4f (patch)
tree2b96f21f57a6419993e004aea34a81186d493e6f
parent00efddf62b1bb694e055beca6af0185c19742579 (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;