Add API entrypoints for IPC functionality
Implement three new APIs for IPC buffer sharing: -hsaKmtShareMemory() -hsaKmtRegisterSharedHandle() -hsaKmtRegisterSharedHandleToNodes() Add new ioclts necessary for the above APIs. Change-Id: Ia2b4d0dc91ec64bff959395d11c0536467404792 Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
This commit is contained in:
@@ -406,6 +406,43 @@ hsaKmtRegisterGraphicsHandleToNodes(
|
||||
HSAuint32* NodeArray //IN
|
||||
);
|
||||
|
||||
/**
|
||||
Export a memory buffer for sharing with other processes
|
||||
|
||||
NOTE: for the current revision of the thunk spec, SizeInBytes
|
||||
must match whole allocation.
|
||||
*/
|
||||
HSAKMT_STATUS
|
||||
HSAKMTAPI
|
||||
hsaKmtShareMemory(
|
||||
void *MemoryAddress, // IN
|
||||
HSAuint64 SizeInBytes, // IN
|
||||
HsaSharedMemoryHandle *SharedMemoryHandle // OUT
|
||||
);
|
||||
|
||||
/**
|
||||
Register shared memory handle
|
||||
*/
|
||||
HSAKMT_STATUS
|
||||
HSAKMTAPI
|
||||
hsaKmtRegisterSharedHandle(
|
||||
const HsaSharedMemoryHandle *SharedMemoryHandle, // IN
|
||||
void **MemoryAddress, // OUT
|
||||
HSAuint64 *SizeInBytes // OUT
|
||||
);
|
||||
|
||||
/**
|
||||
Register shared memory handle to specific nodes only
|
||||
*/
|
||||
HSAKMT_STATUS
|
||||
HSAKMTAPI
|
||||
hsaKmtRegisterSharedHandleToNodes(
|
||||
const HsaSharedMemoryHandle *SharedMemoryHandle, // IN
|
||||
void **MemoryAddress, // OUT
|
||||
HSAuint64 *SizeInBytes, // OUT
|
||||
HSAuint64 NumberOfNodes, // OUT
|
||||
HSAuint32* NodeArray // OUT
|
||||
);
|
||||
|
||||
/**
|
||||
Unregisters with KFD a memory buffer
|
||||
|
||||
@@ -1004,6 +1004,8 @@ typedef struct _HsaPointerInfo {
|
||||
void *UserData; // User data associated with the memory
|
||||
} HsaPointerInfo;
|
||||
|
||||
typedef HSAuint32 HsaSharedMemoryHandle[8];
|
||||
|
||||
#pragma pack(pop, hsakmttypes_h)
|
||||
|
||||
|
||||
|
||||
@@ -356,6 +356,22 @@ struct kfd_ioctl_import_dmabuf_args {
|
||||
uint32_t dmabuf_fd; /* to KFD */
|
||||
};
|
||||
|
||||
struct kfd_ioctl_ipc_export_handle_args {
|
||||
uint64_t handle; /* to KFD */
|
||||
uint32_t share_handle[4]; /* from KFD */
|
||||
uint32_t gpu_id; /* to KFD */
|
||||
uint32_t pad;
|
||||
};
|
||||
|
||||
struct kfd_ioctl_ipc_import_handle_args {
|
||||
uint64_t handle; /* from KFD */
|
||||
uint64_t va_addr; /* to KFD */
|
||||
uint64_t mmap_offset; /* from KFD */
|
||||
uint32_t share_handle[4]; /* to KFD */
|
||||
uint32_t gpu_id; /* to KFD */
|
||||
uint32_t pad;
|
||||
};
|
||||
|
||||
struct kfd_ioctl_get_tile_config_args {
|
||||
/* to KFD: pointer to tile array */
|
||||
uint64_t tile_config_ptr;
|
||||
@@ -482,7 +498,13 @@ struct kfd_ioctl_get_tile_config_args {
|
||||
#define AMDKFD_IOC_GET_TILE_CONFIG \
|
||||
AMDKFD_IOWR(0x21, struct kfd_ioctl_get_tile_config_args)
|
||||
|
||||
#define AMDKFD_IOC_IPC_IMPORT_HANDLE \
|
||||
AMDKFD_IOWR(0x22, struct kfd_ioctl_ipc_import_handle_args)
|
||||
|
||||
#define AMDKFD_IOC_IPC_EXPORT_HANDLE \
|
||||
AMDKFD_IOWR(0x23, struct kfd_ioctl_ipc_export_handle_args)
|
||||
|
||||
#define AMDKFD_COMMAND_START 0x01
|
||||
#define AMDKFD_COMMAND_END 0x22
|
||||
#define AMDKFD_COMMAND_END 0x24
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user