diff mbox series

[Xen-devel,for-4.13,v4,17/19] xen/arm: asm: Replace use of ALTERNATIVE with alternative_if

Message ID 20191031150922.22938-18-julien.grall@arm.com
State New
Headers show
Series xen/arm: XSA-201 and XSA-263 fixes | expand

Commit Message

Julien Grall Oct. 31, 2019, 3:09 p.m. UTC
Using alternative_if makes the code a bit more streamlined.

Take the opportunity to use the new auto-nop infrastructure to avoid
counting the number of nop in the else part for arch/arm/arm64/entry.S

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

    This is pretty much a matter of taste, but at least for arm64 this
    allows us to use the auto-nop infrastructure. So the arm32 is more
    to keep inline with arm64.

    Changes in v4:
        - Add Stefano's reviewed-by

    Changes in v3:
        - Fix build on Arm32

    Changes in v2:
        - Correctly use alternative_if{, _not}
 xen/arch/arm/arm32/entry.S | 7 ++++---
 xen/arch/arm/arm64/entry.S | 8 +++++---
 2 files changed, 9 insertions(+), 6 deletions(-)
diff mbox series


diff --git a/xen/arch/arm/arm32/entry.S b/xen/arch/arm/arm32/entry.S
index 0a9c248ee2..34156c4404 100644
--- a/xen/arch/arm/arm32/entry.S
+++ b/xen/arch/arm/arm32/entry.S
@@ -59,9 +59,10 @@  arch_enter_hypervisor_from_guest_preirq:
          * If the SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT has been set in the cpu
          * feature, the checking of pending SErrors will be skipped.
-        ALTERNATIVE("nop",
-                    "b skip_check",
+        b   skip_check
+        alternative_else_nop_endif
          * Start to check pending virtual abort in the gap of Guest -> HYP
          * world switch.
diff --git a/xen/arch/arm/arm64/entry.S b/xen/arch/arm/arm64/entry.S
index d4fb5fdc1c..a8ba7ab961 100644
--- a/xen/arch/arm/arm64/entry.S
+++ b/xen/arch/arm/arm64/entry.S
@@ -188,9 +188,11 @@ 
          * is not set. If a vSError took place, the initial exception will be
          * skipped. Exit ASAP
-        ALTERNATIVE("bl check_pending_vserror; cbnz x0, 1f",
-                    "nop; nop",
+        alternative_if_not SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT
+        bl      check_pending_vserror
+        cbnz    x0, 1f
+        alternative_else_nop_endif
         bl      enter_hypervisor_from_guest_preirq
         msr     daifclr, \iflags
         bl      enter_hypervisor_from_guest