KVM: arm/arm64: Log PSTATE for unhandled sysregs
authorMark Rutland <mark.rutland@arm.com>
Thu, 6 Dec 2018 12:31:44 +0000 (12:31 +0000)
committerMarc Zyngier <marc.zyngier@arm.com>
Tue, 18 Dec 2018 15:14:45 +0000 (15:14 +0000)
When KVM traps an unhandled sysreg/coproc access from a guest, it logs
the guest PC. To aid debugging, it would be helpful to know which
exception level the trap came from, along with other PSTATE/CPSR bits,
so let's log the PSTATE/CPSR too.

Acked-by: Christoffer Dall <christoffer.dall@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
arch/arm/kvm/coproc.c
arch/arm64/kvm/sys_regs.c

index cb094e55dc5f12cacd25bde0b5b9eb853c6f3eeb..222c1635bc7a1337c80e3af115df5f0696f52a7d 100644 (file)
@@ -602,8 +602,8 @@ static int emulate_cp15(struct kvm_vcpu *vcpu,
                }
        } else {
                /* If access function fails, it should complain. */
-               kvm_err("Unsupported guest CP15 access at: %08lx\n",
-                       *vcpu_pc(vcpu));
+               kvm_err("Unsupported guest CP15 access at: %08lx [%08lx]\n",
+                       *vcpu_pc(vcpu), *vcpu_cpsr(vcpu));
                print_cp_instr(params);
                kvm_inject_undefined(vcpu);
        }
index 22fbbdbece3caf19fcc070c736f30956c4419c8c..ecbf67ccabf59d3c9d06fbaae1b30a135f7a85b2 100644 (file)
@@ -1912,8 +1912,8 @@ static void unhandled_cp_access(struct kvm_vcpu *vcpu,
                WARN_ON(1);
        }
 
-       kvm_err("Unsupported guest CP%d access at: %08lx\n",
-               cp, *vcpu_pc(vcpu));
+       kvm_err("Unsupported guest CP%d access at: %08lx [%08lx]\n",
+               cp, *vcpu_pc(vcpu), *vcpu_cpsr(vcpu));
        print_sys_reg_instr(params);
        kvm_inject_undefined(vcpu);
 }
@@ -2063,8 +2063,8 @@ static int emulate_sys_reg(struct kvm_vcpu *vcpu,
        if (likely(r)) {
                perform_access(vcpu, params, r);
        } else {
-               kvm_err("Unsupported guest sys_reg access at: %lx\n",
-                       *vcpu_pc(vcpu));
+               kvm_err("Unsupported guest sys_reg access at: %lx [%08lx]\n",
+                       *vcpu_pc(vcpu), *vcpu_cpsr(vcpu));
                print_sys_reg_instr(params);
                kvm_inject_undefined(vcpu);
        }