Lines Matching full:vcpu
56 STATS_DESC_COUNTER(VCPU, wait_exits),
57 STATS_DESC_COUNTER(VCPU, cache_exits),
58 STATS_DESC_COUNTER(VCPU, signal_exits),
59 STATS_DESC_COUNTER(VCPU, int_exits),
60 STATS_DESC_COUNTER(VCPU, cop_unusable_exits),
61 STATS_DESC_COUNTER(VCPU, tlbmod_exits),
62 STATS_DESC_COUNTER(VCPU, tlbmiss_ld_exits),
63 STATS_DESC_COUNTER(VCPU, tlbmiss_st_exits),
64 STATS_DESC_COUNTER(VCPU, addrerr_st_exits),
65 STATS_DESC_COUNTER(VCPU, addrerr_ld_exits),
66 STATS_DESC_COUNTER(VCPU, syscall_exits),
67 STATS_DESC_COUNTER(VCPU, resvd_inst_exits),
68 STATS_DESC_COUNTER(VCPU, break_inst_exits),
69 STATS_DESC_COUNTER(VCPU, trap_inst_exits),
70 STATS_DESC_COUNTER(VCPU, msa_fpe_exits),
71 STATS_DESC_COUNTER(VCPU, fpe_exits),
72 STATS_DESC_COUNTER(VCPU, msa_disabled_exits),
73 STATS_DESC_COUNTER(VCPU, flush_dcache_exits),
74 STATS_DESC_COUNTER(VCPU, vz_gpsi_exits),
75 STATS_DESC_COUNTER(VCPU, vz_gsfc_exits),
76 STATS_DESC_COUNTER(VCPU, vz_hc_exits),
77 STATS_DESC_COUNTER(VCPU, vz_grr_exits),
78 STATS_DESC_COUNTER(VCPU, vz_gva_exits),
79 STATS_DESC_COUNTER(VCPU, vz_ghfc_exits),
80 STATS_DESC_COUNTER(VCPU, vz_gpa_exits),
81 STATS_DESC_COUNTER(VCPU, vz_resvd_exits),
83 STATS_DESC_COUNTER(VCPU, vz_cpucfg_exits),
113 int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) in kvm_arch_vcpu_runnable() argument
115 return !!(vcpu->arch.pending_exceptions); in kvm_arch_vcpu_runnable()
118 bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu) in kvm_arch_vcpu_in_kernel() argument
123 int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu) in kvm_arch_vcpu_should_kick() argument
261 struct kvm_vcpu *vcpu; in kvm_mips_comparecount_wakeup() local
263 vcpu = container_of(timer, struct kvm_vcpu, arch.comparecount_timer); in kvm_mips_comparecount_wakeup()
265 kvm_mips_callbacks->queue_timer_int(vcpu); in kvm_mips_comparecount_wakeup()
267 vcpu->arch.wait = 0; in kvm_mips_comparecount_wakeup()
268 rcuwait_wake_up(&vcpu->wait); in kvm_mips_comparecount_wakeup()
270 return kvm_mips_count_timeout(vcpu); in kvm_mips_comparecount_wakeup()
278 int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu) in kvm_arch_vcpu_create() argument
285 vcpu->kvm, vcpu->vcpu_id, vcpu); in kvm_arch_vcpu_create()
287 err = kvm_mips_callbacks->vcpu_init(vcpu); in kvm_arch_vcpu_create()
291 hrtimer_setup(&vcpu->arch.comparecount_timer, kvm_mips_comparecount_wakeup, CLOCK_MONOTONIC, in kvm_arch_vcpu_create()
325 vcpu->arch.guest_ebase = gebase; in kvm_arch_vcpu_create()
352 vcpu->arch.vcpu_run = p; in kvm_arch_vcpu_create()
359 dump_handler("kvm_vcpu_run", vcpu->arch.vcpu_run, p); in kvm_arch_vcpu_create()
362 dump_handler("kvm_exit", gebase + 0x2000, vcpu->arch.vcpu_run); in kvm_arch_vcpu_create()
369 vcpu->arch.last_sched_cpu = -1; in kvm_arch_vcpu_create()
370 vcpu->arch.last_exec_cpu = -1; in kvm_arch_vcpu_create()
373 err = kvm_mips_callbacks->vcpu_setup(vcpu); in kvm_arch_vcpu_create()
382 kvm_mips_callbacks->vcpu_uninit(vcpu); in kvm_arch_vcpu_create()
386 void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) in kvm_arch_vcpu_destroy() argument
388 hrtimer_cancel(&vcpu->arch.comparecount_timer); in kvm_arch_vcpu_destroy()
390 kvm_mips_dump_stats(vcpu); in kvm_arch_vcpu_destroy()
392 kvm_mmu_free_memory_caches(vcpu); in kvm_arch_vcpu_destroy()
393 kfree(vcpu->arch.guest_ebase); in kvm_arch_vcpu_destroy()
395 kvm_mips_callbacks->vcpu_uninit(vcpu); in kvm_arch_vcpu_destroy()
398 int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu, in kvm_arch_vcpu_ioctl_set_guest_debug() argument
405 * Actually run the vCPU, entering an RCU extended quiescent state (EQS) while
406 * the vCPU is running.
411 static int noinstr kvm_mips_vcpu_enter_exit(struct kvm_vcpu *vcpu) in kvm_mips_vcpu_enter_exit() argument
416 ret = kvm_mips_callbacks->vcpu_run(vcpu); in kvm_mips_vcpu_enter_exit()
422 int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) in kvm_arch_vcpu_ioctl_run() argument
426 vcpu_load(vcpu); in kvm_arch_vcpu_ioctl_run()
428 kvm_sigset_activate(vcpu); in kvm_arch_vcpu_ioctl_run()
430 if (vcpu->mmio_needed) { in kvm_arch_vcpu_ioctl_run()
431 if (!vcpu->mmio_is_write) in kvm_arch_vcpu_ioctl_run()
432 kvm_mips_complete_mmio_load(vcpu); in kvm_arch_vcpu_ioctl_run()
433 vcpu->mmio_needed = 0; in kvm_arch_vcpu_ioctl_run()
436 if (!vcpu->wants_to_run) in kvm_arch_vcpu_ioctl_run()
443 trace_kvm_enter(vcpu); in kvm_arch_vcpu_ioctl_run()
446 * Make sure the read of VCPU requests in vcpu_run() callback is not in kvm_arch_vcpu_ioctl_run()
447 * reordered ahead of the write to vcpu->mode, or we could miss a TLB in kvm_arch_vcpu_ioctl_run()
448 * flush request while the requester sees the VCPU as outside of guest in kvm_arch_vcpu_ioctl_run()
451 smp_store_mb(vcpu->mode, IN_GUEST_MODE); in kvm_arch_vcpu_ioctl_run()
453 r = kvm_mips_vcpu_enter_exit(vcpu); in kvm_arch_vcpu_ioctl_run()
468 trace_kvm_out(vcpu); in kvm_arch_vcpu_ioctl_run()
473 kvm_sigset_deactivate(vcpu); in kvm_arch_vcpu_ioctl_run()
475 vcpu_put(vcpu); in kvm_arch_vcpu_ioctl_run()
479 int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, in kvm_vcpu_ioctl_interrupt() argument
493 dvcpu = vcpu; in kvm_vcpu_ioctl_interrupt()
495 dvcpu = kvm_get_vcpu(vcpu->kvm, irq->cpu); in kvm_vcpu_ioctl_interrupt()
515 int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu, in kvm_arch_vcpu_ioctl_get_mpstate() argument
521 int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu, in kvm_arch_vcpu_ioctl_set_mpstate() argument
578 static unsigned long kvm_mips_num_regs(struct kvm_vcpu *vcpu) in kvm_mips_num_regs() argument
583 if (kvm_mips_guest_can_have_fpu(&vcpu->arch)) { in kvm_mips_num_regs()
589 if (kvm_mips_guest_can_have_msa(&vcpu->arch)) in kvm_mips_num_regs()
591 ret += kvm_mips_callbacks->num_regs(vcpu); in kvm_mips_num_regs()
596 static int kvm_mips_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices) in kvm_mips_copy_reg_indices() argument
606 if (kvm_mips_guest_can_have_fpu(&vcpu->arch)) { in kvm_mips_copy_reg_indices()
629 if (kvm_mips_guest_can_have_msa(&vcpu->arch)) { in kvm_mips_copy_reg_indices()
643 return kvm_mips_callbacks->copy_reg_indices(vcpu, indices); in kvm_mips_copy_reg_indices()
646 static int kvm_mips_get_reg(struct kvm_vcpu *vcpu, in kvm_mips_get_reg() argument
649 struct mips_coproc *cop0 = &vcpu->arch.cop0; in kvm_mips_get_reg()
650 struct mips_fpu_struct *fpu = &vcpu->arch.fpu; in kvm_mips_get_reg()
659 v = (long)vcpu->arch.gprs[reg->id - KVM_REG_MIPS_R0]; in kvm_mips_get_reg()
663 v = (long)vcpu->arch.hi; in kvm_mips_get_reg()
666 v = (long)vcpu->arch.lo; in kvm_mips_get_reg()
670 v = (long)vcpu->arch.pc; in kvm_mips_get_reg()
675 if (!kvm_mips_guest_has_fpu(&vcpu->arch)) in kvm_mips_get_reg()
685 if (!kvm_mips_guest_has_fpu(&vcpu->arch)) in kvm_mips_get_reg()
694 if (!kvm_mips_guest_has_fpu(&vcpu->arch)) in kvm_mips_get_reg()
699 if (!kvm_mips_guest_has_fpu(&vcpu->arch)) in kvm_mips_get_reg()
706 if (!kvm_mips_guest_has_msa(&vcpu->arch)) in kvm_mips_get_reg()
723 if (!kvm_mips_guest_has_msa(&vcpu->arch)) in kvm_mips_get_reg()
728 if (!kvm_mips_guest_has_msa(&vcpu->arch)) in kvm_mips_get_reg()
735 ret = kvm_mips_callbacks->get_one_reg(vcpu, reg, &v); in kvm_mips_get_reg()
758 static int kvm_mips_set_reg(struct kvm_vcpu *vcpu, in kvm_mips_set_reg() argument
761 struct mips_coproc *cop0 = &vcpu->arch.cop0; in kvm_mips_set_reg()
762 struct mips_fpu_struct *fpu = &vcpu->arch.fpu; in kvm_mips_set_reg()
793 vcpu->arch.gprs[reg->id - KVM_REG_MIPS_R0] = v; in kvm_mips_set_reg()
797 vcpu->arch.hi = v; in kvm_mips_set_reg()
800 vcpu->arch.lo = v; in kvm_mips_set_reg()
804 vcpu->arch.pc = v; in kvm_mips_set_reg()
809 if (!kvm_mips_guest_has_fpu(&vcpu->arch)) in kvm_mips_set_reg()
819 if (!kvm_mips_guest_has_fpu(&vcpu->arch)) in kvm_mips_set_reg()
828 if (!kvm_mips_guest_has_fpu(&vcpu->arch)) in kvm_mips_set_reg()
833 if (!kvm_mips_guest_has_fpu(&vcpu->arch)) in kvm_mips_set_reg()
840 if (!kvm_mips_guest_has_msa(&vcpu->arch)) in kvm_mips_set_reg()
854 if (!kvm_mips_guest_has_msa(&vcpu->arch)) in kvm_mips_set_reg()
859 if (!kvm_mips_guest_has_msa(&vcpu->arch)) in kvm_mips_set_reg()
866 return kvm_mips_callbacks->set_one_reg(vcpu, reg, v); in kvm_mips_set_reg()
871 static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu, in kvm_vcpu_ioctl_enable_cap() argument
876 if (!kvm_vm_ioctl_check_extension(vcpu->kvm, cap->cap)) in kvm_vcpu_ioctl_enable_cap()
885 vcpu->arch.fpu_enabled = true; in kvm_vcpu_ioctl_enable_cap()
888 vcpu->arch.msa_enabled = true; in kvm_vcpu_ioctl_enable_cap()
901 struct kvm_vcpu *vcpu = filp->private_data; in kvm_arch_vcpu_unlocked_ioctl() local
909 kvm_debug("[%d] %s: irq: %d\n", vcpu->vcpu_id, __func__, in kvm_arch_vcpu_unlocked_ioctl()
912 return kvm_vcpu_ioctl_interrupt(vcpu, &irq); in kvm_arch_vcpu_unlocked_ioctl()
921 struct kvm_vcpu *vcpu = filp->private_data; in kvm_arch_vcpu_ioctl() local
925 vcpu_load(vcpu); in kvm_arch_vcpu_ioctl()
936 r = kvm_mips_set_reg(vcpu, ®); in kvm_arch_vcpu_ioctl()
938 r = kvm_mips_get_reg(vcpu, ®); in kvm_arch_vcpu_ioctl()
950 reg_list.n = kvm_mips_num_regs(vcpu); in kvm_arch_vcpu_ioctl()
956 r = kvm_mips_copy_reg_indices(vcpu, user_list->reg); in kvm_arch_vcpu_ioctl()
965 r = kvm_vcpu_ioctl_enable_cap(vcpu, &cap); in kvm_arch_vcpu_ioctl()
972 vcpu_put(vcpu); in kvm_arch_vcpu_ioctl()
999 int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu, in kvm_arch_vcpu_ioctl_get_sregs() argument
1005 int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, in kvm_arch_vcpu_ioctl_set_sregs() argument
1011 void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu) in kvm_arch_vcpu_postcreate() argument
1015 int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) in kvm_arch_vcpu_ioctl_get_fpu() argument
1020 int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) in kvm_arch_vcpu_ioctl_set_fpu() argument
1025 vm_fault_t kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf) in kvm_arch_vcpu_fault() argument
1076 int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu) in kvm_cpu_has_pending_timer() argument
1078 return kvm_mips_pending_timer(vcpu) || in kvm_cpu_has_pending_timer()
1079 kvm_read_c0_guest_cause(&vcpu->arch.cop0) & C_TI; in kvm_cpu_has_pending_timer()
1082 int kvm_arch_vcpu_dump_regs(struct kvm_vcpu *vcpu) in kvm_arch_vcpu_dump_regs() argument
1087 if (!vcpu) in kvm_arch_vcpu_dump_regs()
1090 kvm_debug("VCPU Register Dump:\n"); in kvm_arch_vcpu_dump_regs()
1091 kvm_debug("\tpc = 0x%08lx\n", vcpu->arch.pc); in kvm_arch_vcpu_dump_regs()
1092 kvm_debug("\texceptions: %08lx\n", vcpu->arch.pending_exceptions); in kvm_arch_vcpu_dump_regs()
1096 vcpu->arch.gprs[i], in kvm_arch_vcpu_dump_regs()
1097 vcpu->arch.gprs[i + 1], in kvm_arch_vcpu_dump_regs()
1098 vcpu->arch.gprs[i + 2], vcpu->arch.gprs[i + 3]); in kvm_arch_vcpu_dump_regs()
1100 kvm_debug("\thi: 0x%08lx\n", vcpu->arch.hi); in kvm_arch_vcpu_dump_regs()
1101 kvm_debug("\tlo: 0x%08lx\n", vcpu->arch.lo); in kvm_arch_vcpu_dump_regs()
1103 cop0 = &vcpu->arch.cop0; in kvm_arch_vcpu_dump_regs()
1113 int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) in kvm_arch_vcpu_ioctl_set_regs() argument
1117 vcpu_load(vcpu); in kvm_arch_vcpu_ioctl_set_regs()
1119 for (i = 1; i < ARRAY_SIZE(vcpu->arch.gprs); i++) in kvm_arch_vcpu_ioctl_set_regs()
1120 vcpu->arch.gprs[i] = regs->gpr[i]; in kvm_arch_vcpu_ioctl_set_regs()
1121 vcpu->arch.gprs[0] = 0; /* zero is special, and cannot be set. */ in kvm_arch_vcpu_ioctl_set_regs()
1122 vcpu->arch.hi = regs->hi; in kvm_arch_vcpu_ioctl_set_regs()
1123 vcpu->arch.lo = regs->lo; in kvm_arch_vcpu_ioctl_set_regs()
1124 vcpu->arch.pc = regs->pc; in kvm_arch_vcpu_ioctl_set_regs()
1126 vcpu_put(vcpu); in kvm_arch_vcpu_ioctl_set_regs()
1130 int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) in kvm_arch_vcpu_ioctl_get_regs() argument
1134 vcpu_load(vcpu); in kvm_arch_vcpu_ioctl_get_regs()
1136 for (i = 0; i < ARRAY_SIZE(vcpu->arch.gprs); i++) in kvm_arch_vcpu_ioctl_get_regs()
1137 regs->gpr[i] = vcpu->arch.gprs[i]; in kvm_arch_vcpu_ioctl_get_regs()
1139 regs->hi = vcpu->arch.hi; in kvm_arch_vcpu_ioctl_get_regs()
1140 regs->lo = vcpu->arch.lo; in kvm_arch_vcpu_ioctl_get_regs()
1141 regs->pc = vcpu->arch.pc; in kvm_arch_vcpu_ioctl_get_regs()
1143 vcpu_put(vcpu); in kvm_arch_vcpu_ioctl_get_regs()
1147 int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu, in kvm_arch_vcpu_ioctl_translate() argument
1167 static int __kvm_mips_handle_exit(struct kvm_vcpu *vcpu) in __kvm_mips_handle_exit() argument
1169 struct kvm_run *run = vcpu->run; in __kvm_mips_handle_exit()
1170 u32 cause = vcpu->arch.host_cp0_cause; in __kvm_mips_handle_exit()
1172 u32 __user *opc = (u32 __user *) vcpu->arch.pc; in __kvm_mips_handle_exit()
1173 unsigned long badvaddr = vcpu->arch.host_cp0_badvaddr; in __kvm_mips_handle_exit()
1178 vcpu->mode = OUTSIDE_GUEST_MODE; in __kvm_mips_handle_exit()
1193 cause, opc, run, vcpu); in __kvm_mips_handle_exit()
1194 trace_kvm_exit(vcpu, exccode); in __kvm_mips_handle_exit()
1198 kvm_debug("[%d]EXCCODE_INT @ %p\n", vcpu->vcpu_id, opc); in __kvm_mips_handle_exit()
1200 ++vcpu->stat.int_exits; in __kvm_mips_handle_exit()
1211 ++vcpu->stat.cop_unusable_exits; in __kvm_mips_handle_exit()
1212 ret = kvm_mips_callbacks->handle_cop_unusable(vcpu); in __kvm_mips_handle_exit()
1219 ++vcpu->stat.tlbmod_exits; in __kvm_mips_handle_exit()
1220 ret = kvm_mips_callbacks->handle_tlb_mod(vcpu); in __kvm_mips_handle_exit()
1225 cause, kvm_read_c0_guest_status(&vcpu->arch.cop0), opc, in __kvm_mips_handle_exit()
1228 ++vcpu->stat.tlbmiss_st_exits; in __kvm_mips_handle_exit()
1229 ret = kvm_mips_callbacks->handle_tlb_st_miss(vcpu); in __kvm_mips_handle_exit()
1236 ++vcpu->stat.tlbmiss_ld_exits; in __kvm_mips_handle_exit()
1237 ret = kvm_mips_callbacks->handle_tlb_ld_miss(vcpu); in __kvm_mips_handle_exit()
1241 ++vcpu->stat.addrerr_st_exits; in __kvm_mips_handle_exit()
1242 ret = kvm_mips_callbacks->handle_addr_err_st(vcpu); in __kvm_mips_handle_exit()
1246 ++vcpu->stat.addrerr_ld_exits; in __kvm_mips_handle_exit()
1247 ret = kvm_mips_callbacks->handle_addr_err_ld(vcpu); in __kvm_mips_handle_exit()
1251 ++vcpu->stat.syscall_exits; in __kvm_mips_handle_exit()
1252 ret = kvm_mips_callbacks->handle_syscall(vcpu); in __kvm_mips_handle_exit()
1256 ++vcpu->stat.resvd_inst_exits; in __kvm_mips_handle_exit()
1257 ret = kvm_mips_callbacks->handle_res_inst(vcpu); in __kvm_mips_handle_exit()
1261 ++vcpu->stat.break_inst_exits; in __kvm_mips_handle_exit()
1262 ret = kvm_mips_callbacks->handle_break(vcpu); in __kvm_mips_handle_exit()
1266 ++vcpu->stat.trap_inst_exits; in __kvm_mips_handle_exit()
1267 ret = kvm_mips_callbacks->handle_trap(vcpu); in __kvm_mips_handle_exit()
1271 ++vcpu->stat.msa_fpe_exits; in __kvm_mips_handle_exit()
1272 ret = kvm_mips_callbacks->handle_msa_fpe(vcpu); in __kvm_mips_handle_exit()
1276 ++vcpu->stat.fpe_exits; in __kvm_mips_handle_exit()
1277 ret = kvm_mips_callbacks->handle_fpe(vcpu); in __kvm_mips_handle_exit()
1281 ++vcpu->stat.msa_disabled_exits; in __kvm_mips_handle_exit()
1282 ret = kvm_mips_callbacks->handle_msa_disabled(vcpu); in __kvm_mips_handle_exit()
1287 ret = kvm_mips_callbacks->handle_guest_exit(vcpu); in __kvm_mips_handle_exit()
1294 kvm_get_badinstr(opc, vcpu, &inst); in __kvm_mips_handle_exit()
1297 kvm_read_c0_guest_status(&vcpu->arch.cop0)); in __kvm_mips_handle_exit()
1298 kvm_arch_vcpu_dump_regs(vcpu); in __kvm_mips_handle_exit()
1308 kvm_vz_acquire_htimer(vcpu); in __kvm_mips_handle_exit()
1311 kvm_mips_deliver_interrupts(vcpu, cause); in __kvm_mips_handle_exit()
1318 ++vcpu->stat.signal_exits; in __kvm_mips_handle_exit()
1319 trace_kvm_exit(vcpu, KVM_TRACE_EXIT_SIGNAL); in __kvm_mips_handle_exit()
1324 trace_kvm_reenter(vcpu); in __kvm_mips_handle_exit()
1327 * Make sure the read of VCPU requests in vcpu_reenter() in __kvm_mips_handle_exit()
1328 * callback is not reordered ahead of the write to vcpu->mode, in __kvm_mips_handle_exit()
1330 * the VCPU as outside of guest mode and not needing an IPI. in __kvm_mips_handle_exit()
1332 smp_store_mb(vcpu->mode, IN_GUEST_MODE); in __kvm_mips_handle_exit()
1334 kvm_mips_callbacks->vcpu_reenter(vcpu); in __kvm_mips_handle_exit()
1345 if (kvm_mips_guest_has_fpu(&vcpu->arch) && in __kvm_mips_handle_exit()
1347 __kvm_restore_fcsr(&vcpu->arch); in __kvm_mips_handle_exit()
1349 if (kvm_mips_guest_has_msa(&vcpu->arch) && in __kvm_mips_handle_exit()
1351 __kvm_restore_msacsr(&vcpu->arch); in __kvm_mips_handle_exit()
1356 int noinstr kvm_mips_handle_exit(struct kvm_vcpu *vcpu) in kvm_mips_handle_exit() argument
1361 ret = __kvm_mips_handle_exit(vcpu); in kvm_mips_handle_exit()
1368 void kvm_own_fpu(struct kvm_vcpu *vcpu) in kvm_own_fpu() argument
1370 struct mips_coproc *cop0 = &vcpu->arch.cop0; in kvm_own_fpu()
1384 vcpu->arch.aux_inuse & KVM_MIPS_AUX_MSA) in kvm_own_fpu()
1385 kvm_lose_fpu(vcpu); in kvm_own_fpu()
1399 if (!(vcpu->arch.aux_inuse & KVM_MIPS_AUX_FPU)) { in kvm_own_fpu()
1400 __kvm_restore_fpu(&vcpu->arch); in kvm_own_fpu()
1401 vcpu->arch.aux_inuse |= KVM_MIPS_AUX_FPU; in kvm_own_fpu()
1402 trace_kvm_aux(vcpu, KVM_TRACE_AUX_RESTORE, KVM_TRACE_AUX_FPU); in kvm_own_fpu()
1404 trace_kvm_aux(vcpu, KVM_TRACE_AUX_ENABLE, KVM_TRACE_AUX_FPU); in kvm_own_fpu()
1412 void kvm_own_msa(struct kvm_vcpu *vcpu) in kvm_own_msa() argument
1414 struct mips_coproc *cop0 = &vcpu->arch.cop0; in kvm_own_msa()
1423 if (kvm_mips_guest_has_fpu(&vcpu->arch)) { in kvm_own_msa()
1431 (vcpu->arch.aux_inuse & (KVM_MIPS_AUX_FPU | in kvm_own_msa()
1433 kvm_lose_fpu(vcpu); in kvm_own_msa()
1446 switch (vcpu->arch.aux_inuse & (KVM_MIPS_AUX_FPU | KVM_MIPS_AUX_MSA)) { in kvm_own_msa()
1451 __kvm_restore_msa_upper(&vcpu->arch); in kvm_own_msa()
1452 vcpu->arch.aux_inuse |= KVM_MIPS_AUX_MSA; in kvm_own_msa()
1453 trace_kvm_aux(vcpu, KVM_TRACE_AUX_RESTORE, KVM_TRACE_AUX_MSA); in kvm_own_msa()
1457 __kvm_restore_msa(&vcpu->arch); in kvm_own_msa()
1458 vcpu->arch.aux_inuse |= KVM_MIPS_AUX_MSA; in kvm_own_msa()
1459 if (kvm_mips_guest_has_fpu(&vcpu->arch)) in kvm_own_msa()
1460 vcpu->arch.aux_inuse |= KVM_MIPS_AUX_FPU; in kvm_own_msa()
1461 trace_kvm_aux(vcpu, KVM_TRACE_AUX_RESTORE, in kvm_own_msa()
1465 trace_kvm_aux(vcpu, KVM_TRACE_AUX_ENABLE, KVM_TRACE_AUX_MSA); in kvm_own_msa()
1474 void kvm_drop_fpu(struct kvm_vcpu *vcpu) in kvm_drop_fpu() argument
1477 if (cpu_has_msa && vcpu->arch.aux_inuse & KVM_MIPS_AUX_MSA) { in kvm_drop_fpu()
1479 trace_kvm_aux(vcpu, KVM_TRACE_AUX_DISCARD, KVM_TRACE_AUX_MSA); in kvm_drop_fpu()
1480 vcpu->arch.aux_inuse &= ~KVM_MIPS_AUX_MSA; in kvm_drop_fpu()
1482 if (vcpu->arch.aux_inuse & KVM_MIPS_AUX_FPU) { in kvm_drop_fpu()
1484 trace_kvm_aux(vcpu, KVM_TRACE_AUX_DISCARD, KVM_TRACE_AUX_FPU); in kvm_drop_fpu()
1485 vcpu->arch.aux_inuse &= ~KVM_MIPS_AUX_FPU; in kvm_drop_fpu()
1491 void kvm_lose_fpu(struct kvm_vcpu *vcpu) in kvm_lose_fpu() argument
1501 if (cpu_has_msa && vcpu->arch.aux_inuse & KVM_MIPS_AUX_MSA) { in kvm_lose_fpu()
1502 __kvm_save_msa(&vcpu->arch); in kvm_lose_fpu()
1503 trace_kvm_aux(vcpu, KVM_TRACE_AUX_SAVE, KVM_TRACE_AUX_FPU_MSA); in kvm_lose_fpu()
1507 if (vcpu->arch.aux_inuse & KVM_MIPS_AUX_FPU) { in kvm_lose_fpu()
1511 vcpu->arch.aux_inuse &= ~(KVM_MIPS_AUX_FPU | KVM_MIPS_AUX_MSA); in kvm_lose_fpu()
1512 } else if (vcpu->arch.aux_inuse & KVM_MIPS_AUX_FPU) { in kvm_lose_fpu()
1513 __kvm_save_fpu(&vcpu->arch); in kvm_lose_fpu()
1514 vcpu->arch.aux_inuse &= ~KVM_MIPS_AUX_FPU; in kvm_lose_fpu()
1515 trace_kvm_aux(vcpu, KVM_TRACE_AUX_SAVE, KVM_TRACE_AUX_FPU); in kvm_lose_fpu()