From: Hongyan Xia Date: Wed, 9 Oct 2019 13:54:23 +0000 (+0100) Subject: x86/setup: do not map memory when passing to allocators X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=refs%2Fheads%2Fdirectnonmap-v2.3;p=people%2Fhx242%2Fxen.git x86/setup: do not map memory when passing to allocators Also destroy the existing mappings to the direct map region when passing to allocators. Signed-off-by: Hongyan Xia --- diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index e6d8dfb0b3..6a664d16c2 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1346,6 +1346,10 @@ void __init noreturn __start_xen(unsigned long mbi_p) /* Pass mapped memory to allocator /before/ creating new mappings. */ init_boot_pages(s, min(map_s, e)); +#ifndef CONFIG_DIRECTMAP + destroy_xen_mappings((unsigned long)__va(s), + (unsigned long)__va(min(map_s, e))); +#endif s = map_s; if ( s < map_e ) { @@ -1354,6 +1358,10 @@ void __init noreturn __start_xen(unsigned long mbi_p) map_s = (s + mask) & ~mask; map_e &= ~mask; init_boot_pages(map_s, map_e); +#ifndef CONFIG_DIRECTMAP + destroy_xen_mappings((unsigned long)__va(map_s), + (unsigned long)__va(map_e)); +#endif } if ( map_s > map_e ) @@ -1367,12 +1375,15 @@ void __init noreturn __start_xen(unsigned long mbi_p) if ( map_e < end ) { +#ifdef CONFIG_DIRECTMAP map_pages_to_xen((unsigned long)__va(map_e), maddr_to_mfn(map_e), PFN_DOWN(end - map_e), PAGE_HYPERVISOR); +#endif init_boot_pages(map_e, end); map_e = end; } } +#ifdef CONFIG_DIRECTMAP if ( map_e < e ) { /* This range must not be passed to the boot allocator and @@ -1380,10 +1391,13 @@ void __init noreturn __start_xen(unsigned long mbi_p) map_pages_to_xen((unsigned long)__va(map_e), maddr_to_mfn(map_e), PFN_DOWN(e - map_e), __PAGE_HYPERVISOR_RW); } +#endif if ( s < map_s ) { +#ifdef CONFIG_DIRECTMAP map_pages_to_xen((unsigned long)__va(s), maddr_to_mfn(s), PFN_DOWN(map_s - s), PAGE_HYPERVISOR); +#endif init_boot_pages(s, map_s); } }