Lines Matching full:target

321 static int kfd_dbg_set_workaround(struct kfd_process *target, bool enable)  in kfd_dbg_set_workaround()  argument
323 struct process_queue_manager *pqm = &target->pqm; in kfd_dbg_set_workaround()
340 target->runtime_info.runtime_state = r == -EBUSY ? in kfd_dbg_set_workaround()
485 static void kfd_dbg_clear_process_address_watch(struct kfd_process *target) in kfd_dbg_clear_process_address_watch() argument
489 for (i = 0; i < target->n_pdds; i++) in kfd_dbg_clear_process_address_watch()
491 kfd_dbg_trap_clear_dev_address_watch(target->pdds[i], j); in kfd_dbg_clear_process_address_watch()
494 int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags) in kfd_dbg_trap_set_flags() argument
496 uint32_t prev_flags = target->dbg_flags; in kfd_dbg_trap_set_flags()
499 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_set_flags()
500 if (!kfd_dbg_is_per_vmid_supported(target->pdds[i]->dev) && in kfd_dbg_trap_set_flags()
507 target->dbg_flags = *flags & KFD_DBG_TRAP_FLAG_SINGLE_MEM_OP; in kfd_dbg_trap_set_flags()
509 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_set_flags()
510 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_set_flags()
521 target->dbg_flags = prev_flags; in kfd_dbg_trap_set_flags()
530 target->dbg_flags = prev_flags; in kfd_dbg_trap_set_flags()
533 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_set_flags()
549 * target: target process
556 void kfd_dbg_trap_deactivate(struct kfd_process *target, bool unwind, int unwind_count) in kfd_dbg_trap_deactivate() argument
562 int resume_count = resume_queues(target, 0, NULL); in kfd_dbg_trap_deactivate()
567 cancel_work_sync(&target->debug_event_workarea); in kfd_dbg_trap_deactivate()
568 kfd_dbg_clear_process_address_watch(target); in kfd_dbg_trap_deactivate()
569 kfd_dbg_trap_set_wave_launch_mode(target, 0); in kfd_dbg_trap_deactivate()
571 kfd_dbg_trap_set_flags(target, &flags); in kfd_dbg_trap_deactivate()
574 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_deactivate()
575 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_deactivate()
592 target->runtime_info.ttmp_setup, in kfd_dbg_trap_deactivate()
606 kfd_dbg_set_workaround(target, false); in kfd_dbg_trap_deactivate()
609 static void kfd_dbg_clean_exception_status(struct kfd_process *target) in kfd_dbg_clean_exception_status() argument
615 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_clean_exception_status()
616 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_clean_exception_status()
623 pqm = &target->pqm; in kfd_dbg_clean_exception_status()
631 target->exception_status = 0; in kfd_dbg_clean_exception_status()
634 int kfd_dbg_trap_disable(struct kfd_process *target) in kfd_dbg_trap_disable() argument
636 if (!target->debug_trap_enabled) in kfd_dbg_trap_disable()
641 * attached running target runtime state to enable for re-attach. in kfd_dbg_trap_disable()
643 if (target->runtime_info.runtime_state == DEBUG_RUNTIME_STATE_ENABLED) in kfd_dbg_trap_disable()
644 kfd_dbg_trap_deactivate(target, false, 0); in kfd_dbg_trap_disable()
645 else if (target->runtime_info.runtime_state != DEBUG_RUNTIME_STATE_DISABLED) in kfd_dbg_trap_disable()
646 target->runtime_info.runtime_state = DEBUG_RUNTIME_STATE_ENABLED; in kfd_dbg_trap_disable()
648 fput(target->dbg_ev_file); in kfd_dbg_trap_disable()
649 target->dbg_ev_file = NULL; in kfd_dbg_trap_disable()
651 if (target->debugger_process) { in kfd_dbg_trap_disable()
652 atomic_dec(&target->debugger_process->debugged_process_count); in kfd_dbg_trap_disable()
653 target->debugger_process = NULL; in kfd_dbg_trap_disable()
656 target->debug_trap_enabled = false; in kfd_dbg_trap_disable()
657 kfd_dbg_clean_exception_status(target); in kfd_dbg_trap_disable()
658 kfd_unref_process(target); in kfd_dbg_trap_disable()
663 int kfd_dbg_trap_activate(struct kfd_process *target) in kfd_dbg_trap_activate() argument
667 r = kfd_dbg_set_workaround(target, true); in kfd_dbg_trap_activate()
671 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_activate()
672 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_activate()
678 target->runtime_info.runtime_state = (r == -EBUSY) ? in kfd_dbg_trap_activate()
695 target->runtime_info.ttmp_setup)) in kfd_dbg_trap_activate()
711 * flag will be called again during CWSR initialization if the target process in kfd_dbg_trap_activate()
722 target->runtime_info.runtime_state = in kfd_dbg_trap_activate()
734 kfd_dbg_trap_deactivate(target, true, i); in kfd_dbg_trap_activate()
738 int kfd_dbg_trap_enable(struct kfd_process *target, uint32_t fd, in kfd_dbg_trap_enable() argument
745 if (target->debug_trap_enabled) in kfd_dbg_trap_enable()
749 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_enable()
750 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_enable()
760 copy_size = min((size_t)(*runtime_size), sizeof(target->runtime_info)); in kfd_dbg_trap_enable()
768 target->dbg_ev_file = f; in kfd_dbg_trap_enable()
771 if (target->runtime_info.runtime_state == DEBUG_RUNTIME_STATE_ENABLED) in kfd_dbg_trap_enable()
772 kfd_dbg_trap_activate(target); in kfd_dbg_trap_enable()
777 kref_get(&target->ref); in kfd_dbg_trap_enable()
778 target->debug_trap_enabled = true; in kfd_dbg_trap_enable()
780 if (target->debugger_process) in kfd_dbg_trap_enable()
781 atomic_inc(&target->debugger_process->debugged_process_count); in kfd_dbg_trap_enable()
783 if (copy_to_user(runtime_info, (void *)&target->runtime_info, copy_size)) { in kfd_dbg_trap_enable()
784 kfd_dbg_trap_deactivate(target, false, 0); in kfd_dbg_trap_enable()
788 *runtime_size = sizeof(target->runtime_info); in kfd_dbg_trap_enable()
819 int kfd_dbg_trap_set_wave_launch_override(struct kfd_process *target, in kfd_dbg_trap_set_wave_launch_override() argument
828 r = kfd_dbg_validate_trap_override_request(target, in kfd_dbg_trap_set_wave_launch_override()
836 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_set_wave_launch_override()
837 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_set_wave_launch_override()
862 int kfd_dbg_trap_set_wave_launch_mode(struct kfd_process *target, in kfd_dbg_trap_set_wave_launch_mode() argument
872 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_set_wave_launch_mode()
873 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_set_wave_launch_mode()
894 int kfd_dbg_trap_query_exception_info(struct kfd_process *target, in kfd_dbg_trap_query_exception_info() argument
906 if (!target) in kfd_dbg_trap_query_exception_info()
912 mutex_lock(&target->event_mutex); in kfd_dbg_trap_query_exception_info()
919 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_query_exception_info()
920 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_query_exception_info()
948 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_query_exception_info()
949 pdd = target->pdds[i]; in kfd_dbg_trap_query_exception_info()
983 if (!(target->exception_status & KFD_EC_MASK(exception_code))) { in kfd_dbg_trap_query_exception_info()
989 copy_size = min((size_t)(*info_size), sizeof(target->runtime_info)); in kfd_dbg_trap_query_exception_info()
991 if (copy_to_user(info, (void *)&target->runtime_info, copy_size)) { in kfd_dbg_trap_query_exception_info()
996 actual_info_size = sizeof(target->runtime_info); in kfd_dbg_trap_query_exception_info()
999 exception_status_ptr = &target->exception_status; in kfd_dbg_trap_query_exception_info()
1010 mutex_unlock(&target->event_mutex); in kfd_dbg_trap_query_exception_info()
1014 int kfd_dbg_trap_device_snapshot(struct kfd_process *target, in kfd_dbg_trap_device_snapshot() argument
1024 if (!(target && user_info && number_of_device_infos && entry_size)) in kfd_dbg_trap_device_snapshot()
1027 tmp_num_devices = min_t(size_t, *number_of_device_infos, target->n_pdds); in kfd_dbg_trap_device_snapshot()
1028 *number_of_device_infos = target->n_pdds; in kfd_dbg_trap_device_snapshot()
1036 mutex_lock(&target->event_mutex); in kfd_dbg_trap_device_snapshot()
1040 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_device_snapshot()
1081 mutex_unlock(&target->event_mutex); in kfd_dbg_trap_device_snapshot()
1086 void kfd_dbg_set_enabled_debug_exception_mask(struct kfd_process *target, in kfd_dbg_set_enabled_debug_exception_mask() argument
1096 mutex_lock(&target->event_mutex); in kfd_dbg_set_enabled_debug_exception_mask()
1098 found_mask |= target->exception_status; in kfd_dbg_set_enabled_debug_exception_mask()
1100 pqm = &target->pqm; in kfd_dbg_set_enabled_debug_exception_mask()
1108 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_set_enabled_debug_exception_mask()
1109 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_set_enabled_debug_exception_mask()
1115 kernel_write(target->dbg_ev_file, &write_data, 1, &pos); in kfd_dbg_set_enabled_debug_exception_mask()
1117 target->exception_enable_mask = exception_set_mask; in kfd_dbg_set_enabled_debug_exception_mask()
1119 mutex_unlock(&target->event_mutex); in kfd_dbg_set_enabled_debug_exception_mask()