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

[Xen-changelog] [xen stable-4.12] xen/arm: traps: Update the correct PC when inject a virtual SError to the guest



commit 6a66c542ded9731bff5d4a30a67b158584afd20c
Author:     Julien Grall <julien.grall@xxxxxxx>
AuthorDate: Thu Oct 31 15:09:08 2019 +0000
Commit:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
CommitDate: Wed Nov 27 14:29:43 2019 -0800

    xen/arm: traps: Update the correct PC when inject a virtual SError to the 
guest
    
    When injecting a virtual Abort to the guest, we want to update the guest
    PC so it can re-execute the HVC/SMC once it has handled the SError.
    
    This is unfortunately not the case when the SError is synchronized on
    entry from the guest. As the SError will be received while running in
    hypervisor context, we will update the PC of hypervisor context (i.e
    the trap).
    
    Rework inject_vabt_exception so it uses the guest context rather than
    the current one.
    
    Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
    Acked-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
    Release-acked-by: Juergen Gross <jgross@xxxxxxxx>
    (cherry picked from commit 0ae24912ac97f94f437040ae535f273c5f7284f9)
---
 xen/arch/arm/traps.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index a152f4817d..5c45d382d7 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -628,11 +628,18 @@ static void inject_dabt_exception(struct cpu_user_regs 
*regs,
 #endif
 }
 
-/* Inject a virtual Abort/SError into the guest. */
-static void inject_vabt_exception(struct cpu_user_regs *regs)
+/*
+ * Inject a virtual Abort/SError into the guest.
+ *
+ * This should only be called with 'current'.
+ */
+static void inject_vabt_exception(struct vcpu *v)
 {
+    struct cpu_user_regs *regs = guest_cpu_user_regs();
     const union hsr hsr = { .bits = regs->hsr };
 
+    ASSERT(v == current);
+
     /*
      * SVC/HVC/SMC already have an adjusted PC (See ARM ARM DDI 0487A.j
      * D1.10.1 for more details), which we need to correct in order to
@@ -655,7 +662,7 @@ static void inject_vabt_exception(struct cpu_user_regs 
*regs)
         break;
     }
 
-    vcpu_hcr_set_flags(current, HCR_VA);
+    vcpu_hcr_set_flags(v, HCR_VA);
 }
 
 /*
@@ -682,7 +689,7 @@ static void __do_trap_serror(struct cpu_user_regs *regs, 
bool guest)
      * forwarded to the currently running vCPU.
      */
     if ( serrors_op == SERRORS_DIVERSE && guest )
-            return inject_vabt_exception(regs);
+            return inject_vabt_exception(current);
 
     do_unexpected_trap("SError", regs);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12

_______________________________________________
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®.