[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen stable-4.5] xen/arm64: ensure that the correct SP is used for exceptions



commit 4065709a02a963c86ba64631c123ea2481c71712
Author:     Kyle J. Temkin <temkink@xxxxxxxxxxxx>
AuthorDate: Thu Apr 28 13:14:07 2016 -0400
Commit:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
CommitDate: Tue May 17 11:29:59 2016 +0100

    xen/arm64: ensure that the correct SP is used for exceptions
    
    The ARMv8 architecture has a SPSel ("stack pointer selection") machine
    register that allows us to determine which exception level's stack
    pointer is loaded when an exception occurs. As we don't want to
    use the non-privileged SP_EL0 stack pointer -- or even assume that SP_EL0
    points to a valid address in the hypervisor context--  we'll need to ensure
    that our EL2 code sets the SPSel to SP_ELn mode, so exceptions that trap
    to EL2 use the EL2 stack pointer.
    
    This corrects an issue that can manifest as a hang-on-IRQ on some
    arm64 cores if the firmware/bootloader has previously initialized SPSel
    to 0; in which case Xen's exceptions will incorrectly use an invalid SP_EL0,
    and will endlessly spin on the synchronous abort handler.
    
    Signed-off-by: Kyle Temkin <temkink@xxxxxxxxxxxx>
    Signed-off-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
    Reviewed-by: Julien Grall <julien.grall@xxxxxxx>
---
 xen/arch/arm/arm64/head.S | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index c63f4d2..4bf85ff 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -361,6 +361,11 @@ skip_bss:
         ldr   x0, =(HSCTLR_BASE)
         msr   SCTLR_EL2, x0
 
+        /* Ensure that any exceptions encountered at EL2
+         * are handled using the EL2 stack pointer, rather
+         * than SP_EL0. */
+        msr spsel, #1
+
         /* Rebuild the boot pagetable's first-level entries. The structure
          * is described in mm.c.
          *
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.5

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.