[Xen-devel,06/22] xen/arm: Move VABORT_GEN_BY_GUEST to traps.h and turned into inline

Message ID 20181018132109.31192-7-julien.grall@arm.com
State Superseded
Headers show
Series
  • xen/arm: Bunch of clean-ups
Related show

Commit Message

Julien Grall Oct. 18, 2018, 1:20 p.m.
The macro VABORT_GEN_BY_GUEST is only used by the trap code. So move it
to trap.h.

While moving the code, convert is to a static inline to allow typecheck.

Signed-off-by: Julien Grall <julien.grall@arm.com>
---
 xen/include/asm-arm/processor.h | 10 ----------
 xen/include/asm-arm/traps.h     | 10 ++++++++++
 2 files changed, 10 insertions(+), 10 deletions(-)

Comments

Andrii Anisov Oct. 25, 2018, 3:32 p.m. | #1
On 18.10.18 16:20, Julien Grall wrote:
> The macro VABORT_GEN_BY_GUEST is only used by the trap code. So move it
> to trap.h.
>
> While moving the code, convert is to a static inline to allow typecheck.
>
> Signed-off-by: Julien Grall <julien.grall@arm.com>
> ---

Reviewed-by: Andrii Anisov<andrii_anisov@epam.com>

Patch

diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index f7a2e9a3ad..5b6bd0c38c 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -683,16 +683,6 @@  void do_trap_guest_serror(struct cpu_user_regs *regs);
 
 register_t get_default_hcr_flags(void);
 
-/* Functions for pending virtual abort checking window. */
-void abort_guest_exit_start(void);
-void abort_guest_exit_end(void);
-
-#define VABORT_GEN_BY_GUEST(r)  \
-( \
-    ( (unsigned long)abort_guest_exit_start == (r)->pc ) || \
-    ( (unsigned long)abort_guest_exit_end == (r)->pc ) \
-)
-
 /*
  * Synchronize SError unless the feature is selected.
  * This is relying on the SErrors are currently unmasked.
diff --git a/xen/include/asm-arm/traps.h b/xen/include/asm-arm/traps.h
index 059aa370c3..c12e9e4082 100644
--- a/xen/include/asm-arm/traps.h
+++ b/xen/include/asm-arm/traps.h
@@ -45,6 +45,16 @@  void do_trap_hvc_smccc(struct cpu_user_regs *regs);
 
 int do_bug_frame(struct cpu_user_regs *regs, vaddr_t pc);
 
+/* Functions for pending virtual abort checking window. */
+void abort_guest_exit_start(void);
+void abort_guest_exit_end(void);
+
+static inline bool VABORT_GEN_BY_GUEST(const struct cpu_user_regs *regs)
+{
+    return ((unsigned long)abort_guest_exit_start == regs->pc) ||
+        (unsigned long)abort_guest_exit_end == regs->pc;
+}
+
 #endif /* __ASM_ARM_TRAPS__ */
 /*
  * Local variables: