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

[Xen-devel] [PATCH 09 of 11] arm: new hook for late MMU setup on secondary CPUs



# HG changeset patch
# User Tim Deegan <tim@xxxxxxx>
# Date 1331311595 0
# Node ID 80b8756718af745fae2778c625a8eea6235974fe
# Parent  9b746bfac6bbb3c2181fe14676d76aa55e7c748c
arm: new hook for late MMU setup on secondary CPUs

The boot CPU turns on W^X in setup_pagetables().  Do the same for other
CPUs after they boot.  If we go to per-CPU pagetables, this is where
that will happen.

Signed-off-by: Tim Deegan <tim@xxxxxxx>

diff -r 9b746bfac6bb -r 80b8756718af xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c Fri Mar 09 16:46:35 2012 +0000
+++ b/xen/arch/arm/mm.c Fri Mar 09 16:46:35 2012 +0000
@@ -263,6 +263,13 @@ void __init setup_pagetables(unsigned lo
     WRITE_CP32(READ_CP32(HSCTLR) | SCTLR_WXN, HSCTLR);
 }
 
+/* MMU setup for secondary CPUS (which already have paging enabled) */
+void __cpuinit mmu_init_secondary_cpu(void)
+{
+    /* From now on, no mapping may be both writable and executable. */
+    WRITE_CP32(READ_CP32(HSCTLR) | SCTLR_WXN, HSCTLR);
+}
+
 /* Create Xen's mappings of memory.
  * Base and virt must be 32MB aligned and size a multiple of 32MB. */
 static void __init create_mappings(unsigned long virt,
diff -r 9b746bfac6bb -r 80b8756718af xen/arch/arm/smpboot.c
--- a/xen/arch/arm/smpboot.c    Fri Mar 09 16:46:35 2012 +0000
+++ b/xen/arch/arm/smpboot.c    Fri Mar 09 16:46:35 2012 +0000
@@ -76,6 +76,7 @@ void __cpuinit start_secondary(unsigned 
 
     dprintk(XENLOG_DEBUG, "CPU %li awake.\n", cpuid);
 
+    mmu_init_secondary_cpu();
     gic_init_secondary_cpu();
 
     set_current(idle_vcpu[cpuid]);
diff -r 9b746bfac6bb -r 80b8756718af xen/include/asm-arm/mm.h
--- a/xen/include/asm-arm/mm.h  Fri Mar 09 16:46:35 2012 +0000
+++ b/xen/include/asm-arm/mm.h  Fri Mar 09 16:46:35 2012 +0000
@@ -136,6 +136,8 @@ extern unsigned long total_pages;
 
 /* Boot-time pagetable setup */
 extern void setup_pagetables(unsigned long boot_phys_offset);
+/* MMU setup for seccondary CPUS (which already have paging enabled) */
+extern void __cpuinit mmu_init_secondary_cpu(void);
 /* Set up the xenheap: up to 1GB of contiguous, always-mapped memory.
  * Base must be 32MB aligned and size a multiple of 32MB. */
 extern void setup_xenheap_mappings(unsigned long base_mfn, unsigned long 
nr_mfns);

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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