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>
main
Sabre Shao 2015-07-09 13:53:24 +08:00 committed by Alex Deucher
parent 23fab59ba5
commit 12802da74f
2 changed files with 32 additions and 0 deletions

View File

@ -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_ */

View File

@ -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;