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

[Xen-devel] [PATCH v2 5/8] xen/arm: preserve DTB mappings



At the moment we destroy the DTB mappings we have in setup_pagetables
and we don't restore them until setup_mm.

Keep the temporary DTB mapping until we create the new ones.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
 xen/arch/arm/kernel.h    |    2 ++
 xen/arch/arm/mm.c        |   12 ++++++++++++
 xen/arch/arm/setup.c     |    1 +
 xen/include/asm-arm/mm.h |    2 ++
 4 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/xen/arch/arm/kernel.h b/xen/arch/arm/kernel.h
index 4533568..a179ffb 100644
--- a/xen/arch/arm/kernel.h
+++ b/xen/arch/arm/kernel.h
@@ -38,4 +38,6 @@ struct kernel_info {
 int kernel_prepare(struct kernel_info *info);
 void kernel_load(struct kernel_info *info);
 
+extern char _sdtb[];
+
 #endif /* #ifdef __ARCH_ARM_KERNEL_H__ */
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 0d7a163..2410794 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -34,6 +34,7 @@
 #include <asm/current.h>
 #include <public/memory.h>
 #include <xen/sched.h>
+#include "kernel.h"
 
 struct domain *dom_xen, *dom_io;
 
@@ -295,12 +296,23 @@ void __init setup_pagetables(unsigned long 
boot_phys_offset, paddr_t xen_paddr)
     write_pte(xen_second + second_linear_offset(XEN_VIRT_START), pte);
     /* TLBFLUSH and ISB would be needed here, but wait until we set WXN */
 
+    /* preserve the DTB mapping a little while longer */
+    pte = mfn_to_xen_entry(((unsigned long) _sdtb + boot_phys_offset) >> 
PAGE_SHIFT);
+    write_pte(xen_second + second_linear_offset(BOOT_MISC_VIRT_START), pte);
+
     /* From now on, no mapping may be both writable and executable. */
     WRITE_CP32(READ_CP32(HSCTLR) | SCTLR_WXN, HSCTLR);
     /* Flush everything after setting WXN bit. */
     flush_xen_text_tlb();
 }
 
+void __init destroy_dtb_mapping(void)
+{
+    /* destroy old DTB mapping */
+    xen_second[second_linear_offset(BOOT_MISC_VIRT_START)].bits = 0;
+    dsb();
+}
+
 /* MMU setup for secondary CPUS (which already have paging enabled) */
 void __cpuinit mmu_init_secondary_cpu(void)
 {
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 70397ce..64420ef 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -230,6 +230,7 @@ void __init start_xen(unsigned long boot_phys_offset,
 
     init_xen_time();
 
+    destroy_dtb_mapping();
     setup_mm(atag_paddr, fdt_size);
 
     /* Setup Hyp vector base */
diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h
index 4ed5df6..6fa4308 100644
--- a/xen/include/asm-arm/mm.h
+++ b/xen/include/asm-arm/mm.h
@@ -139,6 +139,8 @@ extern unsigned long total_pages;
 
 /* Boot-time pagetable setup */
 extern void setup_pagetables(unsigned long boot_phys_offset, paddr_t 
xen_paddr);
+/* Destroy temporary DTB mapping */
+extern void destroy_dtb_mapping(void);
 /* 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.
-- 
1.7.2.5


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