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()
504 static void kfd_dbg_clear_process_address_watch(struct kfd_process *target) in kfd_dbg_clear_process_address_watch() argument
508 for (i = 0; i < target->n_pdds; i++) in kfd_dbg_clear_process_address_watch()
510 kfd_dbg_trap_clear_dev_address_watch(target->pdds[i], j); in kfd_dbg_clear_process_address_watch()
513 int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags) in kfd_dbg_trap_set_flags() argument
515 uint32_t prev_flags = target->dbg_flags; in kfd_dbg_trap_set_flags()
518 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_set_flags()
520 kfd_topology_device_by_id(target->pdds[i]->dev->id); in kfd_dbg_trap_set_flags()
536 target->dbg_flags = *flags; in kfd_dbg_trap_set_flags()
538 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_set_flags()
539 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_set_flags()
550 target->dbg_flags = prev_flags; in kfd_dbg_trap_set_flags()
559 target->dbg_flags = prev_flags; in kfd_dbg_trap_set_flags()
562 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_set_flags()
578 * target: target process
585 void kfd_dbg_trap_deactivate(struct kfd_process *target, bool unwind, int unwind_count) in kfd_dbg_trap_deactivate() argument
591 int resume_count = resume_queues(target, 0, NULL); in kfd_dbg_trap_deactivate()
596 cancel_work_sync(&target->debug_event_workarea); in kfd_dbg_trap_deactivate()
597 kfd_dbg_clear_process_address_watch(target); in kfd_dbg_trap_deactivate()
598 kfd_dbg_trap_set_wave_launch_mode(target, 0); in kfd_dbg_trap_deactivate()
600 kfd_dbg_trap_set_flags(target, &flags); in kfd_dbg_trap_deactivate()
603 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_deactivate()
604 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_deactivate()
621 target->runtime_info.ttmp_setup, in kfd_dbg_trap_deactivate()
635 kfd_dbg_set_workaround(target, false); in kfd_dbg_trap_deactivate()
638 static void kfd_dbg_clean_exception_status(struct kfd_process *target) in kfd_dbg_clean_exception_status() argument
644 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_clean_exception_status()
645 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_clean_exception_status()
652 pqm = &target->pqm; in kfd_dbg_clean_exception_status()
660 target->exception_status = 0; in kfd_dbg_clean_exception_status()
663 int kfd_dbg_trap_disable(struct kfd_process *target) in kfd_dbg_trap_disable() argument
665 if (!target->debug_trap_enabled) in kfd_dbg_trap_disable()
670 * attached running target runtime state to enable for re-attach. in kfd_dbg_trap_disable()
672 if (target->runtime_info.runtime_state == DEBUG_RUNTIME_STATE_ENABLED) in kfd_dbg_trap_disable()
673 kfd_dbg_trap_deactivate(target, false, 0); in kfd_dbg_trap_disable()
674 else if (target->runtime_info.runtime_state != DEBUG_RUNTIME_STATE_DISABLED) in kfd_dbg_trap_disable()
675 target->runtime_info.runtime_state = DEBUG_RUNTIME_STATE_ENABLED; in kfd_dbg_trap_disable()
677 cancel_work_sync(&target->debug_event_workarea); in kfd_dbg_trap_disable()
678 fput(target->dbg_ev_file); in kfd_dbg_trap_disable()
679 target->dbg_ev_file = NULL; in kfd_dbg_trap_disable()
681 if (target->debugger_process) { in kfd_dbg_trap_disable()
682 atomic_dec(&target->debugger_process->debugged_process_count); in kfd_dbg_trap_disable()
683 target->debugger_process = NULL; in kfd_dbg_trap_disable()
686 target->debug_trap_enabled = false; in kfd_dbg_trap_disable()
687 kfd_dbg_clean_exception_status(target); in kfd_dbg_trap_disable()
688 kfd_unref_process(target); in kfd_dbg_trap_disable()
693 int kfd_dbg_trap_activate(struct kfd_process *target) in kfd_dbg_trap_activate() argument
697 r = kfd_dbg_set_workaround(target, true); in kfd_dbg_trap_activate()
701 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_activate()
702 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_activate()
708 target->runtime_info.runtime_state = (r == -EBUSY) ? in kfd_dbg_trap_activate()
725 target->runtime_info.ttmp_setup)) in kfd_dbg_trap_activate()
741 * flag will be called again during CWSR initialization if the target process in kfd_dbg_trap_activate()
752 target->runtime_info.runtime_state = in kfd_dbg_trap_activate()
764 kfd_dbg_trap_deactivate(target, true, i); in kfd_dbg_trap_activate()
768 int kfd_dbg_trap_enable(struct kfd_process *target, uint32_t fd, in kfd_dbg_trap_enable() argument
775 if (target->debug_trap_enabled) in kfd_dbg_trap_enable()
779 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_enable()
780 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_enable()
790 copy_size = min((size_t)(*runtime_size), sizeof(target->runtime_info)); in kfd_dbg_trap_enable()
798 target->dbg_ev_file = f; in kfd_dbg_trap_enable()
801 if (target->runtime_info.runtime_state == DEBUG_RUNTIME_STATE_ENABLED) in kfd_dbg_trap_enable()
802 kfd_dbg_trap_activate(target); in kfd_dbg_trap_enable()
807 kref_get(&target->ref); in kfd_dbg_trap_enable()
808 target->debug_trap_enabled = true; in kfd_dbg_trap_enable()
810 if (target->debugger_process) in kfd_dbg_trap_enable()
811 atomic_inc(&target->debugger_process->debugged_process_count); in kfd_dbg_trap_enable()
813 if (copy_to_user(runtime_info, (void *)&target->runtime_info, copy_size)) { in kfd_dbg_trap_enable()
814 kfd_dbg_trap_deactivate(target, false, 0); in kfd_dbg_trap_enable()
818 *runtime_size = sizeof(target->runtime_info); in kfd_dbg_trap_enable()
849 int kfd_dbg_trap_set_wave_launch_override(struct kfd_process *target, in kfd_dbg_trap_set_wave_launch_override() argument
858 r = kfd_dbg_validate_trap_override_request(target, in kfd_dbg_trap_set_wave_launch_override()
866 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_set_wave_launch_override()
867 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_set_wave_launch_override()
892 int kfd_dbg_trap_set_wave_launch_mode(struct kfd_process *target, in kfd_dbg_trap_set_wave_launch_mode() argument
902 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_set_wave_launch_mode()
903 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_set_wave_launch_mode()
924 int kfd_dbg_trap_query_exception_info(struct kfd_process *target, in kfd_dbg_trap_query_exception_info() argument
936 if (!target) in kfd_dbg_trap_query_exception_info()
942 mutex_lock(&target->event_mutex); in kfd_dbg_trap_query_exception_info()
949 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_query_exception_info()
950 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_query_exception_info()
978 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_trap_query_exception_info()
979 pdd = target->pdds[i]; in kfd_dbg_trap_query_exception_info()
1013 if (!(target->exception_status & KFD_EC_MASK(exception_code))) { in kfd_dbg_trap_query_exception_info()
1019 copy_size = min((size_t)(*info_size), sizeof(target->runtime_info)); in kfd_dbg_trap_query_exception_info()
1021 if (copy_to_user(info, (void *)&target->runtime_info, copy_size)) { in kfd_dbg_trap_query_exception_info()
1026 actual_info_size = sizeof(target->runtime_info); in kfd_dbg_trap_query_exception_info()
1029 exception_status_ptr = &target->exception_status; in kfd_dbg_trap_query_exception_info()
1040 mutex_unlock(&target->event_mutex); in kfd_dbg_trap_query_exception_info()
1044 int kfd_dbg_trap_device_snapshot(struct kfd_process *target, in kfd_dbg_trap_device_snapshot() argument
1054 if (!(target && user_info && number_of_device_infos && entry_size)) in kfd_dbg_trap_device_snapshot()
1059 tmp_num_devices = min_t(size_t, *number_of_device_infos, target->n_pdds); in kfd_dbg_trap_device_snapshot()
1060 *number_of_device_infos = target->n_pdds; in kfd_dbg_trap_device_snapshot()
1068 mutex_lock(&target->event_mutex); in kfd_dbg_trap_device_snapshot()
1072 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_trap_device_snapshot()
1113 mutex_unlock(&target->event_mutex); in kfd_dbg_trap_device_snapshot()
1118 void kfd_dbg_set_enabled_debug_exception_mask(struct kfd_process *target, in kfd_dbg_set_enabled_debug_exception_mask() argument
1128 mutex_lock(&target->event_mutex); in kfd_dbg_set_enabled_debug_exception_mask()
1130 found_mask |= target->exception_status; in kfd_dbg_set_enabled_debug_exception_mask()
1132 pqm = &target->pqm; in kfd_dbg_set_enabled_debug_exception_mask()
1140 for (i = 0; i < target->n_pdds; i++) { in kfd_dbg_set_enabled_debug_exception_mask()
1141 struct kfd_process_device *pdd = target->pdds[i]; in kfd_dbg_set_enabled_debug_exception_mask()
1147 kernel_write(target->dbg_ev_file, &write_data, 1, &pos); in kfd_dbg_set_enabled_debug_exception_mask()
1149 target->exception_enable_mask = exception_set_mask; in kfd_dbg_set_enabled_debug_exception_mask()
1151 mutex_unlock(&target->event_mutex); in kfd_dbg_set_enabled_debug_exception_mask()