diff mbox series

[Xen-devel,for-4.13,v4,10/19] xen/arm32: entry: Rename save_guest_regs()

Message ID 20191031150922.22938-11-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
The function save_guest_regs() is doing more than saving guest
registers. It also restore the vectors table and consume any pending
SErrors generated by the guest. So rename the function to
arch_enter_hypervisor_from_guest_preirq().

Take the opportunity to use ENDPROC() for the benefits of static
analizer and the reader.

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

---

The name of the label is quite long but this was the best I came up. Other
suggestions made were guest_vector() and guest_entry().

I think guest_vector() is a no-go because we are only implementing part of the
vector.

Regarding guest_entry(), this is debatable because from the guest PoV, you
exit it so it can be misleading. I actually got confused more than one time.

Another possibility would be enter_from_guest(), but this is fairly
close to enter_hypervisor_from_guest(). The code would look like:

bl enter_from_guest
csie ...
bl enter_hypervisor_from_guest

Any other suggestion for the name?

    Changes in v3:
        - Patch added
---
 xen/arch/arm/arm32/entry.S | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/xen/arch/arm/arm32/entry.S b/xen/arch/arm/arm32/entry.S
index 5abff24e91..cea4e0e302 100644
--- a/xen/arch/arm/arm32/entry.S
+++ b/xen/arch/arm/arm32/entry.S
@@ -24,7 +24,11 @@ 
 #define RESTORE_BANKED(mode) \
         RESTORE_ONE_BANKED(SP_##mode) ; RESTORE_ONE_BANKED(LR_##mode) ; RESTORE_ONE_BANKED(SPSR_##mode)
 
-save_guest_regs:
+/*
+ * Actions that needs to be done after entering the hypervisor from the
+ * guest and before the interrupts are unmasked.
+ */
+arch_enter_hypervisor_from_guest_preirq:
 #ifdef CONFIG_ARM32_HARDEN_BRANCH_PREDICTOR
         /*
          * Restore vectors table to the default as it may have been
@@ -115,6 +119,7 @@  abort_guest_exit_end:
 
 skip_check:
         mov pc, lr
+ENDPROC(arch_enter_hypervisor_from_guest_preirq)
 
         /*
          * Macro to define a trap entry.
@@ -173,7 +178,7 @@  skip_check:
 
 1:
         /* Trap from the guest */
-        bl      save_guest_regs
+        bl      arch_enter_hypervisor_from_guest_preirq
         .if     \guest_iflags != n
         cpsie   \guest_iflags
         .endif
@@ -363,7 +368,7 @@  return_to_hypervisor:
          * HVBAR very late.
          *
          * Default vectors table will be restored on exit (see
-         * save_guest_regs).
+         * arch_enter_hypervisor_from_guest_preirq).
          */
         mov r9, #0                      /* vector tables = NULL */
         /*