Lines Matching refs:args

178 	struct kfd_ioctl_get_version_args *args = data;  in kfd_ioctl_get_version()  local
180 args->major_version = KFD_IOCTL_MAJOR_VERSION; in kfd_ioctl_get_version()
181 args->minor_version = KFD_IOCTL_MINOR_VERSION; in kfd_ioctl_get_version()
187 struct kfd_ioctl_create_queue_args *args) in set_queue_properties_from_user() argument
189 if (args->queue_percentage > KFD_MAX_QUEUE_PERCENTAGE) { in set_queue_properties_from_user()
194 if (args->queue_priority > KFD_MAX_QUEUE_PRIORITY) { in set_queue_properties_from_user()
199 if ((args->ring_base_address) && in set_queue_properties_from_user()
200 (!access_ok((const void __user *) args->ring_base_address, in set_queue_properties_from_user()
206 if (!is_power_of_2(args->ring_size) && (args->ring_size != 0)) { in set_queue_properties_from_user()
211 if (!access_ok((const void __user *) args->read_pointer_address, in set_queue_properties_from_user()
217 if (!access_ok((const void __user *) args->write_pointer_address, in set_queue_properties_from_user()
223 if (args->eop_buffer_address && in set_queue_properties_from_user()
224 !access_ok((const void __user *) args->eop_buffer_address, in set_queue_properties_from_user()
230 if (args->ctx_save_restore_address && in set_queue_properties_from_user()
231 !access_ok((const void __user *) args->ctx_save_restore_address, in set_queue_properties_from_user()
239 q_properties->queue_percent = args->queue_percentage; in set_queue_properties_from_user()
240 q_properties->priority = args->queue_priority; in set_queue_properties_from_user()
241 q_properties->queue_address = args->ring_base_address; in set_queue_properties_from_user()
242 q_properties->queue_size = args->ring_size; in set_queue_properties_from_user()
243 q_properties->read_ptr = (uint32_t *) args->read_pointer_address; in set_queue_properties_from_user()
244 q_properties->write_ptr = (uint32_t *) args->write_pointer_address; in set_queue_properties_from_user()
245 q_properties->eop_ring_buffer_address = args->eop_buffer_address; in set_queue_properties_from_user()
246 q_properties->eop_ring_buffer_size = args->eop_buffer_size; in set_queue_properties_from_user()
248 args->ctx_save_restore_address; in set_queue_properties_from_user()
249 q_properties->ctx_save_restore_area_size = args->ctx_save_restore_size; in set_queue_properties_from_user()
250 q_properties->ctl_stack_size = args->ctl_stack_size; in set_queue_properties_from_user()
251 if (args->queue_type == KFD_IOC_QUEUE_TYPE_COMPUTE || in set_queue_properties_from_user()
252 args->queue_type == KFD_IOC_QUEUE_TYPE_COMPUTE_AQL) in set_queue_properties_from_user()
254 else if (args->queue_type == KFD_IOC_QUEUE_TYPE_SDMA) in set_queue_properties_from_user()
256 else if (args->queue_type == KFD_IOC_QUEUE_TYPE_SDMA_XGMI) in set_queue_properties_from_user()
261 if (args->queue_type == KFD_IOC_QUEUE_TYPE_COMPUTE_AQL) in set_queue_properties_from_user()
267 q_properties->queue_percent, args->queue_percentage); in set_queue_properties_from_user()
270 q_properties->priority, args->queue_priority); in set_queue_properties_from_user()
273 q_properties->queue_address, args->ring_base_address); in set_queue_properties_from_user()
276 q_properties->queue_size, args->ring_size); in set_queue_properties_from_user()
295 struct kfd_ioctl_create_queue_args *args = data; in kfd_ioctl_create_queue() local
308 err = set_queue_properties_from_user(&q_properties, args); in kfd_ioctl_create_queue()
312 pr_debug("Looking for gpu id 0x%x\n", args->gpu_id); in kfd_ioctl_create_queue()
316 pdd = kfd_process_device_data_by_id(p, args->gpu_id); in kfd_ioctl_create_queue()
318 pr_debug("Could not find gpu id 0x%x\n", args->gpu_id); in kfd_ioctl_create_queue()
351 wptr_vm, args->write_pointer_address >> PAGE_SHIFT); in kfd_ioctl_create_queue()
382 args->queue_id = queue_id; in kfd_ioctl_create_queue()
386 args->doorbell_offset = KFD_MMAP_TYPE_DOORBELL; in kfd_ioctl_create_queue()
387 args->doorbell_offset |= KFD_MMAP_GPU_ID(args->gpu_id); in kfd_ioctl_create_queue()
392 args->doorbell_offset |= doorbell_offset_in_process; in kfd_ioctl_create_queue()
396 pr_debug("Queue id %d was created successfully\n", args->queue_id); in kfd_ioctl_create_queue()
399 args->ring_base_address); in kfd_ioctl_create_queue()
402 args->read_pointer_address); in kfd_ioctl_create_queue()
405 args->write_pointer_address); in kfd_ioctl_create_queue()
424 struct kfd_ioctl_destroy_queue_args *args = data; in kfd_ioctl_destroy_queue() local
427 args->queue_id, in kfd_ioctl_destroy_queue()
432 retval = pqm_destroy_queue(&p->pqm, args->queue_id); in kfd_ioctl_destroy_queue()
442 struct kfd_ioctl_update_queue_args *args = data; in kfd_ioctl_update_queue() local
445 if (args->queue_percentage > KFD_MAX_QUEUE_PERCENTAGE) { in kfd_ioctl_update_queue()
450 if (args->queue_priority > KFD_MAX_QUEUE_PRIORITY) { in kfd_ioctl_update_queue()
455 if ((args->ring_base_address) && in kfd_ioctl_update_queue()
456 (!access_ok((const void __user *) args->ring_base_address, in kfd_ioctl_update_queue()
462 if (!is_power_of_2(args->ring_size) && (args->ring_size != 0)) { in kfd_ioctl_update_queue()
467 properties.queue_address = args->ring_base_address; in kfd_ioctl_update_queue()
468 properties.queue_size = args->ring_size; in kfd_ioctl_update_queue()
469 properties.queue_percent = args->queue_percentage; in kfd_ioctl_update_queue()
470 properties.priority = args->queue_priority; in kfd_ioctl_update_queue()
473 args->queue_id, p->pasid); in kfd_ioctl_update_queue()
477 retval = pqm_update_queue_properties(&p->pqm, args->queue_id, &properties); in kfd_ioctl_update_queue()
489 struct kfd_ioctl_set_cu_mask_args *args = data; in kfd_ioctl_set_cu_mask() local
491 uint32_t __user *cu_mask_ptr = (uint32_t __user *)args->cu_mask_ptr; in kfd_ioctl_set_cu_mask()
492 size_t cu_mask_size = sizeof(uint32_t) * (args->num_cu_mask / 32); in kfd_ioctl_set_cu_mask()
494 if ((args->num_cu_mask % 32) != 0) { in kfd_ioctl_set_cu_mask()
496 args->num_cu_mask); in kfd_ioctl_set_cu_mask()
500 minfo.cu_mask.count = args->num_cu_mask; in kfd_ioctl_set_cu_mask()
531 retval = pqm_update_mqd(&p->pqm, args->queue_id, &minfo); in kfd_ioctl_set_cu_mask()
543 struct kfd_ioctl_get_queue_wave_state_args *args = data; in kfd_ioctl_get_queue_wave_state() local
548 r = pqm_get_wave_state(&p->pqm, args->queue_id, in kfd_ioctl_get_queue_wave_state()
549 (void __user *)args->ctl_stack_address, in kfd_ioctl_get_queue_wave_state()
550 &args->ctl_stack_used_size, in kfd_ioctl_get_queue_wave_state()
551 &args->save_area_used_size); in kfd_ioctl_get_queue_wave_state()
561 struct kfd_ioctl_set_memory_policy_args *args = data; in kfd_ioctl_set_memory_policy() local
566 if (args->default_policy != KFD_IOC_CACHE_POLICY_COHERENT in kfd_ioctl_set_memory_policy()
567 && args->default_policy != KFD_IOC_CACHE_POLICY_NONCOHERENT) { in kfd_ioctl_set_memory_policy()
571 if (args->alternate_policy != KFD_IOC_CACHE_POLICY_COHERENT in kfd_ioctl_set_memory_policy()
572 && args->alternate_policy != KFD_IOC_CACHE_POLICY_NONCOHERENT) { in kfd_ioctl_set_memory_policy()
577 pdd = kfd_process_device_data_by_id(p, args->gpu_id); in kfd_ioctl_set_memory_policy()
579 pr_debug("Could not find gpu id 0x%x\n", args->gpu_id); in kfd_ioctl_set_memory_policy()
590 default_policy = (args->default_policy == KFD_IOC_CACHE_POLICY_COHERENT) in kfd_ioctl_set_memory_policy()
594 (args->alternate_policy == KFD_IOC_CACHE_POLICY_COHERENT) in kfd_ioctl_set_memory_policy()
601 (void __user *)args->alternate_aperture_base, in kfd_ioctl_set_memory_policy()
602 args->alternate_aperture_size)) in kfd_ioctl_set_memory_policy()
615 struct kfd_ioctl_set_trap_handler_args *args = data; in kfd_ioctl_set_trap_handler() local
621 pdd = kfd_process_device_data_by_id(p, args->gpu_id); in kfd_ioctl_set_trap_handler()
633 kfd_process_set_trap_handler(&pdd->qpd, args->tba_addr, args->tma_addr); in kfd_ioctl_set_trap_handler()
670 struct kfd_ioctl_get_clock_counters_args *args = data; in kfd_ioctl_get_clock_counters() local
674 pdd = kfd_process_device_data_by_id(p, args->gpu_id); in kfd_ioctl_get_clock_counters()
678 args->gpu_clock_counter = amdgpu_amdkfd_get_gpu_clock_counter(pdd->dev->adev); in kfd_ioctl_get_clock_counters()
681 args->gpu_clock_counter = 0; in kfd_ioctl_get_clock_counters()
684 args->cpu_clock_counter = ktime_get_raw_ns(); in kfd_ioctl_get_clock_counters()
685 args->system_clock_counter = ktime_get_boottime_ns(); in kfd_ioctl_get_clock_counters()
688 args->system_clock_freq = 1000000000; in kfd_ioctl_get_clock_counters()
697 struct kfd_ioctl_get_process_apertures_args *args = data; in kfd_ioctl_get_process_apertures() local
703 args->num_of_nodes = 0; in kfd_ioctl_get_process_apertures()
711 &args->process_apertures[args->num_of_nodes]; in kfd_ioctl_get_process_apertures()
721 "node id %u\n", args->num_of_nodes); in kfd_ioctl_get_process_apertures()
737 if (++args->num_of_nodes >= NUM_OF_SUPPORTED_GPUS) in kfd_ioctl_get_process_apertures()
748 struct kfd_ioctl_get_process_apertures_new_args *args = data; in kfd_ioctl_get_process_apertures_new() local
755 if (args->num_of_nodes == 0) { in kfd_ioctl_get_process_apertures_new()
760 args->num_of_nodes = p->n_pdds; in kfd_ioctl_get_process_apertures_new()
769 args->num_of_nodes), GFP_KERNEL); in kfd_ioctl_get_process_apertures_new()
776 args->num_of_nodes = 0; in kfd_ioctl_get_process_apertures_new()
782 for (i = 0; i < min(p->n_pdds, args->num_of_nodes); i++) { in kfd_ioctl_get_process_apertures_new()
810 args->num_of_nodes = i; in kfd_ioctl_get_process_apertures_new()
812 (void __user *)args->kfd_process_device_apertures_ptr, in kfd_ioctl_get_process_apertures_new()
826 struct kfd_ioctl_create_event_args *args = data; in kfd_ioctl_create_event() local
833 if (args->event_page_offset) { in kfd_ioctl_create_event()
835 err = kfd_kmap_event_page(p, args->event_page_offset); in kfd_ioctl_create_event()
841 err = kfd_event_create(filp, p, args->event_type, in kfd_ioctl_create_event()
842 args->auto_reset != 0, args->node_id, in kfd_ioctl_create_event()
843 &args->event_id, &args->event_trigger_data, in kfd_ioctl_create_event()
844 &args->event_page_offset, in kfd_ioctl_create_event()
845 &args->event_slot_index); in kfd_ioctl_create_event()
847 pr_debug("Created event (id:0x%08x) (%s)\n", args->event_id, __func__); in kfd_ioctl_create_event()
854 struct kfd_ioctl_destroy_event_args *args = data; in kfd_ioctl_destroy_event() local
856 return kfd_event_destroy(p, args->event_id); in kfd_ioctl_destroy_event()
862 struct kfd_ioctl_set_event_args *args = data; in kfd_ioctl_set_event() local
864 return kfd_set_event(p, args->event_id); in kfd_ioctl_set_event()
870 struct kfd_ioctl_reset_event_args *args = data; in kfd_ioctl_reset_event() local
872 return kfd_reset_event(p, args->event_id); in kfd_ioctl_reset_event()
878 struct kfd_ioctl_wait_events_args *args = data; in kfd_ioctl_wait_events() local
880 return kfd_wait_on_events(p, args->num_events, in kfd_ioctl_wait_events()
881 (void __user *)args->events_ptr, in kfd_ioctl_wait_events()
882 (args->wait_for_all != 0), in kfd_ioctl_wait_events()
883 &args->timeout, &args->wait_result); in kfd_ioctl_wait_events()
888 struct kfd_ioctl_set_scratch_backing_va_args *args = data; in kfd_ioctl_set_scratch_backing_va() local
894 pdd = kfd_process_device_data_by_id(p, args->gpu_id); in kfd_ioctl_set_scratch_backing_va()
907 pdd->qpd.sh_hidden_private_base = args->va_addr; in kfd_ioctl_set_scratch_backing_va()
914 dev->adev, args->va_addr, pdd->qpd.vmid); in kfd_ioctl_set_scratch_backing_va()
927 struct kfd_ioctl_get_tile_config_args *args = data; in kfd_ioctl_get_tile_config() local
933 pdd = kfd_process_device_data_by_id(p, args->gpu_id); in kfd_ioctl_get_tile_config()
940 args->gb_addr_config = config.gb_addr_config; in kfd_ioctl_get_tile_config()
941 args->num_banks = config.num_banks; in kfd_ioctl_get_tile_config()
942 args->num_ranks = config.num_ranks; in kfd_ioctl_get_tile_config()
944 if (args->num_tile_configs > config.num_tile_configs) in kfd_ioctl_get_tile_config()
945 args->num_tile_configs = config.num_tile_configs; in kfd_ioctl_get_tile_config()
946 err = copy_to_user((void __user *)args->tile_config_ptr, in kfd_ioctl_get_tile_config()
948 args->num_tile_configs * sizeof(uint32_t)); in kfd_ioctl_get_tile_config()
950 args->num_tile_configs = 0; in kfd_ioctl_get_tile_config()
954 if (args->num_macro_tile_configs > config.num_macro_tile_configs) in kfd_ioctl_get_tile_config()
955 args->num_macro_tile_configs = in kfd_ioctl_get_tile_config()
957 err = copy_to_user((void __user *)args->macro_tile_config_ptr, in kfd_ioctl_get_tile_config()
959 args->num_macro_tile_configs * sizeof(uint32_t)); in kfd_ioctl_get_tile_config()
961 args->num_macro_tile_configs = 0; in kfd_ioctl_get_tile_config()
971 struct kfd_ioctl_acquire_vm_args *args = data; in kfd_ioctl_acquire_vm() local
976 drm_file = fget(args->drm_fd); in kfd_ioctl_acquire_vm()
981 pdd = kfd_process_device_data_by_id(p, args->gpu_id); in kfd_ioctl_acquire_vm()
1028 struct kfd_ioctl_get_available_memory_args *args = data; in kfd_ioctl_get_available_memory() local
1029 struct kfd_process_device *pdd = kfd_lock_pdd_by_id(p, args->gpu_id); in kfd_ioctl_get_available_memory()
1033 args->available = amdgpu_amdkfd_get_available_memory(pdd->dev->adev); in kfd_ioctl_get_available_memory()
1041 struct kfd_ioctl_alloc_memory_of_gpu_args *args = data; in kfd_ioctl_alloc_memory_of_gpu() local
1047 uint64_t offset = args->mmap_offset; in kfd_ioctl_alloc_memory_of_gpu()
1048 uint32_t flags = args->flags; in kfd_ioctl_alloc_memory_of_gpu()
1050 if (args->size == 0) in kfd_ioctl_alloc_memory_of_gpu()
1061 args->va_addr >> PAGE_SHIFT, in kfd_ioctl_alloc_memory_of_gpu()
1062 (args->va_addr + args->size - 1) >> PAGE_SHIFT)) { in kfd_ioctl_alloc_memory_of_gpu()
1064 args->va_addr); in kfd_ioctl_alloc_memory_of_gpu()
1071 pdd = kfd_process_device_data_by_id(p, args->gpu_id); in kfd_ioctl_alloc_memory_of_gpu()
1094 if (args->size != kfd_doorbell_process_slice(dev)) { in kfd_ioctl_alloc_memory_of_gpu()
1104 if (args->size != PAGE_SIZE) { in kfd_ioctl_alloc_memory_of_gpu()
1116 dev->adev, args->va_addr, args->size, in kfd_ioctl_alloc_memory_of_gpu()
1131 WRITE_ONCE(pdd->vram_usage, pdd->vram_usage + args->size); in kfd_ioctl_alloc_memory_of_gpu()
1135 args->handle = MAKE_HANDLE(args->gpu_id, idr_handle); in kfd_ioctl_alloc_memory_of_gpu()
1136 args->mmap_offset = offset; in kfd_ioctl_alloc_memory_of_gpu()
1142 args->mmap_offset = KFD_MMAP_TYPE_MMIO in kfd_ioctl_alloc_memory_of_gpu()
1143 | KFD_MMAP_GPU_ID(args->gpu_id); in kfd_ioctl_alloc_memory_of_gpu()
1160 struct kfd_ioctl_free_memory_of_gpu_args *args = data; in kfd_ioctl_free_memory_of_gpu() local
1171 if (p->signal_handle && (p->signal_handle == args->handle)) { in kfd_ioctl_free_memory_of_gpu()
1177 pdd = kfd_process_device_data_by_id(p, GET_GPU_ID(args->handle)); in kfd_ioctl_free_memory_of_gpu()
1185 pdd, GET_IDR_HANDLE(args->handle)); in kfd_ioctl_free_memory_of_gpu()
1199 pdd, GET_IDR_HANDLE(args->handle)); in kfd_ioctl_free_memory_of_gpu()
1212 struct kfd_ioctl_map_memory_to_gpu_args *args = data; in kfd_ioctl_map_memory_to_gpu() local
1220 if (!args->n_devices) { in kfd_ioctl_map_memory_to_gpu()
1224 if (args->n_success > args->n_devices) { in kfd_ioctl_map_memory_to_gpu()
1229 devices_arr = kmalloc_array(args->n_devices, sizeof(*devices_arr), in kfd_ioctl_map_memory_to_gpu()
1235 (void __user *)args->device_ids_array_ptr, in kfd_ioctl_map_memory_to_gpu()
1236 args->n_devices * sizeof(*devices_arr)); in kfd_ioctl_map_memory_to_gpu()
1243 pdd = kfd_process_device_data_by_id(p, GET_GPU_ID(args->handle)); in kfd_ioctl_map_memory_to_gpu()
1257 GET_IDR_HANDLE(args->handle)); in kfd_ioctl_map_memory_to_gpu()
1263 for (i = args->n_success; i < args->n_devices; i++) { in kfd_ioctl_map_memory_to_gpu()
1293 args->n_success = i+1; in kfd_ioctl_map_memory_to_gpu()
1305 for (i = 0; i < args->n_devices; i++) { in kfd_ioctl_map_memory_to_gpu()
1330 struct kfd_ioctl_unmap_memory_from_gpu_args *args = data; in kfd_ioctl_unmap_memory_from_gpu() local
1336 if (!args->n_devices) { in kfd_ioctl_unmap_memory_from_gpu()
1340 if (args->n_success > args->n_devices) { in kfd_ioctl_unmap_memory_from_gpu()
1345 devices_arr = kmalloc_array(args->n_devices, sizeof(*devices_arr), in kfd_ioctl_unmap_memory_from_gpu()
1351 (void __user *)args->device_ids_array_ptr, in kfd_ioctl_unmap_memory_from_gpu()
1352 args->n_devices * sizeof(*devices_arr)); in kfd_ioctl_unmap_memory_from_gpu()
1359 pdd = kfd_process_device_data_by_id(p, GET_GPU_ID(args->handle)); in kfd_ioctl_unmap_memory_from_gpu()
1366 GET_IDR_HANDLE(args->handle)); in kfd_ioctl_unmap_memory_from_gpu()
1372 for (i = args->n_success; i < args->n_devices; i++) { in kfd_ioctl_unmap_memory_from_gpu()
1382 i, args->n_devices); in kfd_ioctl_unmap_memory_from_gpu()
1385 args->n_success = i+1; in kfd_ioctl_unmap_memory_from_gpu()
1398 for (i = 0; i < args->n_devices; i++) { in kfd_ioctl_unmap_memory_from_gpu()
1423 struct kfd_ioctl_alloc_queue_gws_args *args = data; in kfd_ioctl_alloc_queue_gws() local
1428 q = pqm_get_user_queue(&p->pqm, args->queue_id); in kfd_ioctl_alloc_queue_gws()
1447 retval = pqm_set_gws(&p->pqm, args->queue_id, args->num_gws ? dev->gws : NULL); in kfd_ioctl_alloc_queue_gws()
1450 args->first_gws = 0; in kfd_ioctl_alloc_queue_gws()
1461 struct kfd_ioctl_get_dmabuf_info_args *args = data; in kfd_ioctl_get_dmabuf_info() local
1476 if (args->metadata_ptr) { in kfd_ioctl_get_dmabuf_info()
1477 metadata_buffer = kzalloc(args->metadata_size, GFP_KERNEL); in kfd_ioctl_get_dmabuf_info()
1483 r = amdgpu_amdkfd_get_dmabuf_info(dev->adev, args->dmabuf_fd, in kfd_ioctl_get_dmabuf_info()
1484 &dmabuf_adev, &args->size, in kfd_ioctl_get_dmabuf_info()
1485 metadata_buffer, args->metadata_size, in kfd_ioctl_get_dmabuf_info()
1486 &args->metadata_size, &flags); in kfd_ioctl_get_dmabuf_info()
1496 args->gpu_id = dev->id; in kfd_ioctl_get_dmabuf_info()
1497 args->flags = flags; in kfd_ioctl_get_dmabuf_info()
1501 r = copy_to_user((void __user *)args->metadata_ptr, in kfd_ioctl_get_dmabuf_info()
1502 metadata_buffer, args->metadata_size); in kfd_ioctl_get_dmabuf_info()
1516 struct kfd_ioctl_import_dmabuf_args *args = data; in kfd_ioctl_import_dmabuf() local
1524 dmabuf = dma_buf_get(args->dmabuf_fd); in kfd_ioctl_import_dmabuf()
1529 pdd = kfd_process_device_data_by_id(p, args->gpu_id); in kfd_ioctl_import_dmabuf()
1542 args->va_addr, pdd->drm_priv, in kfd_ioctl_import_dmabuf()
1557 args->handle = MAKE_HANDLE(args->gpu_id, idr_handle); in kfd_ioctl_import_dmabuf()
1574 struct kfd_ioctl_smi_events_args *args = data; in kfd_ioctl_smi_events() local
1579 pdd = kfd_process_device_data_by_id(p, args->gpuid); in kfd_ioctl_smi_events()
1584 return kfd_smi_event_open(pdd->dev, &args->anon_fd); in kfd_ioctl_smi_events()
1592 struct kfd_ioctl_set_xnack_mode_args *args = data; in kfd_ioctl_set_xnack_mode() local
1596 if (args->xnack_enabled >= 0) { in kfd_ioctl_set_xnack_mode()
1603 if (p->xnack_enabled == args->xnack_enabled) in kfd_ioctl_set_xnack_mode()
1606 if (args->xnack_enabled && !kfd_process_xnack_mode(p, true)) { in kfd_ioctl_set_xnack_mode()
1611 r = svm_range_switch_xnack_reserve_mem(p, args->xnack_enabled); in kfd_ioctl_set_xnack_mode()
1613 args->xnack_enabled = p->xnack_enabled; in kfd_ioctl_set_xnack_mode()
1624 struct kfd_ioctl_svm_args *args = data; in kfd_ioctl_svm() local
1628 args->start_addr, args->size, args->op, args->nattr); in kfd_ioctl_svm()
1630 if ((args->start_addr & ~PAGE_MASK) || (args->size & ~PAGE_MASK)) in kfd_ioctl_svm()
1632 if (!args->start_addr || !args->size) in kfd_ioctl_svm()
1635 r = svm_ioctl(p, args->op, args->start_addr, args->size, args->nattr, in kfd_ioctl_svm()
1636 args->attrs); in kfd_ioctl_svm()
1949 struct kfd_ioctl_criu_args *args) in criu_checkpoint() argument
1955 if (!args->devices || !args->bos || !args->priv_data) in criu_checkpoint()
1978 if (num_devices != args->num_devices || in criu_checkpoint()
1979 num_bos != args->num_bos || in criu_checkpoint()
1980 num_objects != args->num_objects || in criu_checkpoint()
1981 priv_size != args->priv_data_size) { in criu_checkpoint()
1988 ret = criu_checkpoint_process(p, (uint8_t __user *)args->priv_data, &priv_offset); in criu_checkpoint()
1992 ret = criu_checkpoint_devices(p, num_devices, (uint8_t __user *)args->devices, in criu_checkpoint()
1993 (uint8_t __user *)args->priv_data, &priv_offset); in criu_checkpoint()
2005 ret = kfd_criu_checkpoint_queues(p, (uint8_t __user *)args->priv_data, in criu_checkpoint()
2010 ret = kfd_criu_checkpoint_events(p, (uint8_t __user *)args->priv_data, in criu_checkpoint()
2015 ret = kfd_criu_checkpoint_svm(p, (uint8_t __user *)args->priv_data, &priv_offset); in criu_checkpoint()
2023 ret = criu_checkpoint_bos(p, num_bos, (uint8_t __user *)args->bos, in criu_checkpoint()
2024 (uint8_t __user *)args->priv_data, &bo_priv_offset); in criu_checkpoint()
2037 struct kfd_ioctl_criu_args *args, in criu_restore_process() argument
2048 (void __user *)(args->priv_data + *priv_offset), in criu_restore_process()
2078 struct kfd_ioctl_criu_args *args, in criu_restore_devices() argument
2087 if (args->num_devices != p->n_pdds) in criu_restore_devices()
2090 if (*priv_offset + (args->num_devices * sizeof(*device_privs)) > max_priv_data_size) in criu_restore_devices()
2093 device_buckets = kmalloc_array(args->num_devices, sizeof(*device_buckets), GFP_KERNEL); in criu_restore_devices()
2097 ret = copy_from_user(device_buckets, (void __user *)args->devices, in criu_restore_devices()
2098 args->num_devices * sizeof(*device_buckets)); in criu_restore_devices()
2105 for (i = 0; i < args->num_devices; i++) { in criu_restore_devices()
2178 *priv_offset += args->num_devices * sizeof(*device_privs); in criu_restore_devices()
2318 struct kfd_ioctl_criu_args *args, in criu_restore_bos() argument
2327 if (*priv_offset + (args->num_bos * sizeof(*bo_privs)) > max_priv_data_size) in criu_restore_bos()
2333 bo_buckets = kvmalloc_array(args->num_bos, sizeof(*bo_buckets), GFP_KERNEL); in criu_restore_bos()
2337 ret = copy_from_user(bo_buckets, (void __user *)args->bos, in criu_restore_bos()
2338 args->num_bos * sizeof(*bo_buckets)); in criu_restore_bos()
2345 bo_privs = kvmalloc_array(args->num_bos, sizeof(*bo_privs), GFP_KERNEL); in criu_restore_bos()
2351 ret = copy_from_user(bo_privs, (void __user *)args->priv_data + *priv_offset, in criu_restore_bos()
2352 args->num_bos * sizeof(*bo_privs)); in criu_restore_bos()
2358 *priv_offset += args->num_bos * sizeof(*bo_privs); in criu_restore_bos()
2361 for (; i < args->num_bos; i++) { in criu_restore_bos()
2370 ret = copy_to_user((void __user *)args->bos, in criu_restore_bos()
2372 (args->num_bos * sizeof(*bo_buckets))); in criu_restore_bos()
2389 struct kfd_ioctl_criu_args *args, in criu_restore_objects() argument
2400 for (i = 0; i < args->num_objects; i++) { in criu_restore_objects()
2408 ret = get_user(object_type, (uint32_t __user *)(args->priv_data + *priv_offset)); in criu_restore_objects()
2416 ret = kfd_criu_restore_queue(p, (uint8_t __user *)args->priv_data, in criu_restore_objects()
2422 ret = kfd_criu_restore_event(filep, p, (uint8_t __user *)args->priv_data, in criu_restore_objects()
2428 ret = kfd_criu_restore_svm(p, (uint8_t __user *)args->priv_data, in criu_restore_objects()
2445 struct kfd_ioctl_criu_args *args) in criu_restore() argument
2451 args->num_devices, args->num_bos, args->num_objects, args->priv_data_size); in criu_restore()
2453 if (!args->bos || !args->devices || !args->priv_data || !args->priv_data_size || in criu_restore()
2454 !args->num_devices || !args->num_bos) in criu_restore()
2468 ret = criu_restore_process(p, args, &priv_offset, args->priv_data_size); in criu_restore()
2472 ret = criu_restore_devices(p, args, &priv_offset, args->priv_data_size); in criu_restore()
2476 ret = criu_restore_bos(p, args, &priv_offset, args->priv_data_size); in criu_restore()
2480 ret = criu_restore_objects(filep, p, args, &priv_offset, args->priv_data_size); in criu_restore()
2484 if (priv_offset != args->priv_data_size) { in criu_restore()
2501 struct kfd_ioctl_criu_args *args) in criu_unpause() argument
2525 struct kfd_ioctl_criu_args *args) in criu_resume() argument
2532 args->pid); in criu_resume()
2534 pid = find_get_pid(args->pid); in criu_resume()
2536 pr_err("Cannot find pid info for %i\n", args->pid); in criu_resume()
2546 pr_debug("Cannot find process info for %i\n", args->pid); in criu_resume()
2553 pr_err("kfd_criu_resume_svm failed for %i\n", args->pid); in criu_resume()
2559 pr_err("amdgpu_amdkfd_criu_resume failed for %i\n", args->pid); in criu_resume()
2570 struct kfd_ioctl_criu_args *args) in criu_process_info() argument
2588 args->pid = task_pid_nr_ns(p->lead_thread, in criu_process_info()
2591 ret = criu_get_process_object_info(p, &args->num_devices, &args->num_bos, in criu_process_info()
2592 &args->num_objects, &args->priv_data_size); in criu_process_info()
2597 args->num_devices, args->num_bos, args->num_objects, in criu_process_info()
2598 args->priv_data_size); in criu_process_info()
2611 struct kfd_ioctl_criu_args *args = data; in kfd_ioctl_criu() local
2614 dev_dbg(kfd_device, "CRIU operation: %d\n", args->op); in kfd_ioctl_criu()
2615 switch (args->op) { in kfd_ioctl_criu()
2617 ret = criu_process_info(filep, p, args); in kfd_ioctl_criu()
2620 ret = criu_checkpoint(filep, p, args); in kfd_ioctl_criu()
2623 ret = criu_unpause(filep, p, args); in kfd_ioctl_criu()
2626 ret = criu_restore(filep, p, args); in kfd_ioctl_criu()
2629 ret = criu_resume(filep, p, args); in kfd_ioctl_criu()
2632 dev_dbg(kfd_device, "Unsupported CRIU operation:%d\n", args->op); in kfd_ioctl_criu()
2638 dev_dbg(kfd_device, "CRIU operation:%d err:%d\n", args->op, ret); in kfd_ioctl_criu()