From: Julien Grall <julien.grall@linaro.org>
To: xen-devel@lists.xen.org
Cc: sstabellini@kernel.org, Julien Grall <julien.grall@linaro.org>,
andre.przywara@linaro.org
Subject: [PATCH v4 1/7] xen/arm32: entry: Consolidate DEFINE_TRAP_ENTRY_* macros
Date: Fri, 2 Feb 2018 14:19:19 +0000 [thread overview]
Message-ID: <20180202141925.19387-2-julien.grall@linaro.org> (raw)
In-Reply-To: <20180202141925.19387-1-julien.grall@linaro.org>
The only difference between all the DEFINE_TRAP_ENTRY_* macros are the
interrupts (Asynchronous Abort, IRQ, FIQ) unmasked.
Rather than duplicating the code, introduce __DEFINE_TRAP_ENTRY macro
that will take the list of interrupts to unmask.
This is part of XSA-254.
Signed-off-by: Julien Grall <julien.grall@linaro.org>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
Changes in v2:
- Add Stefano's reviewed-by
---
xen/arch/arm/arm32/entry.S | 36 +++++++++++++-----------------------
1 file changed, 13 insertions(+), 23 deletions(-)
diff --git a/xen/arch/arm/arm32/entry.S b/xen/arch/arm/arm32/entry.S
index 120922e64e..c6490d2847 100644
--- a/xen/arch/arm/arm32/entry.S
+++ b/xen/arch/arm/arm32/entry.S
@@ -111,39 +111,29 @@ abort_guest_exit_end:
skip_check:
mov pc, lr
-#define DEFINE_TRAP_ENTRY(trap) \
+/*
+ * Macro to define trap entry. The iflags corresponds to the list of
+ * interrupts (Asynchronous Abort, IRQ, FIQ) to unmask.
+ */
+#define __DEFINE_TRAP_ENTRY(trap, iflags) \
ALIGN; \
trap_##trap: \
SAVE_ALL; \
- cpsie i; /* local_irq_enable */ \
- cpsie a; /* asynchronous abort enable */ \
+ cpsie iflags; \
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_NOIRQ(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
+/* Trap handler which unmask IRQ/Abort, keep FIQ masked */
+#define DEFINE_TRAP_ENTRY(trap) __DEFINE_TRAP_ENTRY(trap, ai)
-#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; \
- bic sp, #7; /* Align the stack pointer (noop on guest trap) */ \
- b do_trap_##trap
+/* Trap handler which unmask Abort, keep IRQ/FIQ masked */
+#define DEFINE_TRAP_ENTRY_NOIRQ(trap) __DEFINE_TRAP_ENTRY(trap, a)
+
+/* Trap handler which unmask IRQ, keep Abort/FIQ masked */
+#define DEFINE_TRAP_ENTRY_NOABORT(trap) __DEFINE_TRAP_ENTRY(trap, i)
.align 5
GLOBAL(hyp_traps_vector)
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-02-02 14:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-02 14:19 [PATCH v4 0/7] xen/arm32: Branch predictor hardening (XSA-254 variant 2) Julien Grall
2018-02-02 14:19 ` Julien Grall [this message]
2018-02-02 14:19 ` [PATCH v4 2/7] xen/arm32: Add missing MIDR values for Cortex-A17 and A12 Julien Grall
2018-02-02 14:19 ` [PATCH v4 3/7] xen/arm32: entry: Add missing trap_reset entry Julien Grall
2018-02-02 14:19 ` [PATCH v4 4/7] xen/arm32: Add skeleton to harden branch predictor aliasing attacks Julien Grall
2018-02-02 14:19 ` [PATCH v4 5/7] xen/arm32: Invalidate BTB on guest exit for Cortex A17 and 12 Julien Grall
2018-02-02 14:19 ` [PATCH v4 6/7] xen/arm32: Invalidate icache on guest exist for Cortex-A15 Julien Grall
2018-02-02 14:19 ` [PATCH v4 7/7] xen/arm32: entry: Document the purpose of r11 in the traps handler Julien Grall
2018-02-02 19:38 ` [PATCH v4 0/7] xen/arm32: Branch predictor hardening (XSA-254 variant 2) 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=20180202141925.19387-2-julien.grall@linaro.org \
--to=julien.grall@linaro.org \
--cc=andre.przywara@linaro.org \
--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).