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

[Xen-devel] [PATCH 12/13] xen: if p2m list located in to be remapped region delay remapping



With adapting the memory layout of dom0 to that of the host care must
be taken not to remap the initial p2m list supported by the hypervisor.

If the p2m map is detected to be in a region which is going to be
remapped, delay the remapping of that area. Not doing so can either
crash the system very early, or lead to clobbered data as the target
memory area of the remap operation will no longer be reserved.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 arch/x86/xen/setup.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 37a34f9..84a6473 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -794,6 +794,20 @@ void __init xen_phys_memcpy(phys_addr_t dest, phys_addr_t 
src, phys_addr_t n)
        }
 }
 
+#ifdef CONFIG_X86_64
+static int __init xen_p2m_conflict(phys_addr_t start, phys_addr_t size)
+{
+       /* Delay invalidating memory. */
+       return 0;
+}
+#else
+static int __init xen_p2m_conflict(phys_addr_t start, phys_addr_t size)
+{
+       panic("p2m list is located at position conflicting with E820 map!\n");
+       return 0;
+}
+#endif
+
 /*
  * Reserve Xen mfn_list.
  * See comment above "struct start_info" in <xen/interface/xen.h>
@@ -819,14 +833,16 @@ void __init xen_phys_memcpy(phys_addr_t dest, phys_addr_t 
src, phys_addr_t n)
 static void __init xen_reserve_xen_mfnlist(void)
 {
        if (xen_start_info->mfn_list >= __START_KERNEL_map) {
-               memblock_reserve(__pa(xen_start_info->mfn_list),
-                                xen_start_info->pt_base -
-                                xen_start_info->mfn_list);
+               xen_add_reserved_area(__pa(xen_start_info->mfn_list),
+                                     xen_start_info->pt_base -
+                                     xen_start_info->mfn_list,
+                                     xen_p2m_conflict, 1);
                return;
        }
 
-       memblock_reserve(PFN_PHYS(xen_start_info->first_p2m_pfn),
-                        PFN_PHYS(xen_start_info->nr_p2m_frames));
+       xen_add_reserved_area(PFN_PHYS(xen_start_info->first_p2m_pfn),
+                             PFN_PHYS(xen_start_info->nr_p2m_frames),
+                             xen_p2m_conflict, 1);
 }
 
 static int __init xen_kernel_mem_conflict(phys_addr_t start, phys_addr_t size)
-- 
2.1.4


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