Lines Matching defs:target
322 static int kfd_dbg_set_workaround(struct kfd_process *target, bool enable)
324 struct process_queue_manager *pqm = &target->pqm;
341 target->runtime_info.runtime_state = r == -EBUSY ?
486 static void kfd_dbg_clear_process_address_watch(struct kfd_process *target)
490 for (i = 0; i < target->n_pdds; i++)
492 kfd_dbg_trap_clear_dev_address_watch(target->pdds[i], j);
495 int kfd_dbg_trap_set_flags(struct kfd_process *target, uint32_t *flags)
497 uint32_t prev_flags = target->dbg_flags;
500 for (i = 0; i < target->n_pdds; i++) {
501 if (!kfd_dbg_is_per_vmid_supported(target->pdds[i]->dev) &&
508 target->dbg_flags = *flags & KFD_DBG_TRAP_FLAG_SINGLE_MEM_OP;
510 for (i = 0; i < target->n_pdds; i++) {
511 struct kfd_process_device *pdd = target->pdds[i];
522 target->dbg_flags = prev_flags;
531 target->dbg_flags = prev_flags;
534 struct kfd_process_device *pdd = target->pdds[i];
550 * target: target process
557 void kfd_dbg_trap_deactivate(struct kfd_process *target, bool unwind, int unwind_count)
563 int resume_count = resume_queues(target, 0, NULL);
568 cancel_work_sync(&target->debug_event_workarea);
569 kfd_dbg_clear_process_address_watch(target);
570 kfd_dbg_trap_set_wave_launch_mode(target, 0);
572 kfd_dbg_trap_set_flags(target, &flags);
575 for (i = 0; i < target->n_pdds; i++) {
576 struct kfd_process_device *pdd = target->pdds[i];
593 target->runtime_info.ttmp_setup,
607 kfd_dbg_set_workaround(target, false);
610 static void kfd_dbg_clean_exception_status(struct kfd_process *target)
616 for (i = 0; i < target->n_pdds; i++) {
617 struct kfd_process_device *pdd = target->pdds[i];
624 pqm = &target->pqm;
632 target->exception_status = 0;
635 int kfd_dbg_trap_disable(struct kfd_process *target)
637 if (!target->debug_trap_enabled)
642 * attached running target runtime state to enable for re-attach.
644 if (target->runtime_info.runtime_state == DEBUG_RUNTIME_STATE_ENABLED)
645 kfd_dbg_trap_deactivate(target, false, 0);
646 else if (target->runtime_info.runtime_state != DEBUG_RUNTIME_STATE_DISABLED)
647 target->runtime_info.runtime_state = DEBUG_RUNTIME_STATE_ENABLED;
649 cancel_work_sync(&target->debug_event_workarea);
650 fput(target->dbg_ev_file);
651 target->dbg_ev_file = NULL;
653 if (target->debugger_process) {
654 atomic_dec(&target->debugger_process->debugged_process_count);
655 target->debugger_process = NULL;
658 target->debug_trap_enabled = false;
659 kfd_dbg_clean_exception_status(target);
660 kfd_unref_process(target);
665 int kfd_dbg_trap_activate(struct kfd_process *target)
669 r = kfd_dbg_set_workaround(target, true);
673 for (i = 0; i < target->n_pdds; i++) {
674 struct kfd_process_device *pdd = target->pdds[i];
680 target->runtime_info.runtime_state = (r == -EBUSY) ?
697 target->runtime_info.ttmp_setup))
713 * flag will be called again during CWSR initialization if the target process
724 target->runtime_info.runtime_state =
736 kfd_dbg_trap_deactivate(target, true, i);
740 int kfd_dbg_trap_enable(struct kfd_process *target, uint32_t fd,
747 if (target->debug_trap_enabled)
751 for (i = 0; i < target->n_pdds; i++) {
752 struct kfd_process_device *pdd = target->pdds[i];
762 copy_size = min((size_t)(*runtime_size), sizeof(target->runtime_info));
770 target->dbg_ev_file = f;
773 if (target->runtime_info.runtime_state == DEBUG_RUNTIME_STATE_ENABLED)
774 kfd_dbg_trap_activate(target);
779 kref_get(&target->ref);
780 target->debug_trap_enabled = true;
782 if (target->debugger_process)
783 atomic_inc(&target->debugger_process->debugged_process_count);
785 if (copy_to_user(runtime_info, (void *)&target->runtime_info, copy_size)) {
786 kfd_dbg_trap_deactivate(target, false, 0);
790 *runtime_size = sizeof(target->runtime_info);
821 int kfd_dbg_trap_set_wave_launch_override(struct kfd_process *target,
830 r = kfd_dbg_validate_trap_override_request(target,
838 for (i = 0; i < target->n_pdds; i++) {
839 struct kfd_process_device *pdd = target->pdds[i];
864 int kfd_dbg_trap_set_wave_launch_mode(struct kfd_process *target,
874 for (i = 0; i < target->n_pdds; i++) {
875 struct kfd_process_device *pdd = target->pdds[i];
896 int kfd_dbg_trap_query_exception_info(struct kfd_process *target,
908 if (!target)
914 mutex_lock(&target->event_mutex);
921 for (i = 0; i < target->n_pdds; i++) {
922 struct kfd_process_device *pdd = target->pdds[i];
950 for (i = 0; i < target->n_pdds; i++) {
951 pdd = target->pdds[i];
985 if (!(target->exception_status & KFD_EC_MASK(exception_code))) {
991 copy_size = min((size_t)(*info_size), sizeof(target->runtime_info));
993 if (copy_to_user(info, (void *)&target->runtime_info, copy_size)) {
998 actual_info_size = sizeof(target->runtime_info);
1001 exception_status_ptr = &target->exception_status;
1012 mutex_unlock(&target->event_mutex);
1016 int kfd_dbg_trap_device_snapshot(struct kfd_process *target,
1026 if (!(target && user_info && number_of_device_infos && entry_size))
1029 tmp_num_devices = min_t(size_t, *number_of_device_infos, target->n_pdds);
1030 *number_of_device_infos = target->n_pdds;
1038 mutex_lock(&target->event_mutex);
1042 struct kfd_process_device *pdd = target->pdds[i];
1083 mutex_unlock(&target->event_mutex);
1088 void kfd_dbg_set_enabled_debug_exception_mask(struct kfd_process *target,
1098 mutex_lock(&target->event_mutex);
1100 found_mask |= target->exception_status;
1102 pqm = &target->pqm;
1110 for (i = 0; i < target->n_pdds; i++) {
1111 struct kfd_process_device *pdd = target->pdds[i];
1117 kernel_write(target->dbg_ev_file, &write_data, 1, &pos);
1119 target->exception_enable_mask = exception_set_mask;
1121 mutex_unlock(&target->event_mutex);