All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Chen <Wei.Chen@arm.com>
To: xen-devel@lists.xen.org
Cc: sstabellini@kernel.org, wei.chen@arm.com, steve.capper@arm.com,
	Kaly.Xin@arm.com, julien.grall@arm.com, nd@arm.com
Subject: [PATCH v3 14/19] xen/arm: Unmask the Abort/SError bit in the exception entries
Date: Fri, 31 Mar 2017 21:07:54 +0800	[thread overview]
Message-ID: <1490965679-619-15-git-send-email-Wei.Chen@arm.com> (raw)
In-Reply-To: <1490965679-619-1-git-send-email-Wei.Chen@arm.com>

Currently, we masked the Abort/SError bit in Xen exception entries.
So Xen could not capture any Abort/SError while it's running.
Now, Xen has the ability to handle the Abort/SError, we should unmask
the Abort/SError bit by default to let Xen capture Abort/SError while
it's running.

But in order to avoid receiving nested asynchronous abort, we don't
unmask Abort/SError bit in hyp_error and trap_data_abort.

Signed-off-by: Wei Chen <Wei.Chen@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/arm32/entry.S | 15 ++++++++++++++-
 xen/arch/arm/arm64/entry.S | 13 ++++++++-----
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/xen/arch/arm/arm32/entry.S b/xen/arch/arm/arm32/entry.S
index 105cae8..592e4a8 100644
--- a/xen/arch/arm/arm32/entry.S
+++ b/xen/arch/arm/arm32/entry.S
@@ -116,6 +116,7 @@ skip_check:
 trap_##trap:                                                            \
         SAVE_ALL;                                                       \
         cpsie i;        /* local_irq_enable */                          \
+        cpsie a;        /* asynchronous abort enable */                 \
         adr lr, return_from_trap;                                       \
         mov r0, sp;                                                     \
         mov r11, sp;                                                    \
@@ -126,6 +127,18 @@ trap_##trap:                                                            \
         ALIGN;                                                          \
 trap_##trap:                                                            \
         SAVE_ALL;                                                       \
+        cpsie a;        /* asynchronous abort enable */                 \
+        adr lr, return_from_trap;                                       \
+        mov r0, sp;                                                     \
+        mov r11, sp;                                                    \
+        bic sp, #7; /* Align the stack pointer (noop on guest trap) */  \
+        b do_trap_##trap
+
+#define DEFINE_TRAP_ENTRY_NOABORT(trap)                                 \
+        ALIGN;                                                          \
+trap_##trap:                                                            \
+        SAVE_ALL;                                                       \
+        cpsie i;        /* local_irq_enable */                          \
         adr lr, return_from_trap;                                       \
         mov r0, sp;                                                     \
         mov r11, sp;                                                    \
@@ -146,10 +159,10 @@ GLOBAL(hyp_traps_vector)
 DEFINE_TRAP_ENTRY(undefined_instruction)
 DEFINE_TRAP_ENTRY(supervisor_call)
 DEFINE_TRAP_ENTRY(prefetch_abort)
-DEFINE_TRAP_ENTRY(data_abort)
 DEFINE_TRAP_ENTRY(hypervisor)
 DEFINE_TRAP_ENTRY_NOIRQ(irq)
 DEFINE_TRAP_ENTRY_NOIRQ(fiq)
+DEFINE_TRAP_ENTRY_NOABORT(data_abort)
 
 return_from_trap:
         mov sp, r11
diff --git a/xen/arch/arm/arm64/entry.S b/xen/arch/arm/arm64/entry.S
index 8d5a890..0401a41 100644
--- a/xen/arch/arm/arm64/entry.S
+++ b/xen/arch/arm/arm64/entry.S
@@ -187,13 +187,14 @@ hyp_error:
 /* Traps taken in Current EL with SP_ELx */
 hyp_sync:
         entry   hyp=1
-        msr     daifclr, #2
+        msr     daifclr, #6
         mov     x0, sp
         bl      do_trap_hypervisor
         exit    hyp=1
 
 hyp_irq:
         entry   hyp=1
+        msr     daifclr, #4
         mov     x0, sp
         bl      do_trap_irq
         exit    hyp=1
@@ -208,7 +209,7 @@ guest_sync:
         ALTERNATIVE("bl check_pending_vserror; cbnz x0, 1f",
                     "nop; nop",
                     SKIP_CHECK_PENDING_VSERROR)
-        msr     daifclr, #2
+        msr     daifclr, #6
         mov     x0, sp
         bl      do_trap_hypervisor
 1:
@@ -224,6 +225,7 @@ guest_irq:
         ALTERNATIVE("bl check_pending_vserror; cbnz x0, 1f",
                     "nop; nop",
                     SKIP_CHECK_PENDING_VSERROR)
+        msr     daifclr, #4
         mov     x0, sp
         bl      do_trap_irq
 1:
@@ -235,7 +237,7 @@ guest_fiq_invalid:
 
 guest_error:
         entry   hyp=0, compat=0
-        msr     daifclr, #2
+        msr     daifclr, #6
         mov     x0, sp
         bl      do_trap_guest_serror
         exit    hyp=0, compat=0
@@ -250,7 +252,7 @@ guest_sync_compat:
         ALTERNATIVE("bl check_pending_vserror; cbnz x0, 1f",
                     "nop; nop",
                     SKIP_CHECK_PENDING_VSERROR)
