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

[Xen-changelog] [xen stable-4.10] xen/arm: vpsci: Rework the logic to start AArch32 vCPU in Thumb mode



commit d9756ca9802ace4037a84b947753e35ba634fd93
Author:     Julien Grall <julien.grall@xxxxxxx>
AuthorDate: Fri Feb 23 18:57:29 2018 +0000
Commit:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
CommitDate: Tue Apr 3 16:51:58 2018 -0700

    xen/arm: vpsci: Rework the logic to start AArch32 vCPU in Thumb mode
    
    32-bit domain is able to select the instruction (ARM vs Thumb) to use
    when boot a new vCPU via CPU_ON. This is indicated via bit[0] of the
    entry point address (see "T32 support" in PSCI v1.1 DEN0022D). bit[0]
    must be cleared when setting the PC.
    
    At the moment, Xen is setting the CPSR.T but never clear bit[0]. Clear
    it to match the specification.
    
    At the same time, slighlty rework the code to make clear thumb is only for
    32-bit domain. Lastly, take the opportunity to switch is_thumb from int
    to bool.
    
    Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
    Reviewed-by: Andre Przywara <andre.przywara@xxxxxxx>
    Signed-off-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
    (cherry picked from commit cd8b749282475caef095ea2f339a01d1ff9714ae)
---
 xen/arch/arm/vpsci.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/vpsci.c b/xen/arch/arm/vpsci.c
index 03d6ef1ad6..1a2fbf55c0 100644
--- a/xen/arch/arm/vpsci.c
+++ b/xen/arch/arm/vpsci.c
@@ -29,7 +29,7 @@ static int do_common_cpu_on(register_t target_cpu, register_t 
entry_point,
     struct domain *d = current->domain;
     struct vcpu_guest_context *ctxt;
     int rc;
-    int is_thumb = entry_point & 1;
+    bool is_thumb = entry_point & 1;
     register_t vcpuid;
 
     vcpuid = vaffinity_to_vcpuid(target_cpu);
@@ -63,6 +63,13 @@ static int do_common_cpu_on(register_t target_cpu, 
register_t entry_point,
     if ( is_32bit_domain(d) )
     {
         ctxt->user_regs.cpsr = PSR_GUEST32_INIT;
+        /* Start the VCPU with THUMB set if it's requested by the kernel */
+        if ( is_thumb )
+        {
+            ctxt->user_regs.cpsr |= PSR_THUMB;
+            ctxt->user_regs.pc64 &= ~(u64)1;
+        }
+
         ctxt->user_regs.r0_usr = context_id;
     }
 #ifdef CONFIG_ARM_64
@@ -72,10 +79,6 @@ static int do_common_cpu_on(register_t target_cpu, 
register_t entry_point,
         ctxt->user_regs.x0 = context_id;
     }
 #endif
-
-    /* Start the VCPU with THUMB set if it's requested by the kernel */
-    if ( is_thumb )
-        ctxt->user_regs.cpsr |= PSR_THUMB;
     ctxt->flags = VGCF_online;
 
     domain_lock(d);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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