History

drm/amdkfd: Add DMABuf import functionality

This is used for interoperability between ROCm compute and graphics APIs. It allows importing graphics driver BOs into the ROCm SVM address space for zero-copy GPU access. The API is split into two steps (query and import) to allow user mode to manage the virtual address space allocation for the imported buffer.

Felix Kuehling committed 7 years ago

Commit 1dde0ea1 parent 3704d569 files · +287 −5Browse files

Showing the changes to include/uapi/linux (1 of 9 files). Show all

Unified · Split

include/uapi/linux/kfd_ioctl.h+25−1
@@ -398,6 +398,24 @@ struct kfd_ioctl_unmap_memory_from_gpu_args { · 397 unmodified lines
398 __u32 n_success; /* to/from KFD */398 __u32 n_success; /* to/from KFD */
399};399};
400 400
401struct kfd_ioctl_get_dmabuf_info_args {
402 __u64 size; /* from KFD */
403 __u64 metadata_ptr; /* to KFD */
404 __u32 metadata_size; /* to KFD (space allocated by user)
405 * from KFD (actual metadata size)
406 */
407 __u32 gpu_id; /* from KFD */
408 __u32 flags; /* from KFD (KFD_IOC_ALLOC_MEM_FLAGS) */
409 __u32 dmabuf_fd; /* to KFD */
410};
411
412struct kfd_ioctl_import_dmabuf_args {
413 __u64 va_addr; /* to KFD */
414 __u64 handle; /* from KFD */
415 __u32 gpu_id; /* to KFD */
416 __u32 dmabuf_fd; /* to KFD */
417};
418
401#define AMDKFD_IOCTL_BASE 'K'419#define AMDKFD_IOCTL_BASE 'K'
402#define AMDKFD_IO(nr) _IO(AMDKFD_IOCTL_BASE, nr)420#define AMDKFD_IO(nr) _IO(AMDKFD_IOCTL_BASE, nr)
403#define AMDKFD_IOR(nr, type) _IOR(AMDKFD_IOCTL_BASE, nr, type)421#define AMDKFD_IOR(nr, type) _IOR(AMDKFD_IOCTL_BASE, nr, type)
@@ -486,7 +504,13 @@ struct kfd_ioctl_unmap_memory_from_gpu_args { · 82 unmodified lines
486#define AMDKFD_IOC_GET_QUEUE_WAVE_STATE \504#define AMDKFD_IOC_GET_QUEUE_WAVE_STATE \
487 AMDKFD_IOWR(0x1B, struct kfd_ioctl_get_queue_wave_state_args)505 AMDKFD_IOWR(0x1B, struct kfd_ioctl_get_queue_wave_state_args)
488 506
507#define AMDKFD_IOC_GET_DMABUF_INFO \
508 AMDKFD_IOWR(0x1C, struct kfd_ioctl_get_dmabuf_info_args)
509
510#define AMDKFD_IOC_IMPORT_DMABUF \
511 AMDKFD_IOWR(0x1D, struct kfd_ioctl_import_dmabuf_args)
512
489#define AMDKFD_COMMAND_START 0x01513#define AMDKFD_COMMAND_START 0x01
490#define AMDKFD_COMMAND_END 0x1C514#define AMDKFD_COMMAND_END 0x1E
491 515
492#endif516#endif