History

Merge tag 'drm-amdkfd-next-2018-03-27' of git://people.freedesktop.org/~gabbayo/linux into drm-next

- GPUVM support for dGPUs - KFD events support for dGPUs - Fix live-lock situation when restoring multiple evicted processes - Fix VM page table allocation on large-bar systems - Fix for build failure on frv architecture * tag 'drm-amdkfd-next-2018-03-27' of git://people.freedesktop.org/~gabbayo/linux: drm/amdkfd: Use ordered workqueue to restore processes drm/amdgpu: Fix acquiring VM on large-BAR systems drm/amdkfd: Add module option for testing large-BAR functionality drm/amdkfd: Kmap event page for dGPUs drm/amdkfd: Add ioctls for GPUVM memory management drm/amdkfd: Add TC flush on VMID deallocation for Hawaii drm/amdkfd: Allocate CWSR trap handler memory for dGPUs drm/amdkfd: Add per-process IDR for buffer handles drm/amdkfd: Aperture setup for dGPUs drm/amdkfd: Remove limit on number of GPUs drm/amdkfd: Populate DRM render device minor drm/amdkfd: Create KFD VMs on demand drm/amdgpu: Add kfd2kgd interface to acquire an existing VM drm/amdgpu: Add helper to turn an existing VM into a compute VM drm/amdgpu: Fix initial validation of PD BO for KFD VMs drm/amdgpu: Move KFD-specific fields into struct amdgpu_vm drm/amdkfd: fix uninitialized variable use drm/amdkfd: add missing include of mm.h

Dave Airlie committed 8 years ago

Commit 9f36f9c2 parents cb17aa5 1679ae819 files · +1398 −165Browse files

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

Unified · Split

