Lines Matching full:vcpu

40 static int kvm_compute_return_epc(struct kvm_vcpu *vcpu, unsigned long instpc,  in kvm_compute_return_epc()  argument
45 struct kvm_vcpu_arch *arch = &vcpu->arch; in kvm_compute_return_epc()
56 err = kvm_get_badinstrp((u32 *)epc, vcpu, &insn.word); in kvm_compute_return_epc()
243 enum emulation_result update_pc(struct kvm_vcpu *vcpu, u32 cause) in update_pc() argument
248 err = kvm_compute_return_epc(vcpu, vcpu->arch.pc, in update_pc()
249 &vcpu->arch.pc); in update_pc()
253 vcpu->arch.pc += 4; in update_pc()
256 kvm_debug("update_pc(): New PC: %#lx\n", vcpu->arch.pc); in update_pc()
264 * @vcpu: KVM VCPU information.
272 int kvm_get_badinstr(u32 *opc, struct kvm_vcpu *vcpu, u32 *out) in kvm_get_badinstr() argument
275 *out = vcpu->arch.host_cp0_badinstr; in kvm_get_badinstr()
286 * @vcpu: KVM VCPU information.
294 int kvm_get_badinstrp(u32 *opc, struct kvm_vcpu *vcpu, u32 *out) in kvm_get_badinstrp() argument
297 *out = vcpu->arch.host_cp0_badinstrp; in kvm_get_badinstrp()
307 * @vcpu: Virtual CPU.
313 int kvm_mips_count_disabled(struct kvm_vcpu *vcpu) in kvm_mips_count_disabled() argument
315 struct mips_coproc *cop0 = &vcpu->arch.cop0; in kvm_mips_count_disabled()
317 return (vcpu->arch.count_ctl & KVM_REG_MIPS_COUNT_CTL_DC) || in kvm_mips_count_disabled()
324 * Caches the dynamic nanosecond bias in vcpu->arch.count_dyn_bias.
326 * Assumes !kvm_mips_count_disabled(@vcpu) (guest CP0_Count timer is running).
328 static u32 kvm_mips_ktime_to_count(struct kvm_vcpu *vcpu, ktime_t now) in kvm_mips_ktime_to_count() argument
334 delta = now_ns + vcpu->arch.count_dyn_bias; in kvm_mips_ktime_to_count()
336 if (delta >= vcpu->arch.count_period) { in kvm_mips_ktime_to_count()
338 periods = div64_s64(now_ns, vcpu->arch.count_period); in kvm_mips_ktime_to_count()
339 vcpu->arch.count_dyn_bias = -periods * vcpu->arch.count_period; in kvm_mips_ktime_to_count()
341 delta = now_ns + vcpu->arch.count_dyn_bias; in kvm_mips_ktime_to_count()
354 return div_u64(delta * vcpu->arch.count_hz, NSEC_PER_SEC); in kvm_mips_ktime_to_count()
359 * @vcpu: Virtual CPU.
367 static inline ktime_t kvm_mips_count_time(struct kvm_vcpu *vcpu) in kvm_mips_count_time() argument
369 if (unlikely(vcpu->arch.count_ctl & KVM_REG_MIPS_COUNT_CTL_DC)) in kvm_mips_count_time()
370 return vcpu->arch.count_resume; in kvm_mips_count_time()
377 * @vcpu: Virtual CPU.
385 static u32 kvm_mips_read_count_running(struct kvm_vcpu *vcpu, ktime_t now) in kvm_mips_read_count_running() argument
387 struct mips_coproc *cop0 = &vcpu->arch.cop0; in kvm_mips_read_count_running()
393 count = vcpu->arch.count_bias + kvm_mips_ktime_to_count(vcpu, now); in kvm_mips_read_count_running()
409 expires = hrtimer_get_expires(&vcpu->arch.comparecount_timer); in kvm_mips_read_count_running()
410 threshold = ktime_add_ns(now, vcpu->arch.count_period / 4); in kvm_mips_read_count_running()
416 running = hrtimer_cancel(&vcpu->arch.comparecount_timer); in kvm_mips_read_count_running()
419 kvm_mips_callbacks->queue_timer_int(vcpu); in kvm_mips_read_count_running()
427 vcpu->arch.count_period); in kvm_mips_read_count_running()
428 hrtimer_start(&vcpu->arch.comparecount_timer, expires, in kvm_mips_read_count_running()
438 * @vcpu: Virtual CPU.
445 u32 kvm_mips_read_count(struct kvm_vcpu *vcpu) in kvm_mips_read_count() argument
447 struct mips_coproc *cop0 = &vcpu->arch.cop0; in kvm_mips_read_count()
450 if (kvm_mips_count_disabled(vcpu)) in kvm_mips_read_count()
453 return kvm_mips_read_count_running(vcpu, ktime_get()); in kvm_mips_read_count()
458 * @vcpu: Virtual CPU.
468 * Assumes !kvm_mips_count_disabled(@vcpu) (guest CP0_Count timer is running).
472 ktime_t kvm_mips_freeze_hrtimer(struct kvm_vcpu *vcpu, u32 *count) in kvm_mips_freeze_hrtimer() argument
477 hrtimer_cancel(&vcpu->arch.comparecount_timer); in kvm_mips_freeze_hrtimer()
481 *count = kvm_mips_read_count_running(vcpu, now); in kvm_mips_freeze_hrtimer()
488 * @vcpu: Virtual CPU.
500 * Assumes !kvm_mips_count_disabled(@vcpu) (guest CP0_Count timer is running).
502 static void kvm_mips_resume_hrtimer(struct kvm_vcpu *vcpu, in kvm_mips_resume_hrtimer() argument
505 struct mips_coproc *cop0 = &vcpu->arch.cop0; in kvm_mips_resume_hrtimer()
513 delta = div_u64(delta * NSEC_PER_SEC, vcpu->arch.count_hz); in kvm_mips_resume_hrtimer()
517 hrtimer_cancel(&vcpu->arch.comparecount_timer); in kvm_mips_resume_hrtimer()
518 hrtimer_start(&vcpu->arch.comparecount_timer, expire, HRTIMER_MODE_ABS); in kvm_mips_resume_hrtimer()
523 * @vcpu: Virtual CPU.
538 * Assumes !kvm_mips_count_disabled(@vcpu) (guest CP0_Count timer is not
543 int kvm_mips_restore_hrtimer(struct kvm_vcpu *vcpu, ktime_t before, in kvm_mips_restore_hrtimer() argument
552 before_count = vcpu->arch.count_bias + in kvm_mips_restore_hrtimer()
553 kvm_mips_ktime_to_count(vcpu, before); in kvm_mips_restore_hrtimer()
565 vcpu->arch.count_bias += drift; in kvm_mips_restore_hrtimer()
572 now_count = vcpu->arch.count_bias + kvm_mips_ktime_to_count(vcpu, now); in kvm_mips_restore_hrtimer()
581 vcpu->arch.count_bias += drift; in kvm_mips_restore_hrtimer()
588 delta = div_u64(delta * NSEC_PER_SEC, vcpu->arch.count_hz); in kvm_mips_restore_hrtimer()
593 kvm_mips_resume_hrtimer(vcpu, count_time, count); in kvm_mips_restore_hrtimer()
599 * @vcpu: Virtual CPU.
604 void kvm_mips_write_count(struct kvm_vcpu *vcpu, u32 count) in kvm_mips_write_count() argument
606 struct mips_coproc *cop0 = &vcpu->arch.cop0; in kvm_mips_write_count()
610 now = kvm_mips_count_time(vcpu); in kvm_mips_write_count()
611 vcpu->arch.count_bias = count - kvm_mips_ktime_to_count(vcpu, now); in kvm_mips_write_count()
613 if (kvm_mips_count_disabled(vcpu)) in kvm_mips_write_count()
618 kvm_mips_resume_hrtimer(vcpu, now, count); in kvm_mips_write_count()
623 * @vcpu: Virtual CPU.
629 void kvm_mips_init_count(struct kvm_vcpu *vcpu, unsigned long count_hz) in kvm_mips_init_count() argument
631 vcpu->arch.count_hz = count_hz; in kvm_mips_init_count()
632 vcpu->arch.count_period = div_u64((u64)NSEC_PER_SEC << 32, count_hz); in kvm_mips_init_count()
633 vcpu->arch.count_dyn_bias = 0; in kvm_mips_init_count()
636 kvm_mips_write_count(vcpu, 0); in kvm_mips_init_count()
641 * @vcpu: Virtual CPU.
650 int kvm_mips_set_count_hz(struct kvm_vcpu *vcpu, s64 count_hz) in kvm_mips_set_count_hz() argument
652 struct mips_coproc *cop0 = &vcpu->arch.cop0; in kvm_mips_set_count_hz()
661 if (vcpu->arch.count_hz == count_hz) in kvm_mips_set_count_hz()
665 dc = kvm_mips_count_disabled(vcpu); in kvm_mips_set_count_hz()
667 now = kvm_mips_count_time(vcpu); in kvm_mips_set_count_hz()
670 now = kvm_mips_freeze_hrtimer(vcpu, &count); in kvm_mips_set_count_hz()
674 vcpu->arch.count_hz = count_hz; in kvm_mips_set_count_hz()
675 vcpu->arch.count_period = div_u64((u64)NSEC_PER_SEC << 32, count_hz); in kvm_mips_set_count_hz()
676 vcpu->arch.count_dyn_bias = 0; in kvm_mips_set_count_hz()
679 vcpu->arch.count_bias = count - kvm_mips_ktime_to_count(vcpu, now); in kvm_mips_set_count_hz()
683 kvm_mips_resume_hrtimer(vcpu, now, count); in kvm_mips_set_count_hz()
689 * @vcpu: Virtual CPU.
697 void kvm_mips_write_compare(struct kvm_vcpu *vcpu, u32 compare, bool ack) in kvm_mips_write_compare() argument
699 struct mips_coproc *cop0 = &vcpu->arch.cop0; in kvm_mips_write_compare()
711 kvm_mips_callbacks->dequeue_timer_int(vcpu); in kvm_mips_write_compare()
732 dc = kvm_mips_count_disabled(vcpu); in kvm_mips_write_compare()
734 now = kvm_mips_freeze_hrtimer(vcpu, &count); in kvm_mips_write_compare()
737 kvm_mips_callbacks->dequeue_timer_int(vcpu); in kvm_mips_write_compare()
757 kvm_mips_resume_hrtimer(vcpu, now, count); in kvm_mips_write_compare()
770 * @vcpu: Virtual CPU.
780 static ktime_t kvm_mips_count_disable(struct kvm_vcpu *vcpu) in kvm_mips_count_disable() argument
782 struct mips_coproc *cop0 = &vcpu->arch.cop0; in kvm_mips_count_disable()
787 hrtimer_cancel(&vcpu->arch.comparecount_timer); in kvm_mips_count_disable()
791 count = kvm_mips_read_count_running(vcpu, now); in kvm_mips_count_disable()
799 * @vcpu: Virtual CPU.
807 void kvm_mips_count_disable_cause(struct kvm_vcpu *vcpu) in kvm_mips_count_disable_cause() argument
809 struct mips_coproc *cop0 = &vcpu->arch.cop0; in kvm_mips_count_disable_cause()
812 if (!(vcpu->arch.count_ctl & KVM_REG_MIPS_COUNT_CTL_DC)) in kvm_mips_count_disable_cause()
813 kvm_mips_count_disable(vcpu); in kvm_mips_count_disable_cause()
818 * @vcpu: Virtual CPU.
827 void kvm_mips_count_enable_cause(struct kvm_vcpu *vcpu) in kvm_mips_count_enable_cause() argument
829 struct mips_coproc *cop0 = &vcpu->arch.cop0; in kvm_mips_count_enable_cause()
840 kvm_mips_write_count(vcpu, count); in kvm_mips_count_enable_cause()
845 * @vcpu: Virtual CPU.
853 int kvm_mips_set_count_ctl(struct kvm_vcpu *vcpu, s64 count_ctl) in kvm_mips_set_count_ctl() argument
855 struct mips_coproc *cop0 = &vcpu->arch.cop0; in kvm_mips_set_count_ctl()
856 s64 changed = count_ctl ^ vcpu->arch.count_ctl; in kvm_mips_set_count_ctl()
866 vcpu->arch.count_ctl = count_ctl; in kvm_mips_set_count_ctl()
874 vcpu->arch.count_resume = ktime_get(); in kvm_mips_set_count_ctl()
877 vcpu->arch.count_resume = kvm_mips_count_disable(vcpu); in kvm_mips_set_count_ctl()
887 vcpu->arch.count_hz); in kvm_mips_set_count_ctl()
888 expire = ktime_add_ns(vcpu->arch.count_resume, delta); in kvm_mips_set_count_ctl()
894 kvm_mips_callbacks->queue_timer_int(vcpu); in kvm_mips_set_count_ctl()
897 count = kvm_mips_read_count_running(vcpu, now); in kvm_mips_set_count_ctl()
898 kvm_mips_resume_hrtimer(vcpu, now, count); in kvm_mips_set_count_ctl()
907 * @vcpu: Virtual CPU.
915 int kvm_mips_set_count_resume(struct kvm_vcpu *vcpu, s64 count_resume) in kvm_mips_set_count_resume() argument
925 vcpu->arch.count_resume = ns_to_ktime(count_resume); in kvm_mips_set_count_resume()
931 * @vcpu: Virtual CPU.
937 enum hrtimer_restart kvm_mips_count_timeout(struct kvm_vcpu *vcpu) in kvm_mips_count_timeout() argument
940 hrtimer_add_expires_ns(&vcpu->arch.comparecount_timer, in kvm_mips_count_timeout()
941 vcpu->arch.count_period); in kvm_mips_count_timeout()
945 enum emulation_result kvm_mips_emul_wait(struct kvm_vcpu *vcpu) in kvm_mips_emul_wait() argument
947 kvm_debug("[%#lx] !!!WAIT!!! (%#lx)\n", vcpu->arch.pc, in kvm_mips_emul_wait()
948 vcpu->arch.pending_exceptions); in kvm_mips_emul_wait()
950 ++vcpu->stat.wait_exits; in kvm_mips_emul_wait()
951 trace_kvm_exit(vcpu, KVM_TRACE_EXIT_WAIT); in kvm_mips_emul_wait()
952 if (!vcpu->arch.pending_exceptions) { in kvm_mips_emul_wait()
953 kvm_vz_lose_htimer(vcpu); in kvm_mips_emul_wait()
954 vcpu->arch.wait = 1; in kvm_mips_emul_wait()
955 kvm_vcpu_halt(vcpu); in kvm_mips_emul_wait()
961 if (kvm_arch_vcpu_runnable(vcpu)) in kvm_mips_emul_wait()
962 vcpu->run->exit_reason = KVM_EXIT_IRQ_WINDOW_OPEN; in kvm_mips_emul_wait()
970 struct kvm_vcpu *vcpu) in kvm_mips_emulate_store() argument
975 struct kvm_run *run = vcpu->run; in kvm_mips_emulate_store()
984 curr_pc = vcpu->arch.pc; in kvm_mips_emulate_store()
985 er = update_pc(vcpu, cause); in kvm_mips_emulate_store()
992 vcpu->arch.host_cp0_badvaddr); in kvm_mips_emulate_store()
1000 *(u64 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1003 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1004 vcpu->arch.gprs[rt], *(u64 *)data); in kvm_mips_emulate_store()
1010 *(u32 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1013 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1014 vcpu->arch.gprs[rt], *(u32 *)data); in kvm_mips_emulate_store()
1019 *(u16 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1022 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1023 vcpu->arch.gprs[rt], *(u16 *)data); in kvm_mips_emulate_store()
1028 *(u8 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1031 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1032 vcpu->arch.gprs[rt], *(u8 *)data); in kvm_mips_emulate_store()
1037 vcpu->arch.host_cp0_badvaddr) & (~0x3); in kvm_mips_emulate_store()
1039 imme = vcpu->arch.host_cp0_badvaddr & 0x3; in kvm_mips_emulate_store()
1043 (vcpu->arch.gprs[rt] >> 24); in kvm_mips_emulate_store()
1047 (vcpu->arch.gprs[rt] >> 16); in kvm_mips_emulate_store()
1051 (vcpu->arch.gprs[rt] >> 8); in kvm_mips_emulate_store()
1054 *(u32 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1061 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1062 vcpu->arch.gprs[rt], *(u32 *)data); in kvm_mips_emulate_store()
1067 vcpu->arch.host_cp0_badvaddr) & (~0x3); in kvm_mips_emulate_store()
1069 imme = vcpu->arch.host_cp0_badvaddr & 0x3; in kvm_mips_emulate_store()
1072 *(u32 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1076 (vcpu->arch.gprs[rt] << 8); in kvm_mips_emulate_store()
1080 (vcpu->arch.gprs[rt] << 16); in kvm_mips_emulate_store()
1084 (vcpu->arch.gprs[rt] << 24); in kvm_mips_emulate_store()
1091 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1092 vcpu->arch.gprs[rt], *(u32 *)data); in kvm_mips_emulate_store()
1098 vcpu->arch.host_cp0_badvaddr) & (~0x7); in kvm_mips_emulate_store()
1101 imme = vcpu->arch.host_cp0_badvaddr & 0x7; in kvm_mips_emulate_store()
1105 ((vcpu->arch.gprs[rt] >> 56) & 0xff); in kvm_mips_emulate_store()
1109 ((vcpu->arch.gprs[rt] >> 48) & 0xffff); in kvm_mips_emulate_store()
1113 ((vcpu->arch.gprs[rt] >> 40) & 0xffffff); in kvm_mips_emulate_store()
1117 ((vcpu->arch.gprs[rt] >> 32) & 0xffffffff); in kvm_mips_emulate_store()
1121 ((vcpu->arch.gprs[rt] >> 24) & 0xffffffffff); in kvm_mips_emulate_store()
1125 ((vcpu->arch.gprs[rt] >> 16) & 0xffffffffffff); in kvm_mips_emulate_store()
1129 ((vcpu->arch.gprs[rt] >> 8) & 0xffffffffffffff); in kvm_mips_emulate_store()
1132 *(u64 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1139 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1140 vcpu->arch.gprs[rt], *(u64 *)data); in kvm_mips_emulate_store()
1145 vcpu->arch.host_cp0_badvaddr) & (~0x7); in kvm_mips_emulate_store()
1148 imme = vcpu->arch.host_cp0_badvaddr & 0x7; in kvm_mips_emulate_store()
1151 *(u64 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1155 (vcpu->arch.gprs[rt] << 8); in kvm_mips_emulate_store()
1159 (vcpu->arch.gprs[rt] << 16); in kvm_mips_emulate_store()
1163 (vcpu->arch.gprs[rt] << 24); in kvm_mips_emulate_store()
1167 (vcpu->arch.gprs[rt] << 32); in kvm_mips_emulate_store()
1171 (vcpu->arch.gprs[rt] << 40); in kvm_mips_emulate_store()
1175 (vcpu->arch.gprs[rt] << 48); in kvm_mips_emulate_store()
1179 (vcpu->arch.gprs[rt] << 56); in kvm_mips_emulate_store()
1186 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1187 vcpu->arch.gprs[rt], *(u64 *)data); in kvm_mips_emulate_store()
1205 *(u8 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1208 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1209 vcpu->arch.gprs[rt], *(u8 *)data); in kvm_mips_emulate_store()
1213 *(u16 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1216 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1217 vcpu->arch.gprs[rt], *(u16 *)data); in kvm_mips_emulate_store()
1221 *(u32 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1224 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1225 vcpu->arch.gprs[rt], *(u32 *)data); in kvm_mips_emulate_store()
1229 *(u64 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1232 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1233 vcpu->arch.gprs[rt], *(u64 *)data); in kvm_mips_emulate_store()
1248 vcpu->mmio_needed = 1; in kvm_mips_emulate_store()
1250 vcpu->mmio_is_write = 1; in kvm_mips_emulate_store()
1252 r = kvm_io_bus_write(vcpu, KVM_MMIO_BUS, in kvm_mips_emulate_store()
1256 vcpu->mmio_needed = 0; in kvm_mips_emulate_store()
1264 vcpu->arch.pc = curr_pc; in kvm_mips_emulate_store()
1269 u32 cause, struct kvm_vcpu *vcpu) in kvm_mips_emulate_load() argument
1271 struct kvm_run *run = vcpu->run; in kvm_mips_emulate_load()
1286 curr_pc = vcpu->arch.pc; in kvm_mips_emulate_load()
1287 er = update_pc(vcpu, cause); in kvm_mips_emulate_load()
1290 vcpu->arch.io_pc = vcpu->arch.pc; in kvm_mips_emulate_load()
1291 vcpu->arch.pc = curr_pc; in kvm_mips_emulate_load()
1293 vcpu->arch.io_gpr = rt; in kvm_mips_emulate_load()
1296 vcpu->arch.host_cp0_badvaddr); in kvm_mips_emulate_load()
1300 vcpu->mmio_needed = 2; /* signed */ in kvm_mips_emulate_load()
1308 vcpu->mmio_needed = 1; /* unsigned */ in kvm_mips_emulate_load()
1316 vcpu->mmio_needed = 1; /* unsigned */ in kvm_mips_emulate_load()
1323 vcpu->mmio_needed = 1; /* unsigned */ in kvm_mips_emulate_load()
1331 vcpu->arch.host_cp0_badvaddr) & (~0x3); in kvm_mips_emulate_load()
1334 imme = vcpu->arch.host_cp0_badvaddr & 0x3; in kvm_mips_emulate_load()
1337 vcpu->mmio_needed = 3; /* 1 byte */ in kvm_mips_emulate_load()
1340 vcpu->mmio_needed = 4; /* 2 bytes */ in kvm_mips_emulate_load()
1343 vcpu->mmio_needed = 5; /* 3 bytes */ in kvm_mips_emulate_load()
1346 vcpu->mmio_needed = 6; /* 4 bytes */ in kvm_mips_emulate_load()
1355 vcpu->arch.host_cp0_badvaddr) & (~0x3); in kvm_mips_emulate_load()
1358 imme = vcpu->arch.host_cp0_badvaddr & 0x3; in kvm_mips_emulate_load()
1361 vcpu->mmio_needed = 7; /* 4 bytes */ in kvm_mips_emulate_load()
1364 vcpu->mmio_needed = 8; /* 3 bytes */ in kvm_mips_emulate_load()
1367 vcpu->mmio_needed = 9; /* 2 bytes */ in kvm_mips_emulate_load()
1370 vcpu->mmio_needed = 10; /* 1 byte */ in kvm_mips_emulate_load()
1380 vcpu->arch.host_cp0_badvaddr) & (~0x7); in kvm_mips_emulate_load()
1383 imme = vcpu->arch.host_cp0_badvaddr & 0x7; in kvm_mips_emulate_load()
1386 vcpu->mmio_needed = 11; /* 1 byte */ in kvm_mips_emulate_load()
1389 vcpu->mmio_needed = 12; /* 2 bytes */ in kvm_mips_emulate_load()
1392 vcpu->mmio_needed = 13; /* 3 bytes */ in kvm_mips_emulate_load()
1395 vcpu->mmio_needed = 14; /* 4 bytes */ in kvm_mips_emulate_load()
1398 vcpu->mmio_needed = 15; /* 5 bytes */ in kvm_mips_emulate_load()
1401 vcpu->mmio_needed = 16; /* 6 bytes */ in kvm_mips_emulate_load()
1404 vcpu->mmio_needed = 17; /* 7 bytes */ in kvm_mips_emulate_load()
1407 vcpu->mmio_needed = 18; /* 8 bytes */ in kvm_mips_emulate_load()
1416 vcpu->arch.host_cp0_badvaddr) & (~0x7); in kvm_mips_emulate_load()
1419 imme = vcpu->arch.host_cp0_badvaddr & 0x7; in kvm_mips_emulate_load()
1422 vcpu->mmio_needed = 19; /* 8 bytes */ in kvm_mips_emulate_load()
1425 vcpu->mmio_needed = 20; /* 7 bytes */ in kvm_mips_emulate_load()
1428 vcpu->mmio_needed = 21; /* 6 bytes */ in kvm_mips_emulate_load()
1431 vcpu->mmio_needed = 22; /* 5 bytes */ in kvm_mips_emulate_load()
1434 vcpu->mmio_needed = 23; /* 4 bytes */ in kvm_mips_emulate_load()
1437 vcpu->mmio_needed = 24; /* 3 bytes */ in kvm_mips_emulate_load()
1440 vcpu->mmio_needed = 25; /* 2 bytes */ in kvm_mips_emulate_load()
1443 vcpu->mmio_needed = 26; /* 1 byte */ in kvm_mips_emulate_load()
1465 vcpu->mmio_needed = 27; /* signed */ in kvm_mips_emulate_load()
1469 vcpu->mmio_needed = 28; /* signed */ in kvm_mips_emulate_load()
1473 vcpu->mmio_needed = 29; /* signed */ in kvm_mips_emulate_load()
1477 vcpu->mmio_needed = 30; /* signed */ in kvm_mips_emulate_load()
1490 vcpu->mmio_needed = 0; in kvm_mips_emulate_load()
1495 vcpu->mmio_is_write = 0; in kvm_mips_emulate_load()
1497 r = kvm_io_bus_read(vcpu, KVM_MMIO_BUS, in kvm_mips_emulate_load()
1501 kvm_mips_complete_mmio_load(vcpu); in kvm_mips_emulate_load()
1502 vcpu->mmio_needed = 0; in kvm_mips_emulate_load()
1509 enum emulation_result kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu) in kvm_mips_complete_mmio_load() argument
1511 struct kvm_run *run = vcpu->run; in kvm_mips_complete_mmio_load()
1512 unsigned long *gpr = &vcpu->arch.gprs[vcpu->arch.io_gpr]; in kvm_mips_complete_mmio_load()
1522 vcpu->arch.pc = vcpu->arch.io_pc; in kvm_mips_complete_mmio_load()
1526 switch (vcpu->mmio_needed) { in kvm_mips_complete_mmio_load()
1528 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffffffffffff) | in kvm_mips_complete_mmio_load()
1532 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffffffffff) | in kvm_mips_complete_mmio_load()
1536 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffffffff) | in kvm_mips_complete_mmio_load()
1540 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffffff) | in kvm_mips_complete_mmio_load()
1544 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffff) | in kvm_mips_complete_mmio_load()
1548 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffff) | in kvm_mips_complete_mmio_load()
1552 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xff) | in kvm_mips_complete_mmio_load()
1560 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xff00000000000000) | in kvm_mips_complete_mmio_load()
1564 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffff000000000000) | in kvm_mips_complete_mmio_load()
1568 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffff0000000000) | in kvm_mips_complete_mmio_load()
1572 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffffff00000000) | in kvm_mips_complete_mmio_load()
1576 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffffffff000000) | in kvm_mips_complete_mmio_load()
1580 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffffffffff0000) | in kvm_mips_complete_mmio_load()
1584 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffffffffffff00) | in kvm_mips_complete_mmio_load()
1593 switch (vcpu->mmio_needed) { in kvm_mips_complete_mmio_load()
1601 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffff) | in kvm_mips_complete_mmio_load()
1605 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffff) | in kvm_mips_complete_mmio_load()
1609 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xff) | in kvm_mips_complete_mmio_load()
1617 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xff000000) | in kvm_mips_complete_mmio_load()
1621 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffff0000) | in kvm_mips_complete_mmio_load()
1625 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffff00) | in kvm_mips_complete_mmio_load()
1634 if (vcpu->mmio_needed == 1) in kvm_mips_complete_mmio_load()
1641 if (vcpu->mmio_needed == 1) in kvm_mips_complete_mmio_load()