From: Juergen Gross Subject: [PATCH 09/13] xen: check for kernel memory conflicting with memory layout Date: Wed, 18 Feb 2015 07:52:02 +0100 Message-ID: <1424242326-26611-10-git-send-email-jgross@suse.com> References: <1424242326-26611-1-git-send-email-jgross@suse.com> Return-path: In-Reply-To: <1424242326-26611-1-git-send-email-jgross@suse.com> Sender: linux-kernel-owner@vger.kernel.org To: linux-kernel@vger.kernel.org, xen-devel@lists.xensource.com, konrad.wilk@oracle.com, david.vrabel@citrix.com, boris.ostrovsky@oracle.com Cc: Juergen Gross List-Id: xen-devel@lists.xenproject.org Checks whether the pre-allocated memory of the loaded kernel is in conflict with the target memory map. If this is the case, just panic instead of run into problems later. Signed-off-by: Juergen Gross --- arch/x86/xen/setup.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index eb219c1..37a34f9 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -829,6 +829,12 @@ static void __init xen_reserve_xen_mfnlist(void) PFN_PHYS(xen_start_info->nr_p2m_frames)); } +static int __init xen_kernel_mem_conflict(phys_addr_t start, phys_addr_t size) +{ + panic("kernel is located at position conflicting with E820 map!\n"); + return 0; +} + /** * machine_specific_memory_setup - Hook for machine specific memory setup. **/ @@ -843,6 +849,10 @@ char * __init xen_memory_setup(void) int i; int op; + xen_add_reserved_area(__pa_symbol(_text), + __pa_symbol(__bss_stop) - __pa_symbol(_text), + xen_kernel_mem_conflict, 0); + xen_reserve_xen_mfnlist(); xen_max_pfn = min(MAX_DOMAIN_PAGES, xen_start_info->nr_pages); -- 2.1.4