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

[Xen-devel] [PATCH 6/7] xen/arm: Setup virtual paging for secondary CPUs in non-boot scenario



In existing code the paging for secondary CPUs is setup only in boot flow.
The setup is triggered from start_xen function after all CPUs are brought
online. In other words, the initialization of VTCR_EL2 register is done
out of the cpu_up/start_secondary control flow. However, the cpu_up flow
should be self-contained - it should fully initialize a secondary CPU,
because the cpu_up is used not only to bring a secondary CPU online on
boot, but also to hotplug a CPU during the system resume.
With this patch the setting of paging is triggered from start_secondary
function if the current system state is not boot. This way, the paging
will be setup in non-boot scenarios, while the setup in boot scenario
remains unchanged.

Signed-off-by: Mirela Simonovic <mirela.simonovic@xxxxxxxxxx>
---
 xen/arch/arm/p2m.c        | 10 ++++++++--
 xen/arch/arm/smpboot.c    |  3 +++
 xen/include/asm-arm/p2m.h |  3 +++
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index d43c3aa896..d041b4d24b 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1451,9 +1451,15 @@ err:
     return page;
 }
 
-static void __init setup_virt_paging_one(void *data)
+void setup_virt_paging_one(void *data)
 {
-    unsigned long val = (unsigned long)data;
+    static unsigned long vtcr_data;
+    unsigned long val;
+
+    if ( data )
+        vtcr_data = (unsigned long)data;
+    val = vtcr_data;
+
     WRITE_SYSREG32(val, VTCR_EL2);
     isb();
 }
diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index d15ea8df5e..dae4427320 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -360,6 +360,9 @@ void start_secondary(unsigned long boot_phys_offset,
 
     check_local_cpu_errata();
 
+    if ( system_state != SYS_STATE_boot )
+        setup_virt_paging_one(NULL);
+
     printk(XENLOG_DEBUG "CPU %u booted.\n", smp_processor_id());
 
     startup_cpu_idle_loop();
diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h
index 8823707c17..6cc36ebbc3 100644
--- a/xen/include/asm-arm/p2m.h
+++ b/xen/include/asm-arm/p2m.h
@@ -153,6 +153,9 @@ void p2m_altp2m_check(struct vcpu *v, uint16_t idx)
 /* Second stage paging setup, to be called on all CPUs */
 void setup_virt_paging(void);
 
+/* Second stage paging setup, to be called by one CPU out of the boot flow */
+void setup_virt_paging_one(void *data);
+
 /* Init the datastructures for later use by the p2m code */
 int p2m_init(struct domain *d);
 
-- 
2.13.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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