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

[Xen-changelog] [xen stable-4.6] setup vwfi correctly on cpu0



commit cf35a354efe2d45d6c345455100fc8023eb038e2
Author:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
AuthorDate: Fri Mar 31 15:37:07 2017 -0700
Commit:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
CommitDate: Fri Apr 7 16:19:15 2017 -0700

    setup vwfi correctly on cpu0
    
    parse_vwfi runs after init_traps on cpu0, potentially resulting in the
    wrong HCR_EL2 for it. Secondary cpus boot after parse_vwfi, so in their
    case init_traps will write the correct set of flags to HCR_EL2.
    
    For cpu0, fix the issue by changing HCR_EL2 setting from a new
    presmp_initcall.
    
    Signed-off-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
    Reviewed-by: Julien Grall <julien.grall@xxxxxxx>
---
 xen/arch/arm/traps.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 5dbc8be..5499493 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -112,6 +112,25 @@ static void __init parse_vwfi(const char *s)
 }
 custom_param("vwfi", parse_vwfi);
 
+static int __init vwfi_init(void)
+{
+    /*
+     * HCR_EL2 has already been set on cpu0, change the setting here, if
+     * needed. Other cpus haven't booted yet, init_traps will setup
+     * HCR_EL2 correctly.
+     */
+    if ( vwfi == NATIVE )
+    {
+        register_t hcr;
+
+        hcr = READ_SYSREG(HCR_EL2);
+        WRITE_SYSREG(hcr & ~(HCR_TWI|HCR_TWE), HCR_EL2);
+    }
+
+    return 0;
+}
+presmp_initcall(vwfi_init);
+
 void __cpuinit init_traps(void)
 {
     /* Setup Hyp vector base */
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.6

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
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®.