From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753371AbbBRGwp (ORCPT ); Wed, 18 Feb 2015 01:52:45 -0500 Received: from cantor2.suse.de ([195.135.220.15]:37060 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752776AbbBRGwQ (ORCPT ); Wed, 18 Feb 2015 01:52:16 -0500 From: Juergen Gross 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 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> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1424242326-26611-1-git-send-email-jgross@suse.com> References: <1424242326-26611-1-git-send-email-jgross@suse.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.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