linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2 7/7] arm64: kvm: decode ESR_ELx.EC when reporting exceptions
Date: Mon, 12 Jan 2015 16:45:20 +0000	[thread overview]
Message-ID: <1421081120-7694-8-git-send-email-mark.rutland@arm.com> (raw)
In-Reply-To: <1421081120-7694-1-git-send-email-mark.rutland@arm.com>

To aid the developer when something triggers an unexpected exception,
decode the ESR_ELx.EC field when logging an ESR_ELx value using the
newly introduced esr_get_class_string. This doesn't tell the developer
the specifics of the exception encoded in the remaining IL and ISS bits,
but it can be helpful to distinguish between exception classes (e.g.
SError and a data abort) without having to manually decode the field,
which can be tiresome.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Will Deacon <will.deacon@arm.com>
---
 arch/arm64/kvm/handle_exit.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c
index bcbc923..29b184a 100644
--- a/arch/arm64/kvm/handle_exit.c
+++ b/arch/arm64/kvm/handle_exit.c
@@ -91,12 +91,13 @@ static exit_handle_fn arm_exit_handlers[] = {
 
 static exit_handle_fn kvm_get_exit_handler(struct kvm_vcpu *vcpu)
 {
-	u8 hsr_ec = kvm_vcpu_trap_get_class(vcpu);
+	u32 hsr = kvm_vcpu_get_hsr(vcpu);
+	u8 hsr_ec = hsr >> ESR_ELx_EC_SHIFT;
 
 	if (hsr_ec >= ARRAY_SIZE(arm_exit_handlers) ||
 	    !arm_exit_handlers[hsr_ec]) {
-		kvm_err("Unknown exception class: hsr: %#08x\n",
-			(unsigned int)kvm_vcpu_get_hsr(vcpu));
+		kvm_err("Unknown exception class: hsr: %#08x -- %s\n",
+			hsr, esr_get_class_string(hsr));
 		BUG();
 	}
 
-- 
1.9.1

  parent reply	other threads:[~2015-01-12 16:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-12 16:45 [PATCHv2 0/7] arm64/kvm: common ESR_ELx definitions and decoding Mark Rutland
2015-01-12 16:45 ` [PATCHv2 1/7] arm64: introduce common ESR_ELx_* definitions Mark Rutland
2015-01-12 16:45 ` [PATCHv2 2/7] arm64: move to ESR_ELx macros Mark Rutland
2015-01-12 16:45 ` [PATCHv2 3/7] arm64: decode ESR_ELx.EC when reporting exceptions Mark Rutland
2015-01-12 16:45 ` [PATCHv2 4/7] arm64: kvm: move to ESR_ELx macros Mark Rutland
2015-01-12 16:45 ` [PATCHv2 5/7] arm64: remove ESR_EL1_* macros Mark Rutland
2015-01-12 16:45 ` [PATCHv2 6/7] arm64: kvm: remove ESR_EL2_* macros Mark Rutland
2015-01-12 16:45 ` Mark Rutland [this message]
2015-01-12 19:44 ` [PATCHv2 0/7] arm64/kvm: common ESR_ELx definitions and decoding Christoffer Dall
2015-01-15 12:42   ` Mark Rutland
2015-01-15 13:08     ` Christoffer Dall
2015-01-15 15:12       ` Catalin Marinas
2015-01-15 19:16         ` Christoffer Dall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1421081120-7694-8-git-send-email-mark.rutland@arm.com \
    --to=mark.rutland@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).