Lines Matching refs:arch
45 struct kvm_vcpu_arch *arch = &vcpu->arch; in kvm_compute_return_epc() local
65 arch->gprs[insn.r_format.rd] = epc + 8; in kvm_compute_return_epc()
68 nextpc = arch->gprs[insn.r_format.rs]; in kvm_compute_return_epc()
84 if ((long)arch->gprs[insn.i_format.rs] < 0) in kvm_compute_return_epc()
93 if ((long)arch->gprs[insn.i_format.rs] >= 0) in kvm_compute_return_epc()
102 arch->gprs[31] = epc + 8; in kvm_compute_return_epc()
103 if ((long)arch->gprs[insn.i_format.rs] < 0) in kvm_compute_return_epc()
112 arch->gprs[31] = epc + 8; in kvm_compute_return_epc()
113 if ((long)arch->gprs[insn.i_format.rs] >= 0) in kvm_compute_return_epc()
141 arch->gprs[31] = instpc + 8; in kvm_compute_return_epc()
154 if (arch->gprs[insn.i_format.rs] == in kvm_compute_return_epc()
155 arch->gprs[insn.i_format.rt]) in kvm_compute_return_epc()
164 if (arch->gprs[insn.i_format.rs] != in kvm_compute_return_epc()
165 arch->gprs[insn.i_format.rt]) in kvm_compute_return_epc()
178 if ((long)arch->gprs[insn.i_format.rs] <= 0) in kvm_compute_return_epc()
191 if ((long)arch->gprs[insn.i_format.rs] > 0) in kvm_compute_return_epc()
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()
275 *out = vcpu->arch.host_cp0_badinstr; in kvm_get_badinstr()
297 *out = vcpu->arch.host_cp0_badinstrp; in kvm_get_badinstrp()
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()
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()
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()
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()
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()
447 struct mips_coproc *cop0 = vcpu->arch.cop0; in kvm_mips_read_count()
477 hrtimer_cancel(&vcpu->arch.comparecount_timer); in kvm_mips_freeze_hrtimer()
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()
552 before_count = vcpu->arch.count_bias + 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()
606 struct mips_coproc *cop0 = vcpu->arch.cop0; in kvm_mips_write_count()
611 vcpu->arch.count_bias = count - kvm_mips_ktime_to_count(vcpu, now); in kvm_mips_write_count()
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()
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()
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()
699 struct mips_coproc *cop0 = vcpu->arch.cop0; in kvm_mips_write_compare()
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()
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()
829 struct mips_coproc *cop0 = vcpu->arch.cop0; in kvm_mips_count_enable_cause()
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()
925 vcpu->arch.count_resume = ns_to_ktime(count_resume); in kvm_mips_set_count_resume()
940 hrtimer_add_expires_ns(&vcpu->arch.comparecount_timer, in kvm_mips_count_timeout()
941 vcpu->arch.count_period); in kvm_mips_count_timeout()
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()
952 if (!vcpu->arch.pending_exceptions) { in kvm_mips_emul_wait()
954 vcpu->arch.wait = 1; in kvm_mips_emul_wait()
986 curr_pc = vcpu->arch.pc; in kvm_mips_emulate_store()
994 vcpu->arch.host_cp0_badvaddr); in kvm_mips_emulate_store()
1002 *(u64 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1005 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1006 vcpu->arch.gprs[rt], *(u64 *)data); in kvm_mips_emulate_store()
1012 *(u32 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1015 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1016 vcpu->arch.gprs[rt], *(u32 *)data); in kvm_mips_emulate_store()
1021 *(u16 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1024 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1025 vcpu->arch.gprs[rt], *(u16 *)data); in kvm_mips_emulate_store()
1030 *(u8 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1033 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1034 vcpu->arch.gprs[rt], *(u8 *)data); in kvm_mips_emulate_store()
1039 vcpu->arch.host_cp0_badvaddr) & (~0x3); in kvm_mips_emulate_store()
1041 imme = vcpu->arch.host_cp0_badvaddr & 0x3; in kvm_mips_emulate_store()
1045 (vcpu->arch.gprs[rt] >> 24); in kvm_mips_emulate_store()
1049 (vcpu->arch.gprs[rt] >> 16); in kvm_mips_emulate_store()
1053 (vcpu->arch.gprs[rt] >> 8); in kvm_mips_emulate_store()
1056 *(u32 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1063 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1064 vcpu->arch.gprs[rt], *(u32 *)data); in kvm_mips_emulate_store()
1069 vcpu->arch.host_cp0_badvaddr) & (~0x3); in kvm_mips_emulate_store()
1071 imme = vcpu->arch.host_cp0_badvaddr & 0x3; in kvm_mips_emulate_store()
1074 *(u32 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1078 (vcpu->arch.gprs[rt] << 8); in kvm_mips_emulate_store()
1082 (vcpu->arch.gprs[rt] << 16); in kvm_mips_emulate_store()
1086 (vcpu->arch.gprs[rt] << 24); in kvm_mips_emulate_store()
1093 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1094 vcpu->arch.gprs[rt], *(u32 *)data); in kvm_mips_emulate_store()
1100 vcpu->arch.host_cp0_badvaddr) & (~0x7); in kvm_mips_emulate_store()
1103 imme = vcpu->arch.host_cp0_badvaddr & 0x7; in kvm_mips_emulate_store()
1107 ((vcpu->arch.gprs[rt] >> 56) & 0xff); in kvm_mips_emulate_store()
1111 ((vcpu->arch.gprs[rt] >> 48) & 0xffff); in kvm_mips_emulate_store()
1115 ((vcpu->arch.gprs[rt] >> 40) & 0xffffff); in kvm_mips_emulate_store()
1119 ((vcpu->arch.gprs[rt] >> 32) & 0xffffffff); in kvm_mips_emulate_store()
1123 ((vcpu->arch.gprs[rt] >> 24) & 0xffffffffff); in kvm_mips_emulate_store()
1127 ((vcpu->arch.gprs[rt] >> 16) & 0xffffffffffff); in kvm_mips_emulate_store()
1131 ((vcpu->arch.gprs[rt] >> 8) & 0xffffffffffffff); in kvm_mips_emulate_store()
1134 *(u64 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1141 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1142 vcpu->arch.gprs[rt], *(u64 *)data); in kvm_mips_emulate_store()
1147 vcpu->arch.host_cp0_badvaddr) & (~0x7); in kvm_mips_emulate_store()
1150 imme = vcpu->arch.host_cp0_badvaddr & 0x7; in kvm_mips_emulate_store()
1153 *(u64 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1157 (vcpu->arch.gprs[rt] << 8); in kvm_mips_emulate_store()
1161 (vcpu->arch.gprs[rt] << 16); in kvm_mips_emulate_store()
1165 (vcpu->arch.gprs[rt] << 24); in kvm_mips_emulate_store()
1169 (vcpu->arch.gprs[rt] << 32); in kvm_mips_emulate_store()
1173 (vcpu->arch.gprs[rt] << 40); in kvm_mips_emulate_store()
1177 (vcpu->arch.gprs[rt] << 48); in kvm_mips_emulate_store()
1181 (vcpu->arch.gprs[rt] << 56); in kvm_mips_emulate_store()
1188 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1189 vcpu->arch.gprs[rt], *(u64 *)data); in kvm_mips_emulate_store()
1207 *(u8 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1210 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1211 vcpu->arch.gprs[rt], *(u8 *)data); in kvm_mips_emulate_store()
1215 *(u16 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1218 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1219 vcpu->arch.gprs[rt], *(u16 *)data); in kvm_mips_emulate_store()
1223 *(u32 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1226 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1227 vcpu->arch.gprs[rt], *(u32 *)data); in kvm_mips_emulate_store()
1231 *(u64 *)data = vcpu->arch.gprs[rt]; in kvm_mips_emulate_store()
1234 vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr, in kvm_mips_emulate_store()
1235 vcpu->arch.gprs[rt], *(u64 *)data); in kvm_mips_emulate_store()
1266 vcpu->arch.pc = curr_pc; in kvm_mips_emulate_store()
1288 curr_pc = vcpu->arch.pc; in kvm_mips_emulate_load()
1292 vcpu->arch.io_pc = vcpu->arch.pc; in kvm_mips_emulate_load()
1293 vcpu->arch.pc = curr_pc; in kvm_mips_emulate_load()
1295 vcpu->arch.io_gpr = rt; in kvm_mips_emulate_load()
1298 vcpu->arch.host_cp0_badvaddr); in kvm_mips_emulate_load()
1333 vcpu->arch.host_cp0_badvaddr) & (~0x3); in kvm_mips_emulate_load()
1336 imme = vcpu->arch.host_cp0_badvaddr & 0x3; in kvm_mips_emulate_load()
1357 vcpu->arch.host_cp0_badvaddr) & (~0x3); in kvm_mips_emulate_load()
1360 imme = vcpu->arch.host_cp0_badvaddr & 0x3; in kvm_mips_emulate_load()
1382 vcpu->arch.host_cp0_badvaddr) & (~0x7); in kvm_mips_emulate_load()
1385 imme = vcpu->arch.host_cp0_badvaddr & 0x7; in kvm_mips_emulate_load()
1418 vcpu->arch.host_cp0_badvaddr) & (~0x7); in kvm_mips_emulate_load()
1421 imme = vcpu->arch.host_cp0_badvaddr & 0x7; in kvm_mips_emulate_load()
1514 unsigned long *gpr = &vcpu->arch.gprs[vcpu->arch.io_gpr]; in kvm_mips_complete_mmio_load()
1524 vcpu->arch.pc = vcpu->arch.io_pc; in kvm_mips_complete_mmio_load()
1530 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffffffffffff) | in kvm_mips_complete_mmio_load()
1534 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffffffffff) | in kvm_mips_complete_mmio_load()
1538 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffffffff) | in kvm_mips_complete_mmio_load()
1542 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffffff) | in kvm_mips_complete_mmio_load()
1546 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffff) | in kvm_mips_complete_mmio_load()
1550 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffff) | in kvm_mips_complete_mmio_load()
1554 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xff) | in kvm_mips_complete_mmio_load()
1562 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xff00000000000000) | in kvm_mips_complete_mmio_load()
1566 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffff000000000000) | in kvm_mips_complete_mmio_load()
1570 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffff0000000000) | in kvm_mips_complete_mmio_load()
1574 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffffff00000000) | in kvm_mips_complete_mmio_load()
1578 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffffffff000000) | in kvm_mips_complete_mmio_load()
1582 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffffffffff0000) | in kvm_mips_complete_mmio_load()
1586 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffffffffffff00) | in kvm_mips_complete_mmio_load()
1603 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffff) | in kvm_mips_complete_mmio_load()
1607 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffff) | in kvm_mips_complete_mmio_load()
1611 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xff) | in kvm_mips_complete_mmio_load()
1619 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xff000000) | in kvm_mips_complete_mmio_load()
1623 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffff0000) | in kvm_mips_complete_mmio_load()
1627 *gpr = (vcpu->arch.gprs[vcpu->arch.io_gpr] & 0xffffff00) | in kvm_mips_complete_mmio_load()