include/uapi/linux/kfd_ioctl.h+119−3
@@ -107,8 +107,6 @@ struct kfd_ioctl_get_clock_counters_args { · 106 unmodified lines
107 __u32 pad;107 __u32 pad;
108};108};
109 109
110#define NUM_OF_SUPPORTED_GPUS 7
111
112struct kfd_process_device_apertures {110struct kfd_process_device_apertures {
113 __u64 lds_base; /* from KFD */111 __u64 lds_base; /* from KFD */
114 __u64 lds_limit; /* from KFD */112 __u64 lds_limit; /* from KFD */
@@ -120,6 +118,12 @@ struct kfd_process_device_apertures { · 5 unmodified lines
120 __u32 pad;118 __u32 pad;
121};119};
122 120
121/*
122 * AMDKFD_IOC_GET_PROCESS_APERTURES is deprecated. Use
123 * AMDKFD_IOC_GET_PROCESS_APERTURES_NEW instead, which supports an
124 * unlimited number of GPUs.
125 */
126#define NUM_OF_SUPPORTED_GPUS 7
123struct kfd_ioctl_get_process_apertures_args {127struct kfd_ioctl_get_process_apertures_args {
124 struct kfd_process_device_apertures128 struct kfd_process_device_apertures
125 process_apertures[NUM_OF_SUPPORTED_GPUS];/* from KFD */129 process_apertures[NUM_OF_SUPPORTED_GPUS];/* from KFD */
@@ -129,6 +133,19 @@ struct kfd_ioctl_get_process_apertures_args { · 3 unmodified lines
129 __u32 pad;133 __u32 pad;
130};134};
131 135
136struct kfd_ioctl_get_process_apertures_new_args {
137 /* User allocated. Pointer to struct kfd_process_device_apertures
138 * filled in by Kernel
139 */
140 __u64 kfd_process_device_apertures_ptr;
141 /* to KFD - indicates amount of memory present in
142 * kfd_process_device_apertures_ptr
143 * from KFD - Number of entries filled by KFD.
144 */
145 __u32 num_of_nodes;
146 __u32 pad;
147};
148
132#define MAX_ALLOWED_NUM_POINTS 100149#define MAX_ALLOWED_NUM_POINTS 100
133#define MAX_ALLOWED_AW_BUFF_SIZE 4096150#define MAX_ALLOWED_AW_BUFF_SIZE 4096
134#define MAX_ALLOWED_WAC_BUFF_SIZE 128151#define MAX_ALLOWED_WAC_BUFF_SIZE 128
@@ -269,6 +286,86 @@ struct kfd_ioctl_set_trap_handler_args { · 134 unmodified lines
269 __u32 pad;286 __u32 pad;
270};287};
271 288
289struct kfd_ioctl_acquire_vm_args {
290 __u32 drm_fd; /* to KFD */
291 __u32 gpu_id; /* to KFD */
292};
293
294/* Allocation flags: memory types */
295#define KFD_IOC_ALLOC_MEM_FLAGS_VRAM (1 << 0)
296#define KFD_IOC_ALLOC_MEM_FLAGS_GTT (1 << 1)
297#define KFD_IOC_ALLOC_MEM_FLAGS_USERPTR (1 << 2)
298#define KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL (1 << 3)
299/* Allocation flags: attributes/access options */
300#define KFD_IOC_ALLOC_MEM_FLAGS_WRITABLE (1 << 31)
301#define KFD_IOC_ALLOC_MEM_FLAGS_EXECUTABLE (1 << 30)
302#define KFD_IOC_ALLOC_MEM_FLAGS_PUBLIC (1 << 29)
303#define KFD_IOC_ALLOC_MEM_FLAGS_NO_SUBSTITUTE (1 << 28)
304#define KFD_IOC_ALLOC_MEM_FLAGS_AQL_QUEUE_MEM (1 << 27)
305#define KFD_IOC_ALLOC_MEM_FLAGS_COHERENT (1 << 26)
306
307/* Allocate memory for later SVM (shared virtual memory) mapping.
308 *
309 * @va_addr: virtual address of the memory to be allocated
310 * all later mappings on all GPUs will use this address
311 * @size: size in bytes
312 * @handle: buffer handle returned to user mode, used to refer to
313 * this allocation for mapping, unmapping and freeing
314 * @mmap_offset: for CPU-mapping the allocation by mmapping a render node
315 * for userptrs this is overloaded to specify the CPU address
316 * @gpu_id: device identifier
317 * @flags: memory type and attributes. See KFD_IOC_ALLOC_MEM_FLAGS above
318 */
319struct kfd_ioctl_alloc_memory_of_gpu_args {
320 __u64 va_addr; /* to KFD */
321 __u64 size; /* to KFD */
322 __u64 handle; /* from KFD */
323 __u64 mmap_offset; /* to KFD (userptr), from KFD (mmap offset) */
324 __u32 gpu_id; /* to KFD */
325 __u32 flags;
326};
327
328/* Free memory allocated with kfd_ioctl_alloc_memory_of_gpu
329 *
330 * @handle: memory handle returned by alloc
331 */
332struct kfd_ioctl_free_memory_of_gpu_args {
333 __u64 handle; /* to KFD */
334};
335
336/* Map memory to one or more GPUs
337 *
338 * @handle: memory handle returned by alloc
339 * @device_ids_array_ptr: array of gpu_ids (__u32 per device)
340 * @n_devices: number of devices in the array
341 * @n_success: number of devices mapped successfully
342 *
343 * @n_success returns information to the caller how many devices from
344 * the start of the array have mapped the buffer successfully. It can
345 * be passed into a subsequent retry call to skip those devices. For
346 * the first call the caller should initialize it to 0.
347 *
348 * If the ioctl completes with return code 0 (success), n_success ==
349 * n_devices.
350 */
351struct kfd_ioctl_map_memory_to_gpu_args {
352 __u64 handle; /* to KFD */
353 __u64 device_ids_array_ptr; /* to KFD */
354 __u32 n_devices; /* to KFD */
355 __u32 n_success; /* to/from KFD */
356};
357
358/* Unmap memory from one or more GPUs
359 *
360 * same arguments as for mapping
361 */
362struct kfd_ioctl_unmap_memory_from_gpu_args {
363 __u64 handle; /* to KFD */
364 __u64 device_ids_array_ptr; /* to KFD */
365 __u32 n_devices; /* to KFD */
366 __u32 n_success; /* to/from KFD */
367};
368
272#define AMDKFD_IOCTL_BASE 'K'369#define AMDKFD_IOCTL_BASE 'K'
273#define AMDKFD_IO(nr) _IO(AMDKFD_IOCTL_BASE, nr)370#define AMDKFD_IO(nr) _IO(AMDKFD_IOCTL_BASE, nr)
274#define AMDKFD_IOR(nr, type) _IOR(AMDKFD_IOCTL_BASE, nr, type)371#define AMDKFD_IOR(nr, type) _IOR(AMDKFD_IOCTL_BASE, nr, type)
@@ -332,7 +429,26 @@ struct kfd_ioctl_set_trap_handler_args { · 57 unmodified lines
332#define AMDKFD_IOC_SET_TRAP_HANDLER \429#define AMDKFD_IOC_SET_TRAP_HANDLER \
333 AMDKFD_IOW(0x13, struct kfd_ioctl_set_trap_handler_args)430 AMDKFD_IOW(0x13, struct kfd_ioctl_set_trap_handler_args)
334 431
432#define AMDKFD_IOC_GET_PROCESS_APERTURES_NEW \
433 AMDKFD_IOWR(0x14, \
434 struct kfd_ioctl_get_process_apertures_new_args)
435
436#define AMDKFD_IOC_ACQUIRE_VM \
437 AMDKFD_IOW(0x15, struct kfd_ioctl_acquire_vm_args)
438
439#define AMDKFD_IOC_ALLOC_MEMORY_OF_GPU \
440 AMDKFD_IOWR(0x16, struct kfd_ioctl_alloc_memory_of_gpu_args)
441
442#define AMDKFD_IOC_FREE_MEMORY_OF_GPU \
443 AMDKFD_IOW(0x17, struct kfd_ioctl_free_memory_of_gpu_args)
444
445#define AMDKFD_IOC_MAP_MEMORY_TO_GPU \
446 AMDKFD_IOWR(0x18, struct kfd_ioctl_map_memory_to_gpu_args)
447
448#define AMDKFD_IOC_UNMAP_MEMORY_FROM_GPU \
449 AMDKFD_IOWR(0x19, struct kfd_ioctl_unmap_memory_from_gpu_args)
450
335#define AMDKFD_COMMAND_START 0x01451#define AMDKFD_COMMAND_START 0x01
336#define AMDKFD_COMMAND_END 0x14452#define AMDKFD_COMMAND_END 0x1A
337 453
338#endif454#endif