Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753301AbbBRGwm (ORCPT ); Wed, 18 Feb 2015 01:52:42 -0500 Received: from cantor2.suse.de ([195.135.220.15]:37063 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752865AbbBRGwQ (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 12/13] xen: if p2m list located in to be remapped region delay remapping Date: Wed, 18 Feb 2015 07:52:05 +0100 Message-Id: <1424242326-26611-13-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 Content-Length: 2344 Lines: 68 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 --- 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 @@ -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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/