-        msr     daifclr, #2
+        msr     daifclr, #6
         mov     x0, sp
         bl      do_trap_hypervisor
 1:
@@ -266,6 +268,7 @@ guest_irq_compat:
         ALTERNATIVE("bl check_pending_vserror; cbnz x0, 1f",
                     "nop; nop",
                     SKIP_CHECK_PENDING_VSERROR)
+        msr     daifclr, #4
         mov     x0, sp
         bl      do_trap_irq
 1:
@@ -277,7 +280,7 @@ guest_fiq_invalid_compat:
 
 guest_error_compat:
         entry   hyp=0, compat=1
-        msr     daifclr, #2
+        msr     daifclr, #6
         mov     x0, sp
         bl      do_trap_guest_serror
         exit    hyp=0, compat=1
-- 
2.7.4


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

  parent reply	other threads:[~2017-03-31 13:07 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31 13:07 [PATCH v3 00/19] Provide a command line option to choose how to handle SErrors Wei Chen
2017-03-31 13:07 ` [PATCH v3 01/19] xen/arm: Save ESR_EL2 to avoid using mismatched value in syndrome check Wei Chen
2017-03-31 14:08   ` Julien Grall
2017-03-31 18:26   ` Stefano Stabellini
2017-03-31 13:07 ` [PATCH v3 02/19] xen/arm: Introduce a helper to get default HCR_EL2 flags Wei Chen
2017-03-31 14:10   ` Julien Grall
2017-03-31 18:29   ` Stefano Stabellini
2017-03-31 13:07 ` [PATCH v3 03/19] xen/arm: Set and restore HCR_EL2 register for each vCPU separately Wei Chen
2017-03-31 14:11   ` Julien Grall
2017-03-31 18:28   ` Stefano Stabellini
2017-03-31 13:07 ` [PATCH v3 04/19] xen/arm: Avoid setting/clearing HCR_RW at every context switch Wei Chen
2017-03-31 13:07 ` [PATCH v3 05/19] xen/arm: Save HCR_EL2 when a guest took the SError Wei Chen
2017-03-31 13:07 ` [PATCH v3 06/19] xen/arm: Introduce a virtual abort injection helper Wei Chen
2017-03-31 14:13   ` Julien Grall
2017-03-31 13:07 ` [PATCH v3 07/19] xen/arm: Introduce a command line parameter for SErrors/Aborts Wei Chen
2017-03-31 13:07 ` [PATCH v3 08/19] xen/arm: Introduce a initcall to update cpu_hwcaps by serror_op Wei Chen
2017-03-31 14:48   ` Julien Grall
2017-04-05  6:36     ` Wei Chen
2017-03-31 13:07 ` [PATCH v3 09/19] xen/arm64: Use alternative to skip the check of pending serrors Wei Chen
2017-03-31 13:07 ` [PATCH v3 10/19] xen/arm32: " Wei Chen
2017-03-31 13:07 ` [PATCH v3 11/19] xen/arm: Move macro VABORT_GEN_BY_GUEST to common header Wei Chen
2017-03-31 13:07 ` [PATCH v3 12/19] xen/arm: Introduce new helpers to handle guest/hyp SErrors Wei Chen
2017-03-31 13:07 ` [PATCH v3 13/19] xen/arm: Replace do_trap_guest_serror with new helpers Wei Chen
2017-03-31 13:07 ` Wei Chen [this message]
2017-03-31 13:07 ` [PATCH v3 15/19] xen/arm: Introduce a helper to check local abort is enabled Wei Chen
2017-03-31 14:25   ` Julien Grall
2017-03-31 18:43   ` Stefano Stabellini
2017-03-31 13:07 ` [PATCH v3 16/19] xen/arm: Introduce a macro to synchronize SError Wei Chen
2017-03-31 14:33   ` Julien Grall
2017-04-05  7:14     ` Wei Chen
2017-04-05  7:29       ` Julien Grall
2017-04-05  7:35         ` Wei Chen
2017-04-05  8:02           ` Julien Grall
2017-04-05  8:08         ` Wei Chen
2017-04-05  8:20           ` Julien Grall
2017-04-05  8:32             ` Wei Chen
2017-03-31 18:36   ` Stefano Stabellini
2017-03-31 13:07 ` [PATCH v3 17/19] xen/arm: Isolate the SError between the context switch of 2 vCPUs Wei Chen
2017-03-31 14:38   ` Julien Grall
2017-03-31 18:37     ` Stefano Stabellini
2017-03-31 13:07 ` [PATCH v3 18/19] xen/arm: Prevent slipping hypervisor SError to guest Wei Chen
2017-03-31 14:46   ` Julien Grall
2017-03-31 18:42     ` Stefano Stabellini
2017-03-31 18:43       ` Julien Grall
2017-04-05  7:15         ` Wei Chen
2017-03-31 13:07 ` [PATCH v3 19/19] xen/arm: Handle guest external abort as guest SError Wei Chen

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=1490965679-619-15-git-send-email-Wei.Chen@arm.com \
    --to=wei.chen@arm.com \
    --cc=Kaly.Xin@arm.com \
    --cc=julien.grall@arm.com \
    --cc=nd@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=steve.capper@arm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.