Lines Matching refs:target

323 static int kfd_dbg_set_workaround(struct kfd_process *target, bool enable)  in kfd_dbg_set_workaround()  argument
325 struct process_queue_manager *pqm = &target->pqm; in kfd_dbg_set_workaround()
342 target->runtime_info.runtime_state = r == -EBUSY ? in kfd_dbg_set_workaround()
487 static void kfd_dbg_clear_process_address_watch(struct kfd_process *target) in kfd_dbg_clear_process_address_watch() argument
491 for (i = 0; i < target->n_pdds; i++) in kfd_dbg_clear_process_address_watch()
493 kfd_dbg_trap_clear_dev_address_watch(target->pdds[i], j); in kfd_dbg_clear_process_address_watch()
496 int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags) in kfd_dbg_trap_set_flags() argument
498 uint32_t prev_flags = target->dbg_flags; in kfd_dbg_trap_set_flags()
501 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_set_flags()
503 kfd_topology_device_by_id(target->pdds[i]->dev->id); in kfd_dbg_trap_set_flags()
519 target->dbg_flags = *flags; in kfd_dbg_trap_set_flags()
521 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_set_flags()
522 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_set_flags()
533 target->dbg_flags = prev_flags; in kfd_dbg_trap_set_flags()
542 target->dbg_flags = prev_flags; in kfd_dbg_trap_set_flags()
545 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_set_flags()
568 void kfd_dbg_trap_deactivate(struct kfd_process *target, bool unwind, int unwind_count) in kfd_dbg_trap_deactivate() argument
574 int resume_count = resume_queues(target, 0, NULL); in kfd_dbg_trap_deactivate()
579 cancel_work_sync(&target->debug_event_workarea); in kfd_dbg_trap_deactivate()
580 kfd_dbg_clear_process_address_watch(target); in kfd_dbg_trap_deactivate()
581 kfd_dbg_trap_set_wave_launch_mode(target, 0); in kfd_dbg_trap_deactivate()
583 kfd_dbg_trap_set_flags(target, &flags); in kfd_dbg_trap_deactivate()
586 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_deactivate()
587 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_deactivate()
604 target->runtime_info.ttmp_setup, in kfd_dbg_trap_deactivate()
618 kfd_dbg_set_workaround(target, false); in kfd_dbg_trap_deactivate()
621 static void kfd_dbg_clean_exception_status(struct kfd_process *target) in kfd_dbg_clean_exception_status() argument
627 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_clean_exception_status()
628 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_clean_exception_status()
635 pqm = &target->pqm; in kfd_dbg_clean_exception_status()
643 target->exception_status = 0; in kfd_dbg_clean_exception_status()
646 int kfd_dbg_trap_disable(struct kfd_process *target) in kfd_dbg_trap_disable() argument
648 if (!target->debug_trap_enabled) in kfd_dbg_trap_disable()
655 if (target->runtime_info.runtime_state == DEBUG_RUNTIME_STATE_ENABLED) in kfd_dbg_trap_disable()
656 kfd_dbg_trap_deactivate(target, false, 0); in kfd_dbg_trap_disable()
657 else if (target->runtime_info.runtime_state != DEBUG_RUNTIME_STATE_DISABLED) in kfd_dbg_trap_disable()
658 target->runtime_info.runtime_state = DEBUG_RUNTIME_STATE_ENABLED; in kfd_dbg_trap_disable()
660 cancel_work_sync(&target->debug_event_workarea); in kfd_dbg_trap_disable()
661 fput(target->dbg_ev_file); in kfd_dbg_trap_disable()
662 target->dbg_ev_file = NULL; in kfd_dbg_trap_disable()
664 if (target->debugger_process) { in kfd_dbg_trap_disable()
665 atomic_dec(&target->debugger_process->debugged_process_count); in kfd_dbg_trap_disable()
666 target->debugger_process = NULL; in kfd_dbg_trap_disable()
669 target->debug_trap_enabled = false; in kfd_dbg_trap_disable()
670 kfd_dbg_clean_exception_status(target); in kfd_dbg_trap_disable()
671 kfd_unref_process(target); in kfd_dbg_trap_disable()
676 int kfd_dbg_trap_activate(struct kfd_process *target) in kfd_dbg_trap_activate() argument
680 r = kfd_dbg_set_workaround(target, true); in kfd_dbg_trap_activate()
684 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_activate()
685 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_activate()
691 target->runtime_info.runtime_state = (r == -EBUSY) ? in kfd_dbg_trap_activate()
708 target->runtime_info.ttmp_setup)) in kfd_dbg_trap_activate()
735 target->runtime_info.runtime_state = in kfd_dbg_trap_activate()
747 kfd_dbg_trap_deactivate(target, true, i); in kfd_dbg_trap_activate()
751 int kfd_dbg_trap_enable(struct kfd_process *target, uint32_t fd, in kfd_dbg_trap_enable() argument
758 if (target->debug_trap_enabled) in kfd_dbg_trap_enable()
762 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_enable()
763 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_enable()
773 copy_size = min((size_t)(*runtime_size), sizeof(target->runtime_info)); in kfd_dbg_trap_enable()
781 target->dbg_ev_file = f; in kfd_dbg_trap_enable()
784 if (target->runtime_info.runtime_state == DEBUG_RUNTIME_STATE_ENABLED) in kfd_dbg_trap_enable()
785 kfd_dbg_trap_activate(target); in kfd_dbg_trap_enable()
790 kref_get(&target->ref); in kfd_dbg_trap_enable()
791 target->debug_trap_enabled = true; in kfd_dbg_trap_enable()
793 if (target->debugger_process) in kfd_dbg_trap_enable()
794 atomic_inc(&target->debugger_process->debugged_process_count); in kfd_dbg_trap_enable()
796 if (copy_to_user(runtime_info, (void *)&target->runtime_info, copy_size)) { in kfd_dbg_trap_enable()
797 kfd_dbg_trap_deactivate(target, false, 0); in kfd_dbg_trap_enable()
801 *runtime_size = sizeof(target->runtime_info); in kfd_dbg_trap_enable()
832 int kfd_dbg_trap_set_wave_launch_override(struct kfd_process *target, in kfd_dbg_trap_set_wave_launch_override() argument
841 r = kfd_dbg_validate_trap_override_request(target, in kfd_dbg_trap_set_wave_launch_override()
849 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_set_wave_launch_override()
850 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_set_wave_launch_override()
875 int kfd_dbg_trap_set_wave_launch_mode(struct kfd_process *target, in kfd_dbg_trap_set_wave_launch_mode() argument
885 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_set_wave_launch_mode()
886 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_set_wave_launch_mode()
907 int kfd_dbg_trap_query_exception_info(struct kfd_process *target, in kfd_dbg_trap_query_exception_info() argument
919 if (!target) in kfd_dbg_trap_query_exception_info()
925 mutex_lock(&target->event_mutex); in kfd_dbg_trap_query_exception_info()
932 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_query_exception_info()
933 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_query_exception_info()
961 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_query_exception_info()
962 pdd = target->pdds[i]; in kfd_dbg_trap_query_exception_info()
996 if (!(target->exception_status & KFD_EC_MASK(exception_code))) { in kfd_dbg_trap_query_exception_info()
1002 copy_size = min((size_t)(*info_size), sizeof(target->runtime_info)); in kfd_dbg_trap_query_exception_info()
1004 if (copy_to_user(info, (void *)&target->runtime_info, copy_size)) { in kfd_dbg_trap_query_exception_info()
1009 actual_info_size = sizeof(target->runtime_info); in kfd_dbg_trap_query_exception_info()
1012 exception_status_ptr = &target->exception_status; in kfd_dbg_trap_query_exception_info()
1023 mutex_unlock(&target->event_mutex); in kfd_dbg_trap_query_exception_info()
1027 int kfd_dbg_trap_device_snapshot(struct kfd_process *target, in kfd_dbg_trap_device_snapshot() argument
1037 if (!(target && user_info && number_of_device_infos && entry_size)) in kfd_dbg_trap_device_snapshot()
1042 tmp_num_devices = min_t(size_t, *number_of_device_infos, target->n_pdds); in kfd_dbg_trap_device_snapshot()
1043 *number_of_device_infos = target->n_pdds; in kfd_dbg_trap_device_snapshot()
1051 mutex_lock(&target->event_mutex); in kfd_dbg_trap_device_snapshot()
1055 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_device_snapshot()
1096 mutex_unlock(&target->event_mutex); in kfd_dbg_trap_device_snapshot()
1101 void kfd_dbg_set_enabled_debug_exception_mask(struct kfd_process *target, in kfd_dbg_set_enabled_debug_exception_mask() argument
1111 mutex_lock(&target->event_mutex); in kfd_dbg_set_enabled_debug_exception_mask()
1113 found_mask |= target->exception_status; in kfd_dbg_set_enabled_debug_exception_mask()
1115 pqm = &target->pqm; in kfd_dbg_set_enabled_debug_exception_mask()
1123 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_set_enabled_debug_exception_mask()
1124 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_set_enabled_debug_exception_mask()
1130 kernel_write(target->dbg_ev_file, &write_data, 1, &pos); in kfd_dbg_set_enabled_debug_exception_mask()
1132 target->exception_enable_mask = exception_set_mask; in kfd_dbg_set_enabled_debug_exception_mask()
1134 mutex_unlock(&target->event_mutex); in kfd_dbg_set_enabled_debug_exception_mask()