libhsakmt: Implement dmabuf export for RDMA
Implement hsaKmtExportDMABufHandle, which can be used for a new
upstreamable RDMA solution. It exports a DMABuf handle for an arbitrary
virtual address along with the offset of the address within the
allocation. It also checks that the size of the intended export does
not exceed the allocation.
This uses the new AMDKFD_IOC_EXPORT_DMABUF, which requires KFD ioctl
API version 1.12.
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Change-Id: Ie5fdb1f73ab3c7fa36c315ce326b1fb89eacc8b6
[ROCm/ROCR-Runtime commit: 332f59eb2a]
This commit is contained in:
@@ -436,6 +436,26 @@ hsaKmtRegisterGraphicsHandleToNodes(
|
||||
HSAuint32* NodeArray //IN
|
||||
);
|
||||
|
||||
/**
|
||||
* Export a dmabuf handle and offset for a given memory address
|
||||
*
|
||||
* Validates that @MemoryAddress belongs to a valid allocation and that the
|
||||
* @MemorySizeInBytes doesn't exceed the end of that allocation. Returns a
|
||||
* dmabuf fd of the allocation and the offset of MemoryAddress within that
|
||||
* allocation. The memory will remain allocated even after the allocation is
|
||||
* freed by hsaKmtFreeMemory for as long as a dmabuf fd remains open or any
|
||||
* importer of that fd maintains an active reference to the memory.
|
||||
*/
|
||||
|
||||
HSAKMT_STATUS
|
||||
HSAKMTAPI
|
||||
hsaKmtExportDMABufHandle(
|
||||
void *MemoryAddress, //IN
|
||||
HSAuint64 MemorySizeInBytes, //IN
|
||||
int *DMABufFd, //OUT
|
||||
HSAuint64 *Offset //OUT
|
||||
);
|
||||
|
||||
/**
|
||||
Export a memory buffer for sharing with other processes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user