Lines Matching full: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()
511 static void kfd_dbg_clear_process_address_watch(struct kfd_process *target) in kfd_dbg_clear_process_address_watch() argument
515 for (i = 0; i < target->n_pdds; i++) in kfd_dbg_clear_process_address_watch()
517 kfd_dbg_trap_clear_dev_address_watch(target->pdds[i], j); in kfd_dbg_clear_process_address_watch()
520 int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags) in kfd_dbg_trap_set_flags() argument
522 uint32_t prev_flags = target->dbg_flags; in kfd_dbg_trap_set_flags()
525 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_set_flags()
529 kfd_topology_device_by_id(target->pdds[i]->dev->id); in kfd_dbg_trap_set_flags()
555 target->dbg_flags = *flags; in kfd_dbg_trap_set_flags()
557 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_set_flags()
558 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_set_flags()
569 target->dbg_flags = prev_flags; in kfd_dbg_trap_set_flags()
578 target->dbg_flags = prev_flags; in kfd_dbg_trap_set_flags()
581 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_set_flags()
597 * target: target process
604 void kfd_dbg_trap_deactivate(struct kfd_process *target, bool unwind, int unwind_count) in kfd_dbg_trap_deactivate() argument
610 int resume_count = resume_queues(target, 0, NULL); in kfd_dbg_trap_deactivate()
615 cancel_work_sync(&target->debug_event_workarea); in kfd_dbg_trap_deactivate()
616 kfd_dbg_clear_process_address_watch(target); in kfd_dbg_trap_deactivate()
617 kfd_dbg_trap_set_wave_launch_mode(target, 0); in kfd_dbg_trap_deactivate()
619 kfd_dbg_trap_set_flags(target, &flags); in kfd_dbg_trap_deactivate()
622 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_deactivate()
623 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_deactivate()
640 target->runtime_info.ttmp_setup, in kfd_dbg_trap_deactivate()
655 kfd_dbg_set_workaround(target, false); in kfd_dbg_trap_deactivate()
658 static void kfd_dbg_clean_exception_status(struct kfd_process *target) in kfd_dbg_clean_exception_status() argument
664 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_clean_exception_status()
665 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_clean_exception_status()
672 pqm = &target->pqm; in kfd_dbg_clean_exception_status()
680 target->exception_status = 0; in kfd_dbg_clean_exception_status()
683 int kfd_dbg_trap_disable(struct kfd_process *target) in kfd_dbg_trap_disable() argument
685 if (!target->debug_trap_enabled) in kfd_dbg_trap_disable()
690 * attached running target runtime state to enable for re-attach. in kfd_dbg_trap_disable()
692 if (target->runtime_info.runtime_state == DEBUG_RUNTIME_STATE_ENABLED) in kfd_dbg_trap_disable()
693 kfd_dbg_trap_deactivate(target, false, 0); in kfd_dbg_trap_disable()
694 else if (target->runtime_info.runtime_state != DEBUG_RUNTIME_STATE_DISABLED) in kfd_dbg_trap_disable()
695 target->runtime_info.runtime_state = DEBUG_RUNTIME_STATE_ENABLED; in kfd_dbg_trap_disable()
697 cancel_work_sync(&target->debug_event_workarea); in kfd_dbg_trap_disable()
698 fput(target->dbg_ev_file); in kfd_dbg_trap_disable()
699 target->dbg_ev_file = NULL; in kfd_dbg_trap_disable()
701 if (target->debugger_process) { in kfd_dbg_trap_disable()
702 atomic_dec(&target->debugger_process->debugged_process_count); in kfd_dbg_trap_disable()
703 target->debugger_process = NULL; in kfd_dbg_trap_disable()
706 target->debug_trap_enabled = false; in kfd_dbg_trap_disable()
707 kfd_dbg_clean_exception_status(target); in kfd_dbg_trap_disable()
708 kfd_unref_process(target); in kfd_dbg_trap_disable()
713 int kfd_dbg_trap_activate(struct kfd_process *target) in kfd_dbg_trap_activate() argument
717 r = kfd_dbg_set_workaround(target, true); in kfd_dbg_trap_activate()
721 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_activate()
722 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_activate()
728 target->runtime_info.runtime_state = (r == -EBUSY) ? in kfd_dbg_trap_activate()
745 target->runtime_info.ttmp_setup)) in kfd_dbg_trap_activate()
761 * flag will be called again during CWSR initialization if the target process in kfd_dbg_trap_activate()
772 target->runtime_info.runtime_state = in kfd_dbg_trap_activate()
784 kfd_dbg_trap_deactivate(target, true, i); in kfd_dbg_trap_activate()
788 int kfd_dbg_trap_enable(struct kfd_process *target, uint32_t fd, in kfd_dbg_trap_enable() argument
795 if (target->debug_trap_enabled) in kfd_dbg_trap_enable()
799 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_enable()
800 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_enable()
810 copy_size = min((size_t)(*runtime_size), sizeof(target->runtime_info)); in kfd_dbg_trap_enable()
818 target->dbg_ev_file = f; in kfd_dbg_trap_enable()
821 if (target->runtime_info.runtime_state == DEBUG_RUNTIME_STATE_ENABLED) in kfd_dbg_trap_enable()
822 kfd_dbg_trap_activate(target); in kfd_dbg_trap_enable()
827 kref_get(&target->ref); in kfd_dbg_trap_enable()
828 target->debug_trap_enabled = true; in kfd_dbg_trap_enable()
830 if (target->debugger_process) in kfd_dbg_trap_enable()
831 atomic_inc(&target->debugger_process->debugged_process_count); in kfd_dbg_trap_enable()
833 if (copy_to_user(runtime_info, (void *)&target->runtime_info, copy_size)) { in kfd_dbg_trap_enable()
834 kfd_dbg_trap_deactivate(target, false, 0); in kfd_dbg_trap_enable()
838 *runtime_size = sizeof(target->runtime_info); in kfd_dbg_trap_enable()
869 int kfd_dbg_trap_set_wave_launch_override(struct kfd_process *target, in kfd_dbg_trap_set_wave_launch_override() argument
878 r = kfd_dbg_validate_trap_override_request(target, in kfd_dbg_trap_set_wave_launch_override()
886 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_set_wave_launch_override()
887 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_set_wave_launch_override()
912 int kfd_dbg_trap_set_wave_launch_mode(struct kfd_process *target, in kfd_dbg_trap_set_wave_launch_mode() argument
922 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_set_wave_launch_mode()
923 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_set_wave_launch_mode()
944 int kfd_dbg_trap_query_exception_info(struct kfd_process *target, in kfd_dbg_trap_query_exception_info() argument
956 if (!target) in kfd_dbg_trap_query_exception_info()
962 mutex_lock(&target->event_mutex); in kfd_dbg_trap_query_exception_info()
969 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_query_exception_info()
970 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_query_exception_info()
998 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_query_exception_info()
999 pdd = target->pdds[i]; in kfd_dbg_trap_query_exception_info()
1033 if (!(target->exception_status & KFD_EC_MASK(exception_code))) { in kfd_dbg_trap_query_exception_info()
1039 copy_size = min((size_t)(*info_size), sizeof(target->runtime_info)); in kfd_dbg_trap_query_exception_info()
1041 if (copy_to_user(info, (void *)&target->runtime_info, copy_size)) { in kfd_dbg_trap_query_exception_info()
1046 actual_info_size = sizeof(target->runtime_info); in kfd_dbg_trap_query_exception_info()
1049 exception_status_ptr = &target->exception_status; in kfd_dbg_trap_query_exception_info()
1060 mutex_unlock(&target->event_mutex); in kfd_dbg_trap_query_exception_info()
1064 int kfd_dbg_trap_device_snapshot(struct kfd_process *target, in kfd_dbg_trap_device_snapshot() argument
1074 if (!(target && user_info && number_of_device_infos && entry_size)) in kfd_dbg_trap_device_snapshot()
1079 tmp_num_devices = min_t(size_t, *number_of_device_infos, target->n_pdds); in kfd_dbg_trap_device_snapshot()
1080 *number_of_device_infos = target->n_pdds; in kfd_dbg_trap_device_snapshot()
1088 mutex_lock(&target->event_mutex); in kfd_dbg_trap_device_snapshot()
1092 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_device_snapshot()
1138 mutex_unlock(&target->event_mutex); in kfd_dbg_trap_device_snapshot()
1143 void kfd_dbg_set_enabled_debug_exception_mask(struct kfd_process *target, in kfd_dbg_set_enabled_debug_exception_mask() argument
1153 mutex_lock(&target->event_mutex); in kfd_dbg_set_enabled_debug_exception_mask()
1155 found_mask |= target->exception_status; in kfd_dbg_set_enabled_debug_exception_mask()
1157 pqm = &target->pqm; in kfd_dbg_set_enabled_debug_exception_mask()
1165 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_set_enabled_debug_exception_mask()
1166 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_set_enabled_debug_exception_mask()
1172 kernel_write(target->dbg_ev_file, &write_data, 1, &pos); in kfd_dbg_set_enabled_debug_exception_mask()
1174 target->exception_enable_mask = exception_set_mask; in kfd_dbg_set_enabled_debug_exception_mask()
1176 mutex_unlock(&target->event_mutex); in kfd_dbg_set_enabled_debug_exception_mask()