Support Virtual Address reservations
Add support for reserving virtual address ranges. Virtual address
ranges are addresses without any memory backing. These address ranges
need to be mapped to memory handles later.
This is part of patch series for Virtual Memory API.
Change-Id: I5d066e7421d6896f933f524312afc230a13d594e
[ROCm/ROCR-Runtime commit: 1085311f1a]
This commit is contained in:
@@ -194,6 +194,8 @@ struct AmdExtTable {
|
||||
decltype(hsa_amd_queue_cu_get_mask)* hsa_amd_queue_cu_get_mask_fn;
|
||||
decltype(hsa_amd_portable_export_dmabuf)* hsa_amd_portable_export_dmabuf_fn;
|
||||
decltype(hsa_amd_portable_close_dmabuf)* hsa_amd_portable_close_dmabuf_fn;
|
||||
decltype(hsa_amd_vmem_address_reserve)* hsa_amd_vmem_address_reserve_fn;
|
||||
decltype(hsa_amd_vmem_address_free)* hsa_amd_vmem_address_free_fn;
|
||||
};
|
||||
|
||||
// Table to export HSA Core Runtime Apis
|
||||
|
||||
@@ -2702,6 +2702,48 @@ hsa_status_t hsa_amd_portable_export_dmabuf(const void* ptr, size_t size, int* d
|
||||
*/
|
||||
hsa_status_t hsa_amd_portable_close_dmabuf(int dmabuf);
|
||||
|
||||
/*
|
||||
* @brief Allocate a reserved address range
|
||||
*
|
||||
* Reserve a virtual address range. The size must be a multiple of the system page size.
|
||||
* If it is not possible to allocate the address specified by @p address, then @p va will be
|
||||
* a different address range.
|
||||
* Address range should be released by calling hsa_amd_vmem_address_free.
|
||||
*
|
||||
* @param[out] va virtual address allocated
|
||||
* @param[in] size of address range requested
|
||||
* @param[in] address requested
|
||||
* @param[in] flags currently unsupported
|
||||
*
|
||||
* @retval ::HSA_STATUS_SUCCESS Address range allocated successfully
|
||||
*
|
||||
* @retval ::HSA_STATUS_ERROR_NOT_INITIALIZED The HSA runtime has not been
|
||||
* initialized.
|
||||
*
|
||||
* @retval ::HSA_STATUS_ERROR_OUT_OF_RESOURCES Insufficient resources to allocate an address
|
||||
* range of this size.
|
||||
*/
|
||||
hsa_status_t hsa_amd_vmem_address_reserve(void** va, size_t size, uint64_t address,
|
||||
uint64_t flags);
|
||||
|
||||
/*
|
||||
* @brief Free a reserved address range
|
||||
*
|
||||
* Free a previously allocated address range. The size must match the size of a previously
|
||||
* allocated address range.
|
||||
*
|
||||
* @param[out] va virtual address to be freed
|
||||
* @param[in] size of address range
|
||||
*
|
||||
* @retval ::HSA_STATUS_SUCCESS Address range released successfully
|
||||
*
|
||||
* @retval ::HSA_STATUS_ERROR_INVALID_ALLOCATION Invalid va specified
|
||||
* @retval ::HSA_STATUS_ERROR_INVALID_ARGUMENT Invalid size specified
|
||||
* @retval ::HSA_STATUS_ERROR_RESOURCE_FREE Address range is still in use
|
||||
* @retval ::HSA_STATUS_ERROR Internal unexpected error
|
||||
*/
|
||||
hsa_status_t hsa_amd_vmem_address_free(void* va, size_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // end extern "C" block
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user