提交 6ad78a5c 编写于 作者: D Deng-Cheng Zhu 提交者: Paolo Bonzini

MIPS: KVM: Use KVM internal logger

Replace printks with kvm_[err|info|debug].
Signed-off-by: NDeng-Cheng Zhu <dengcheng.zhu@imgtec.com>
Reviewed-by: NJames Hogan <james.hogan@imgtec.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 d116e812
...@@ -817,8 +817,8 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log) ...@@ -817,8 +817,8 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log)
ga = memslot->base_gfn << PAGE_SHIFT; ga = memslot->base_gfn << PAGE_SHIFT;
ga_end = ga + (memslot->npages << PAGE_SHIFT); ga_end = ga + (memslot->npages << PAGE_SHIFT);
printk("%s: dirty, ga: %#lx, ga_end %#lx\n", __func__, ga, kvm_info("%s: dirty, ga: %#lx, ga_end %#lx\n", __func__, ga,
ga_end); ga_end);
n = kvm_dirty_bitmap_bytes(memslot); n = kvm_dirty_bitmap_bytes(memslot);
memset(memslot->dirty_bitmap, 0, n); memset(memslot->dirty_bitmap, 0, n);
...@@ -925,24 +925,25 @@ int kvm_arch_vcpu_dump_regs(struct kvm_vcpu *vcpu) ...@@ -925,24 +925,25 @@ int kvm_arch_vcpu_dump_regs(struct kvm_vcpu *vcpu)
if (!vcpu) if (!vcpu)
return -1; return -1;
printk("VCPU Register Dump:\n"); kvm_debug("VCPU Register Dump:\n");
printk("\tpc = 0x%08lx\n", vcpu->arch.pc); kvm_debug("\tpc = 0x%08lx\n", vcpu->arch.pc);
printk("\texceptions: %08lx\n", vcpu->arch.pending_exceptions); kvm_debug("\texceptions: %08lx\n", vcpu->arch.pending_exceptions);
for (i = 0; i < 32; i += 4) { for (i = 0; i < 32; i += 4) {
printk("\tgpr%02d: %08lx %08lx %08lx %08lx\n", i, kvm_debug("\tgpr%02d: %08lx %08lx %08lx %08lx\n", i,
vcpu->arch.gprs[i], vcpu->arch.gprs[i],
vcpu->arch.gprs[i + 1], vcpu->arch.gprs[i + 1],
vcpu->arch.gprs[i + 2], vcpu->arch.gprs[i + 3]); vcpu->arch.gprs[i + 2], vcpu->arch.gprs[i + 3]);
} }
printk("\thi: 0x%08lx\n", vcpu->arch.hi); kvm_debug("\thi: 0x%08lx\n", vcpu->arch.hi);
printk("\tlo: 0x%08lx\n", vcpu->arch.lo); kvm_debug("\tlo: 0x%08lx\n", vcpu->arch.lo);
cop0 = vcpu->arch.cop0; cop0 = vcpu->arch.cop0;
printk("\tStatus: 0x%08lx, Cause: 0x%08lx\n", kvm_debug("\tStatus: 0x%08lx, Cause: 0x%08lx\n",
kvm_read_c0_guest_status(cop0), kvm_read_c0_guest_cause(cop0)); kvm_read_c0_guest_status(cop0),
kvm_read_c0_guest_cause(cop0));
printk("\tEPC: 0x%08lx\n", kvm_read_c0_guest_epc(cop0)); kvm_debug("\tEPC: 0x%08lx\n", kvm_read_c0_guest_epc(cop0));
return 0; return 0;
} }
......
...@@ -183,18 +183,18 @@ unsigned long kvm_compute_return_epc(struct kvm_vcpu *vcpu, ...@@ -183,18 +183,18 @@ unsigned long kvm_compute_return_epc(struct kvm_vcpu *vcpu,
/* And now the FPA/cp1 branch instructions. */ /* And now the FPA/cp1 branch instructions. */
case cop1_op: case cop1_op:
printk("%s: unsupported cop1_op\n", __func__); kvm_err("%s: unsupported cop1_op\n", __func__);
break; break;
} }
return nextpc; return nextpc;
unaligned: unaligned:
printk("%s: unaligned epc\n", __func__); kvm_err("%s: unaligned epc\n", __func__);
return nextpc; return nextpc;
sigill: sigill:
printk("%s: DSP branch but not DSP ASE\n", __func__); kvm_err("%s: DSP branch but not DSP ASE\n", __func__);
return nextpc; return nextpc;
} }
...@@ -751,8 +751,8 @@ enum emulation_result kvm_mips_emul_eret(struct kvm_vcpu *vcpu) ...@@ -751,8 +751,8 @@ enum emulation_result kvm_mips_emul_eret(struct kvm_vcpu *vcpu)
kvm_clear_c0_guest_status(cop0, ST0_ERL); kvm_clear_c0_guest_status(cop0, ST0_ERL);
vcpu->arch.pc = kvm_read_c0_guest_errorepc(cop0); vcpu->arch.pc = kvm_read_c0_guest_errorepc(cop0);
} else { } else {
printk("[%#lx] ERET when MIPS_SR_EXL|MIPS_SR_ERL == 0\n", kvm_err("[%#lx] ERET when MIPS_SR_EXL|MIPS_SR_ERL == 0\n",
vcpu->arch.pc); vcpu->arch.pc);
er = EMULATE_FAIL; er = EMULATE_FAIL;
} }
...@@ -795,7 +795,7 @@ enum emulation_result kvm_mips_emul_tlbr(struct kvm_vcpu *vcpu) ...@@ -795,7 +795,7 @@ enum emulation_result kvm_mips_emul_tlbr(struct kvm_vcpu *vcpu)
enum emulation_result er = EMULATE_FAIL; enum emulation_result er = EMULATE_FAIL;
uint32_t pc = vcpu->arch.pc; uint32_t pc = vcpu->arch.pc;
printk("[%#x] COP0_TLBR [%ld]\n", pc, kvm_read_c0_guest_index(cop0)); kvm_err("[%#x] COP0_TLBR [%ld]\n", pc, kvm_read_c0_guest_index(cop0));
return er; return er;
} }
...@@ -809,13 +809,12 @@ enum emulation_result kvm_mips_emul_tlbwi(struct kvm_vcpu *vcpu) ...@@ -809,13 +809,12 @@ enum emulation_result kvm_mips_emul_tlbwi(struct kvm_vcpu *vcpu)
uint32_t pc = vcpu->arch.pc; uint32_t pc = vcpu->arch.pc;
if (index < 0 || index >= KVM_MIPS_GUEST_TLB_SIZE) { if (index < 0 || index >= KVM_MIPS_GUEST_TLB_SIZE) {
printk("%s: illegal index: %d\n", __func__, index); kvm_debug("%s: illegal index: %d\n", __func__, index);
printk kvm_debug("[%#x] COP0_TLBWI [%d] (entryhi: %#lx, entrylo0: %#lx entrylo1: %#lx, mask: %#lx)\n",
("[%#x] COP0_TLBWI [%d] (entryhi: %#lx, entrylo0: %#lx entrylo1: %#lx, mask: %#lx)\n", pc, index, kvm_read_c0_guest_entryhi(cop0),
pc, index, kvm_read_c0_guest_entryhi(cop0), kvm_read_c0_guest_entrylo0(cop0),
kvm_read_c0_guest_entrylo0(cop0), kvm_read_c0_guest_entrylo1(cop0),
kvm_read_c0_guest_entrylo1(cop0), kvm_read_c0_guest_pagemask(cop0));
kvm_read_c0_guest_pagemask(cop0));
index = (index & ~0x80000000) % KVM_MIPS_GUEST_TLB_SIZE; index = (index & ~0x80000000) % KVM_MIPS_GUEST_TLB_SIZE;
} }
...@@ -853,7 +852,7 @@ enum emulation_result kvm_mips_emul_tlbwr(struct kvm_vcpu *vcpu) ...@@ -853,7 +852,7 @@ enum emulation_result kvm_mips_emul_tlbwr(struct kvm_vcpu *vcpu)
index &= (KVM_MIPS_GUEST_TLB_SIZE - 1); index &= (KVM_MIPS_GUEST_TLB_SIZE - 1);
if (index < 0 || index >= KVM_MIPS_GUEST_TLB_SIZE) { if (index < 0 || index >= KVM_MIPS_GUEST_TLB_SIZE) {
printk("%s: illegal index: %d\n", __func__, index); kvm_err("%s: illegal index: %d\n", __func__, index);
return EMULATE_FAIL; return EMULATE_FAIL;
} }
...@@ -938,7 +937,7 @@ enum emulation_result kvm_mips_emulate_CP0(uint32_t inst, uint32_t *opc, ...@@ -938,7 +937,7 @@ enum emulation_result kvm_mips_emulate_CP0(uint32_t inst, uint32_t *opc,
er = kvm_mips_emul_tlbp(vcpu); er = kvm_mips_emul_tlbp(vcpu);
break; break;
case rfe_op: case rfe_op:
printk("!!!COP0_RFE!!!\n"); kvm_err("!!!COP0_RFE!!!\n");
break; break;
case eret_op: case eret_op:
er = kvm_mips_emul_eret(vcpu); er = kvm_mips_emul_eret(vcpu);
...@@ -987,8 +986,8 @@ enum emulation_result kvm_mips_emulate_CP0(uint32_t inst, uint32_t *opc, ...@@ -987,8 +986,8 @@ enum emulation_result kvm_mips_emulate_CP0(uint32_t inst, uint32_t *opc,
if ((rd == MIPS_CP0_TLB_INDEX) if ((rd == MIPS_CP0_TLB_INDEX)
&& (vcpu->arch.gprs[rt] >= && (vcpu->arch.gprs[rt] >=
KVM_MIPS_GUEST_TLB_SIZE)) { KVM_MIPS_GUEST_TLB_SIZE)) {
printk("Invalid TLB Index: %ld", kvm_err("Invalid TLB Index: %ld",
vcpu->arch.gprs[rt]); vcpu->arch.gprs[rt]);
er = EMULATE_FAIL; er = EMULATE_FAIL;
break; break;
} }
...@@ -998,8 +997,8 @@ enum emulation_result kvm_mips_emulate_CP0(uint32_t inst, uint32_t *opc, ...@@ -998,8 +997,8 @@ enum emulation_result kvm_mips_emulate_CP0(uint32_t inst, uint32_t *opc,
kvm_change_c0_guest_ebase(cop0, kvm_change_c0_guest_ebase(cop0,
~(C0_EBASE_CORE_MASK), ~(C0_EBASE_CORE_MASK),
vcpu->arch.gprs[rt]); vcpu->arch.gprs[rt]);
printk("MTCz, cop0->reg[EBASE]: %#lx\n", kvm_err("MTCz, cop0->reg[EBASE]: %#lx\n",
kvm_read_c0_guest_ebase(cop0)); kvm_read_c0_guest_ebase(cop0));
} else if (rd == MIPS_CP0_TLB_HI && sel == 0) { } else if (rd == MIPS_CP0_TLB_HI && sel == 0) {
uint32_t nasid = uint32_t nasid =
vcpu->arch.gprs[rt] & ASID_MASK; vcpu->arch.gprs[rt] & ASID_MASK;
...@@ -1072,9 +1071,8 @@ enum emulation_result kvm_mips_emulate_CP0(uint32_t inst, uint32_t *opc, ...@@ -1072,9 +1071,8 @@ enum emulation_result kvm_mips_emulate_CP0(uint32_t inst, uint32_t *opc,
break; break;
case dmtc_op: case dmtc_op:
printk kvm_err("!!!!!!![%#lx]dmtc_op: rt: %d, rd: %d, sel: %d!!!!!!\n",
("!!!!!!![%#lx]dmtc_op: rt: %d, rd: %d, sel: %d!!!!!!\n", vcpu->arch.pc, rt, rd, sel);
vcpu->arch.pc, rt, rd, sel);
er = EMULATE_FAIL; er = EMULATE_FAIL;
break; break;
...@@ -1119,9 +1117,8 @@ enum emulation_result kvm_mips_emulate_CP0(uint32_t inst, uint32_t *opc, ...@@ -1119,9 +1117,8 @@ enum emulation_result kvm_mips_emulate_CP0(uint32_t inst, uint32_t *opc,
} }
break; break;
default: default:
printk kvm_err("[%#lx]MachEmulateCP0: unsupported COP0, copz: 0x%x\n",
("[%#lx]MachEmulateCP0: unsupported COP0, copz: 0x%x\n", vcpu->arch.pc, copz);
vcpu->arch.pc, copz);
er = EMULATE_FAIL; er = EMULATE_FAIL;
break; break;
} }
...@@ -1242,7 +1239,7 @@ enum emulation_result kvm_mips_emulate_store(uint32_t inst, uint32_t cause, ...@@ -1242,7 +1239,7 @@ enum emulation_result kvm_mips_emulate_store(uint32_t inst, uint32_t cause,
break; break;
default: default:
printk("Store not yet supported"); kvm_err("Store not yet supported");
er = EMULATE_FAIL; er = EMULATE_FAIL;
break; break;
} }
...@@ -1351,7 +1348,7 @@ enum emulation_result kvm_mips_emulate_load(uint32_t inst, uint32_t cause, ...@@ -1351,7 +1348,7 @@ enum emulation_result kvm_mips_emulate_load(uint32_t inst, uint32_t cause,
break; break;
default: default:
printk("Load not yet supported"); kvm_err("Load not yet supported");
er = EMULATE_FAIL; er = EMULATE_FAIL;
break; break;
} }
...@@ -1370,7 +1367,7 @@ int kvm_mips_sync_icache(unsigned long va, struct kvm_vcpu *vcpu) ...@@ -1370,7 +1367,7 @@ int kvm_mips_sync_icache(unsigned long va, struct kvm_vcpu *vcpu)
gfn = va >> PAGE_SHIFT; gfn = va >> PAGE_SHIFT;
if (gfn >= kvm->arch.guest_pmap_npages) { if (gfn >= kvm->arch.guest_pmap_npages) {
printk("%s: Invalid gfn: %#llx\n", __func__, gfn); kvm_err("%s: Invalid gfn: %#llx\n", __func__, gfn);
kvm_mips_dump_host_tlbs(); kvm_mips_dump_host_tlbs();
kvm_arch_vcpu_dump_regs(vcpu); kvm_arch_vcpu_dump_regs(vcpu);
return -1; return -1;
...@@ -1378,7 +1375,8 @@ int kvm_mips_sync_icache(unsigned long va, struct kvm_vcpu *vcpu) ...@@ -1378,7 +1375,8 @@ int kvm_mips_sync_icache(unsigned long va, struct kvm_vcpu *vcpu)
pfn = kvm->arch.guest_pmap[gfn]; pfn = kvm->arch.guest_pmap[gfn];
pa = (pfn << PAGE_SHIFT) | offset; pa = (pfn << PAGE_SHIFT) | offset;
printk("%s: va: %#lx, unmapped: %#x\n", __func__, va, CKSEG0ADDR(pa)); kvm_debug("%s: va: %#lx, unmapped: %#x\n", __func__, va,
CKSEG0ADDR(pa));
local_flush_icache_range(CKSEG0ADDR(pa), 32); local_flush_icache_range(CKSEG0ADDR(pa), 32);
return 0; return 0;
...@@ -1444,8 +1442,8 @@ enum emulation_result kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, ...@@ -1444,8 +1442,8 @@ enum emulation_result kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc,
else if (cache == MIPS_CACHE_ICACHE) else if (cache == MIPS_CACHE_ICACHE)
r4k_blast_icache(); r4k_blast_icache();
else { else {
printk("%s: unsupported CACHE INDEX operation\n", kvm_err("%s: unsupported CACHE INDEX operation\n",
__func__); __func__);
return EMULATE_FAIL; return EMULATE_FAIL;
} }
...@@ -1504,9 +1502,8 @@ enum emulation_result kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, ...@@ -1504,9 +1502,8 @@ enum emulation_result kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc,
} }
} }
} else { } else {
printk kvm_err("INVALID CACHE INDEX/ADDRESS (cache: %#x, op: %#x, base[%d]: %#lx, offset: %#x\n",
("INVALID CACHE INDEX/ADDRESS (cache: %#x, op: %#x, base[%d]: %#lx, offset: %#x\n", cache, op, base, arch->gprs[base], offset);
cache, op, base, arch->gprs[base], offset);
er = EMULATE_FAIL; er = EMULATE_FAIL;
preempt_enable(); preempt_enable();
goto dont_update_pc; goto dont_update_pc;
...@@ -1536,9 +1533,8 @@ enum emulation_result kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, ...@@ -1536,9 +1533,8 @@ enum emulation_result kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc,
kvm_mips_trans_cache_va(inst, opc, vcpu); kvm_mips_trans_cache_va(inst, opc, vcpu);
#endif #endif
} else { } else {
printk kvm_err("NO-OP CACHE (cache: %#x, op: %#x, base[%d]: %#lx, offset: %#x\n",
("NO-OP CACHE (cache: %#x, op: %#x, base[%d]: %#lx, offset: %#x\n", cache, op, base, arch->gprs[base], offset);
cache, op, base, arch->gprs[base], offset);
er = EMULATE_FAIL; er = EMULATE_FAIL;
preempt_enable(); preempt_enable();
goto dont_update_pc; goto dont_update_pc;
...@@ -1590,8 +1586,8 @@ enum emulation_result kvm_mips_emulate_inst(unsigned long cause, uint32_t *opc, ...@@ -1590,8 +1586,8 @@ enum emulation_result kvm_mips_emulate_inst(unsigned long cause, uint32_t *opc,
break; break;
default: default:
printk("Instruction emulation not supported (%p/%#x)\n", opc, kvm_err("Instruction emulation not supported (%p/%#x)\n", opc,
inst); inst);
kvm_arch_vcpu_dump_regs(vcpu); kvm_arch_vcpu_dump_regs(vcpu);
er = EMULATE_FAIL; er = EMULATE_FAIL;
break; break;
...@@ -1628,7 +1624,7 @@ enum emulation_result kvm_mips_emulate_syscall(unsigned long cause, ...@@ -1628,7 +1624,7 @@ enum emulation_result kvm_mips_emulate_syscall(unsigned long cause,
arch->pc = KVM_GUEST_KSEG0 + 0x180; arch->pc = KVM_GUEST_KSEG0 + 0x180;
} else { } else {
printk("Trying to deliver SYSCALL when EXL is already set\n"); kvm_err("Trying to deliver SYSCALL when EXL is already set\n");
er = EMULATE_FAIL; er = EMULATE_FAIL;
} }
...@@ -1984,7 +1980,7 @@ enum emulation_result kvm_mips_emulate_bp_exc(unsigned long cause, ...@@ -1984,7 +1980,7 @@ enum emulation_result kvm_mips_emulate_bp_exc(unsigned long cause,
arch->pc = KVM_GUEST_KSEG0 + 0x180; arch->pc = KVM_GUEST_KSEG0 + 0x180;
} else { } else {
printk("Trying to deliver BP when EXL is already set\n"); kvm_err("Trying to deliver BP when EXL is already set\n");
er = EMULATE_FAIL; er = EMULATE_FAIL;
} }
...@@ -2032,7 +2028,7 @@ enum emulation_result kvm_mips_handle_ri(unsigned long cause, uint32_t *opc, ...@@ -2032,7 +2028,7 @@ enum emulation_result kvm_mips_handle_ri(unsigned long cause, uint32_t *opc,
inst = kvm_get_inst(opc, vcpu); inst = kvm_get_inst(opc, vcpu);
if (inst == KVM_INVALID_INST) { if (inst == KVM_INVALID_INST) {
printk("%s: Cannot get inst @ %p\n", __func__, opc); kvm_err("%s: Cannot get inst @ %p\n", __func__, opc);
return EMULATE_FAIL; return EMULATE_FAIL;
} }
...@@ -2099,7 +2095,7 @@ enum emulation_result kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu, ...@@ -2099,7 +2095,7 @@ enum emulation_result kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu,
unsigned long curr_pc; unsigned long curr_pc;
if (run->mmio.len > sizeof(*gpr)) { if (run->mmio.len > sizeof(*gpr)) {
printk("Bad MMIO length: %d", run->mmio.len); kvm_err("Bad MMIO length: %d", run->mmio.len);
er = EMULATE_FAIL; er = EMULATE_FAIL;
goto done; goto done;
} }
...@@ -2173,7 +2169,7 @@ static enum emulation_result kvm_mips_emulate_exc(unsigned long cause, ...@@ -2173,7 +2169,7 @@ static enum emulation_result kvm_mips_emulate_exc(unsigned long cause,
exccode, kvm_read_c0_guest_epc(cop0), exccode, kvm_read_c0_guest_epc(cop0),
kvm_read_c0_guest_badvaddr(cop0)); kvm_read_c0_guest_badvaddr(cop0));
} else { } else {
printk("Trying to deliver EXC when EXL is already set\n"); kvm_err("Trying to deliver EXC when EXL is already set\n");
er = EMULATE_FAIL; er = EMULATE_FAIL;
} }
...@@ -2213,8 +2209,8 @@ enum emulation_result kvm_mips_check_privilege(unsigned long cause, ...@@ -2213,8 +2209,8 @@ enum emulation_result kvm_mips_check_privilege(unsigned long cause,
* address error exception to the guest * address error exception to the guest
*/ */
if (badvaddr >= (unsigned long) KVM_GUEST_KSEG0) { if (badvaddr >= (unsigned long) KVM_GUEST_KSEG0) {
printk("%s: LD MISS @ %#lx\n", __func__, kvm_debug("%s: LD MISS @ %#lx\n", __func__,
badvaddr); badvaddr);
cause &= ~0xff; cause &= ~0xff;
cause |= (T_ADDR_ERR_LD << CAUSEB_EXCCODE); cause |= (T_ADDR_ERR_LD << CAUSEB_EXCCODE);
er = EMULATE_PRIV_FAIL; er = EMULATE_PRIV_FAIL;
...@@ -2227,8 +2223,8 @@ enum emulation_result kvm_mips_check_privilege(unsigned long cause, ...@@ -2227,8 +2223,8 @@ enum emulation_result kvm_mips_check_privilege(unsigned long cause,
* address error exception to the guest * address error exception to the guest
*/ */
if (badvaddr >= (unsigned long) KVM_GUEST_KSEG0) { if (badvaddr >= (unsigned long) KVM_GUEST_KSEG0) {
printk("%s: ST MISS @ %#lx\n", __func__, kvm_debug("%s: ST MISS @ %#lx\n", __func__,
badvaddr); badvaddr);
cause &= ~0xff; cause &= ~0xff;
cause |= (T_ADDR_ERR_ST << CAUSEB_EXCCODE); cause |= (T_ADDR_ERR_ST << CAUSEB_EXCCODE);
er = EMULATE_PRIV_FAIL; er = EMULATE_PRIV_FAIL;
...@@ -2236,8 +2232,8 @@ enum emulation_result kvm_mips_check_privilege(unsigned long cause, ...@@ -2236,8 +2232,8 @@ enum emulation_result kvm_mips_check_privilege(unsigned long cause,
break; break;
case T_ADDR_ERR_ST: case T_ADDR_ERR_ST:
printk("%s: address error ST @ %#lx\n", __func__, kvm_debug("%s: address error ST @ %#lx\n", __func__,
badvaddr); badvaddr);
if ((badvaddr & PAGE_MASK) == KVM_GUEST_COMMPAGE_ADDR) { if ((badvaddr & PAGE_MASK) == KVM_GUEST_COMMPAGE_ADDR) {
cause &= ~0xff; cause &= ~0xff;
cause |= (T_TLB_ST_MISS << CAUSEB_EXCCODE); cause |= (T_TLB_ST_MISS << CAUSEB_EXCCODE);
...@@ -2245,8 +2241,8 @@ enum emulation_result kvm_mips_check_privilege(unsigned long cause, ...@@ -2245,8 +2241,8 @@ enum emulation_result kvm_mips_check_privilege(unsigned long cause,
er = EMULATE_PRIV_FAIL; er = EMULATE_PRIV_FAIL;
break; break;
case T_ADDR_ERR_LD: case T_ADDR_ERR_LD:
printk("%s: address error LD @ %#lx\n", __func__, kvm_debug("%s: address error LD @ %#lx\n", __func__,
badvaddr); badvaddr);
if ((badvaddr & PAGE_MASK) == KVM_GUEST_COMMPAGE_ADDR) { if ((badvaddr & PAGE_MASK) == KVM_GUEST_COMMPAGE_ADDR) {
cause &= ~0xff; cause &= ~0xff;
cause |= (T_TLB_LD_MISS << CAUSEB_EXCCODE); cause |= (T_TLB_LD_MISS << CAUSEB_EXCCODE);
...@@ -2301,7 +2297,8 @@ enum emulation_result kvm_mips_handle_tlbmiss(unsigned long cause, ...@@ -2301,7 +2297,8 @@ enum emulation_result kvm_mips_handle_tlbmiss(unsigned long cause,
} else if (exccode == T_TLB_ST_MISS) { } else if (exccode == T_TLB_ST_MISS) {
er = kvm_mips_emulate_tlbmiss_st(cause, opc, run, vcpu); er = kvm_mips_emulate_tlbmiss_st(cause, opc, run, vcpu);
} else { } else {
printk("%s: invalid exc code: %d\n", __func__, exccode); kvm_err("%s: invalid exc code: %d\n", __func__,
exccode);
er = EMULATE_FAIL; er = EMULATE_FAIL;
} }
} else { } else {
...@@ -2319,8 +2316,8 @@ enum emulation_result kvm_mips_handle_tlbmiss(unsigned long cause, ...@@ -2319,8 +2316,8 @@ enum emulation_result kvm_mips_handle_tlbmiss(unsigned long cause,
er = kvm_mips_emulate_tlbinv_st(cause, opc, run, er = kvm_mips_emulate_tlbinv_st(cause, opc, run,
vcpu); vcpu);
} else { } else {
printk("%s: invalid exc code: %d\n", __func__, kvm_err("%s: invalid exc code: %d\n", __func__,
exccode); exccode);
er = EMULATE_FAIL; er = EMULATE_FAIL;
} }
} else { } else {
......
...@@ -68,12 +68,12 @@ int kvm_mips_dump_stats(struct kvm_vcpu *vcpu) ...@@ -68,12 +68,12 @@ int kvm_mips_dump_stats(struct kvm_vcpu *vcpu)
#ifdef CONFIG_KVM_MIPS_DEBUG_COP0_COUNTERS #ifdef CONFIG_KVM_MIPS_DEBUG_COP0_COUNTERS
int i, j; int i, j;
printk("\nKVM VCPU[%d] COP0 Access Profile:\n", vcpu->vcpu_id); kvm_info("\nKVM VCPU[%d] COP0 Access Profile:\n", vcpu->vcpu_id);
for (i = 0; i < N_MIPS_COPROC_REGS; i++) { for (i = 0; i < N_MIPS_COPROC_REGS; i++) {
for (j = 0; j < N_MIPS_COPROC_SEL; j++) { for (j = 0; j < N_MIPS_COPROC_SEL; j++) {
if (vcpu->arch.cop0->stat[i][j]) if (vcpu->arch.cop0->stat[i][j])
printk("%s[%d]: %lu\n", kvm_cop0_str[i], j, kvm_info("%s[%d]: %lu\n", kvm_cop0_str[i], j,
vcpu->arch.cop0->stat[i][j]); vcpu->arch.cop0->stat[i][j]);
} }
} }
#endif #endif
......
...@@ -77,8 +77,8 @@ void kvm_mips_dump_host_tlbs(void) ...@@ -77,8 +77,8 @@ void kvm_mips_dump_host_tlbs(void)
old_entryhi = read_c0_entryhi(); old_entryhi = read_c0_entryhi();
old_pagemask = read_c0_pagemask(); old_pagemask = read_c0_pagemask();
printk("HOST TLBs:\n"); kvm_info("HOST TLBs:\n");
printk("ASID: %#lx\n", read_c0_entryhi() & ASID_MASK); kvm_info("ASID: %#lx\n", read_c0_entryhi() & ASID_MASK);
for (i = 0; i < current_cpu_data.tlbsize; i++) { for (i = 0; i < current_cpu_data.tlbsize; i++) {
write_c0_index(i); write_c0_index(i);
...@@ -92,19 +92,19 @@ void kvm_mips_dump_host_tlbs(void) ...@@ -92,19 +92,19 @@ void kvm_mips_dump_host_tlbs(void)
tlb.tlb_lo1 = read_c0_entrylo1(); tlb.tlb_lo1 = read_c0_entrylo1();
tlb.tlb_mask = read_c0_pagemask(); tlb.tlb_mask = read_c0_pagemask();
printk("TLB%c%3d Hi 0x%08lx ", kvm_info("TLB%c%3d Hi 0x%08lx ",
(tlb.tlb_lo0 | tlb.tlb_lo1) & MIPS3_PG_V ? ' ' : '*', (tlb.tlb_lo0 | tlb.tlb_lo1) & MIPS3_PG_V ? ' ' : '*',
i, tlb.tlb_hi); i, tlb.tlb_hi);
printk("Lo0=0x%09" PRIx64 " %c%c attr %lx ", kvm_info("Lo0=0x%09" PRIx64 " %c%c attr %lx ",
(uint64_t) mips3_tlbpfn_to_paddr(tlb.tlb_lo0), (uint64_t) mips3_tlbpfn_to_paddr(tlb.tlb_lo0),
(tlb.tlb_lo0 & MIPS3_PG_D) ? 'D' : ' ', (tlb.tlb_lo0 & MIPS3_PG_D) ? 'D' : ' ',
(tlb.tlb_lo0 & MIPS3_PG_G) ? 'G' : ' ', (tlb.tlb_lo0 & MIPS3_PG_G) ? 'G' : ' ',
(tlb.tlb_lo0 >> 3) & 7); (tlb.tlb_lo0 >> 3) & 7);
printk("Lo1=0x%09" PRIx64 " %c%c attr %lx sz=%lx\n", kvm_info("Lo1=0x%09" PRIx64 " %c%c attr %lx sz=%lx\n",
(uint64_t) mips3_tlbpfn_to_paddr(tlb.tlb_lo1), (uint64_t) mips3_tlbpfn_to_paddr(tlb.tlb_lo1),
(tlb.tlb_lo1 & MIPS3_PG_D) ? 'D' : ' ', (tlb.tlb_lo1 & MIPS3_PG_D) ? 'D' : ' ',
(tlb.tlb_lo1 & MIPS3_PG_G) ? 'G' : ' ', (tlb.tlb_lo1 & MIPS3_PG_G) ? 'G' : ' ',
(tlb.tlb_lo1 >> 3) & 7, tlb.tlb_mask); (tlb.tlb_lo1 >> 3) & 7, tlb.tlb_mask);
} }
write_c0_entryhi(old_entryhi); write_c0_entryhi(old_entryhi);
write_c0_pagemask(old_pagemask); write_c0_pagemask(old_pagemask);
...@@ -119,24 +119,24 @@ void kvm_mips_dump_guest_tlbs(struct kvm_vcpu *vcpu) ...@@ -119,24 +119,24 @@ void kvm_mips_dump_guest_tlbs(struct kvm_vcpu *vcpu)
struct kvm_mips_tlb tlb; struct kvm_mips_tlb tlb;
int i; int i;
printk("Guest TLBs:\n"); kvm_info("Guest TLBs:\n");
printk("Guest EntryHi: %#lx\n", kvm_read_c0_guest_entryhi(cop0)); kvm_info("Guest EntryHi: %#lx\n", kvm_read_c0_guest_entryhi(cop0));
for (i = 0; i < KVM_MIPS_GUEST_TLB_SIZE; i++) { for (i = 0; i < KVM_MIPS_GUEST_TLB_SIZE; i++) {
tlb = vcpu->arch.guest_tlb[i]; tlb = vcpu->arch.guest_tlb[i];
printk("TLB%c%3d Hi 0x%08lx ", kvm_info("TLB%c%3d Hi 0x%08lx ",
(tlb.tlb_lo0 | tlb.tlb_lo1) & MIPS3_PG_V ? ' ' : '*', (tlb.tlb_lo0 | tlb.tlb_lo1) & MIPS3_PG_V ? ' ' : '*',
i, tlb.tlb_hi); i, tlb.tlb_hi);
printk("Lo0=0x%09" PRIx64 " %c%c attr %lx ", kvm_info("Lo0=0x%09" PRIx64 " %c%c attr %lx ",
(uint64_t) mips3_tlbpfn_to_paddr(tlb.tlb_lo0), (uint64_t) mips3_tlbpfn_to_paddr(tlb.tlb_lo0),
(tlb.tlb_lo0 & MIPS3_PG_D) ? 'D' : ' ', (tlb.tlb_lo0 & MIPS3_PG_D) ? 'D' : ' ',
(tlb.tlb_lo0 & MIPS3_PG_G) ? 'G' : ' ', (tlb.tlb_lo0 & MIPS3_PG_G) ? 'G' : ' ',
(tlb.tlb_lo0 >> 3) & 7); (tlb.tlb_lo0 >> 3) & 7);
printk("Lo1=0x%09" PRIx64 " %c%c attr %lx sz=%lx\n", kvm_info("Lo1=0x%09" PRIx64 " %c%c attr %lx sz=%lx\n",
(uint64_t) mips3_tlbpfn_to_paddr(tlb.tlb_lo1), (uint64_t) mips3_tlbpfn_to_paddr(tlb.tlb_lo1),
(tlb.tlb_lo1 & MIPS3_PG_D) ? 'D' : ' ', (tlb.tlb_lo1 & MIPS3_PG_D) ? 'D' : ' ',
(tlb.tlb_lo1 & MIPS3_PG_G) ? 'G' : ' ', (tlb.tlb_lo1 & MIPS3_PG_G) ? 'G' : ' ',
(tlb.tlb_lo1 >> 3) & 7, tlb.tlb_mask); (tlb.tlb_lo1 >> 3) & 7, tlb.tlb_mask);
} }
} }
EXPORT_SYMBOL(kvm_mips_dump_guest_tlbs); EXPORT_SYMBOL(kvm_mips_dump_guest_tlbs);
......
...@@ -27,7 +27,7 @@ static gpa_t kvm_trap_emul_gva_to_gpa_cb(gva_t gva) ...@@ -27,7 +27,7 @@ static gpa_t kvm_trap_emul_gva_to_gpa_cb(gva_t gva)
if ((kseg == CKSEG0) || (kseg == CKSEG1)) if ((kseg == CKSEG0) || (kseg == CKSEG1))
gpa = CPHYSADDR(gva); gpa = CPHYSADDR(gva);
else { else {
printk("%s: cannot find GPA for GVA: %#lx\n", __func__, gva); kvm_err("%s: cannot find GPA for GVA: %#lx\n", __func__, gva);
kvm_mips_dump_host_tlbs(); kvm_mips_dump_host_tlbs();
gpa = KVM_INVALID_ADDR; gpa = KVM_INVALID_ADDR;
} }
...@@ -98,17 +98,15 @@ static int kvm_trap_emul_handle_tlb_mod(struct kvm_vcpu *vcpu) ...@@ -98,17 +98,15 @@ static int kvm_trap_emul_handle_tlb_mod(struct kvm_vcpu *vcpu)
* when we are not using HIGHMEM. Need to address this in a * when we are not using HIGHMEM. Need to address this in a
* HIGHMEM kernel * HIGHMEM kernel
*/ */
printk kvm_err("TLB MOD fault not handled, cause %#lx, PC: %p, BadVaddr: %#lx\n",
("TLB MOD fault not handled, cause %#lx, PC: %p, BadVaddr: %#lx\n", cause, opc, badvaddr);
cause, opc, badvaddr);
kvm_mips_dump_host_tlbs(); kvm_mips_dump_host_tlbs();
kvm_arch_vcpu_dump_regs(vcpu); kvm_arch_vcpu_dump_regs(vcpu);
run->exit_reason = KVM_EXIT_INTERNAL_ERROR; run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
ret = RESUME_HOST; ret = RESUME_HOST;
} else { } else {
printk kvm_err("Illegal TLB Mod fault address , cause %#lx, PC: %p, BadVaddr: %#lx\n",
("Illegal TLB Mod fault address , cause %#lx, PC: %p, BadVaddr: %#lx\n", cause, opc, badvaddr);
cause, opc, badvaddr);
kvm_mips_dump_host_tlbs(); kvm_mips_dump_host_tlbs();
kvm_arch_vcpu_dump_regs(vcpu); kvm_arch_vcpu_dump_regs(vcpu);
run->exit_reason = KVM_EXIT_INTERNAL_ERROR; run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
...@@ -208,9 +206,8 @@ static int kvm_trap_emul_handle_tlb_ld_miss(struct kvm_vcpu *vcpu) ...@@ -208,9 +206,8 @@ static int kvm_trap_emul_handle_tlb_ld_miss(struct kvm_vcpu *vcpu)
ret = RESUME_HOST; ret = RESUME_HOST;
} }
} else { } else {
printk kvm_err("Illegal TLB ST fault address , cause %#lx, PC: %p, BadVaddr: %#lx\n",
("Illegal TLB ST fault address , cause %#lx, PC: %p, BadVaddr: %#lx\n", cause, opc, badvaddr);
cause, opc, badvaddr);
kvm_mips_dump_host_tlbs(); kvm_mips_dump_host_tlbs();
kvm_arch_vcpu_dump_regs(vcpu); kvm_arch_vcpu_dump_regs(vcpu);
run->exit_reason = KVM_EXIT_INTERNAL_ERROR; run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
...@@ -233,7 +230,7 @@ static int kvm_trap_emul_handle_addr_err_st(struct kvm_vcpu *vcpu) ...@@ -233,7 +230,7 @@ static int kvm_trap_emul_handle_addr_err_st(struct kvm_vcpu *vcpu)
kvm_debug("Emulate Store to MMIO space\n"); kvm_debug("Emulate Store to MMIO space\n");
er = kvm_mips_emulate_inst(cause, opc, run, vcpu); er = kvm_mips_emulate_inst(cause, opc, run, vcpu);
if (er == EMULATE_FAIL) { if (er == EMULATE_FAIL) {
printk("Emulate Store to MMIO space failed\n"); kvm_err("Emulate Store to MMIO space failed\n");
run->exit_reason = KVM_EXIT_INTERNAL_ERROR; run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
ret = RESUME_HOST; ret = RESUME_HOST;
} else { } else {
...@@ -241,9 +238,8 @@ static int kvm_trap_emul_handle_addr_err_st(struct kvm_vcpu *vcpu) ...@@ -241,9 +238,8 @@ static int kvm_trap_emul_handle_addr_err_st(struct kvm_vcpu *vcpu)
ret = RESUME_HOST; ret = RESUME_HOST;
} }
} else { } else {
printk kvm_err("Address Error (STORE): cause %#lx, PC: %p, BadVaddr: %#lx\n",
("Address Error (STORE): cause %#lx, PC: %p, BadVaddr: %#lx\n", cause, opc, badvaddr);
cause, opc, badvaddr);
run->exit_reason = KVM_EXIT_INTERNAL_ERROR; run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
ret = RESUME_HOST; ret = RESUME_HOST;
} }
...@@ -263,7 +259,7 @@ static int kvm_trap_emul_handle_addr_err_ld(struct kvm_vcpu *vcpu) ...@@ -263,7 +259,7 @@ static int kvm_trap_emul_handle_addr_err_ld(struct kvm_vcpu *vcpu)
kvm_debug("Emulate Load from MMIO space @ %#lx\n", badvaddr); kvm_debug("Emulate Load from MMIO space @ %#lx\n", badvaddr);
er = kvm_mips_emulate_inst(cause, opc, run, vcpu); er = kvm_mips_emulate_inst(cause, opc, run, vcpu);
if (er == EMULATE_FAIL) { if (er == EMULATE_FAIL) {
printk("Emulate Load from MMIO space failed\n"); kvm_err("Emulate Load from MMIO space failed\n");
run->exit_reason = KVM_EXIT_INTERNAL_ERROR; run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
ret = RESUME_HOST; ret = RESUME_HOST;
} else { } else {
...@@ -271,9 +267,8 @@ static int kvm_trap_emul_handle_addr_err_ld(struct kvm_vcpu *vcpu) ...@@ -271,9 +267,8 @@ static int kvm_trap_emul_handle_addr_err_ld(struct kvm_vcpu *vcpu)
ret = RESUME_HOST; ret = RESUME_HOST;
} }
} else { } else {
printk kvm_err("Address Error (LOAD): cause %#lx, PC: %p, BadVaddr: %#lx\n",
("Address Error (LOAD): cause %#lx, PC: %p, BadVaddr: %#lx\n", cause, opc, badvaddr);
cause, opc, badvaddr);
run->exit_reason = KVM_EXIT_INTERNAL_ERROR; run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
ret = RESUME_HOST; ret = RESUME_HOST;
er = EMULATE_FAIL; er = EMULATE_FAIL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册