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.
Showing the changes to include/uapi/linux (1 of 9 files). Show all
Unified · Split
| @@ -398,6 +398,24 @@ struct kfd_ioctl_unmap_memory_from_gpu_args { · 397 unmodified lines | ||
| 398 | 398 | __u32 n_success; /* to/from KFD */ |
| 399 | 399 | }; |
| 400 | 400 | |
| 401 | +struct 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 | + | |
| 412 | +struct 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 | 419 | #define AMDKFD_IOCTL_BASE 'K' |
| 402 | 420 | #define AMDKFD_IO(nr) _IO(AMDKFD_IOCTL_BASE, nr) |
| 403 | 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 | 504 | #define AMDKFD_IOC_GET_QUEUE_WAVE_STATE \ |
| 487 | 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 | 513 | #define AMDKFD_COMMAND_START 0x01 |
| 490 | −#define AMDKFD_COMMAND_END 0x1C | |
| 514 | +#define AMDKFD_COMMAND_END 0x1E | |
| 491 | 515 | |
| 492 | 516 | #endif |