xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: xen-devel@lists.xen.org
Cc: Julien Grall <julien.grall@arm.com>, sstabellini@kernel.org
Subject: [PATCH v3 1/6] xen/arm: traps: Simplify the switch in do_trap_*_abort_guest
Date: Thu,  4 Aug 2016 18:50:02 +0100	[thread overview]
Message-ID: <1470333007-25178-2-git-send-email-julien.grall@arm.com> (raw)
In-Reply-To: <1470333007-25178-1-git-send-email-julien.grall@arm.com>

The fault status we care are in the form BBBBxx where xx is the lookup
level that gave the fault. We can simplify the code by masking the 2 least
significant bits.

Signed-off-by: Julien Grall <julien.grall@arm.com>

---
    The switch has not been replaced by a simple if because more case
    will be added in follow-up patches.

    Changes in v2:
        - Fix typoes in the commit message
---
 xen/arch/arm/traps.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 0f78d21..b11d2e5 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -2387,9 +2387,9 @@ static void do_trap_instr_abort_guest(struct cpu_user_regs *regs,
     int rc;
     register_t gva = READ_SYSREG(FAR_EL2);
 
-    switch ( hsr.iabt.ifsc & 0x3f )
+    switch ( hsr.iabt.ifsc & ~FSC_LL_MASK )
     {
-    case FSC_FLT_PERM ... FSC_FLT_PERM + 3:
+    case FSC_FLT_PERM:
     {
         paddr_t gpa;
         const struct npfec npfec = {
@@ -2450,9 +2450,9 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs,
             return; /* Try again */
     }
 
-    switch ( dabt.dfsc & 0x3f )
+    switch ( dabt.dfsc & ~FSC_LL_MASK )
     {
-    case FSC_FLT_PERM ... FSC_FLT_PERM + 3:
+    case FSC_FLT_PERM:
     {
         const struct npfec npfec = {
             .read_access = !dabt.write,
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2016-08-04 17:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-04 17:50 [PATCH v3 0/6] xen/arm: Simplify do_trap_*_abort_guest Julien Grall
2016-08-04 17:50 ` Julien Grall [this message]
2016-08-04 17:52   ` [PATCH v3 1/6] xen/arm: traps: Simplify the switch in do_trap_*_abort_guest Julien Grall
2016-08-04 17:50 ` [PATCH v3 2/6] xen/arm: Provide macros to help creating workaround helpers Julien Grall
2016-08-04 17:52   ` Julien Grall
2016-08-04 17:50 ` [PATCH v3 3/6] xen/arm: Use check_workaround to handle the erratum 766422 Julien Grall
2016-08-04 17:53   ` Julien Grall
2016-08-04 17:50 ` [PATCH v3 4/6] xen/arm: traps: MMIO should only be emulated for fault translation Julien Grall
2016-08-04 17:50 ` [PATCH v3 5/6] xen/arm: traps: Avoid unnecessary VA -> IPA translation in abort handlers Julien Grall
2016-08-04 17:50 ` [PATCH v3 6/6] xen/arm: arm64: Add Cortex-A57 erratum 834220 workaround Julien Grall
2016-08-04 17:59 ` [PATCH v3 0/6] xen/arm: Simplify do_trap_*_abort_guest Stefano Stabellini

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=1470333007-25178-2-git-send-email-julien.grall@arm.com \
    --to=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xen.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).