From: David Vrabel Subject: [PATCH 2/2] x86: map portion of kexec crash area that is within the direct map area Date: Wed, 8 Jan 2014 15:56:41 +0000 Message-ID: <1389196601-12219-3-git-send-email-david.vrabel@citrix.com> References: <1389196601-12219-1-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1389196601-12219-1-git-send-email-david.vrabel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: David Vrabel , Don Slutz List-Id: xen-devel@lists.xenproject.org From: David Vrabel map_domain_page() is used to temporarily map the crash area when loading a kexec crash image. If some or all of the crash area is within the direct map area then this portion must have a direct mapping, otherwise map_domain_page() (on non-debug builds) will return a direct map VA that is not actually mapped. Parts of the crash area outside the direct map area (i.e., above 5 TiB) do not need and should not have such a mapping. Signed-off-by: David Vrabel --- xen/arch/x86/setup.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index f07ee2b..8e10bdf 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1097,9 +1097,17 @@ void __init __start_xen(unsigned long mbi_p) mod[i].mod_start, PFN_UP(mod[i].mod_end), PAGE_HYPERVISOR); } - map_pages_to_xen((unsigned long)__va(kexec_crash_area.start), - kexec_crash_area.start >> PAGE_SHIFT, - PFN_UP(kexec_crash_area.size), PAGE_HYPERVISOR); + + if ( kexec_crash_area.size ) + { + unsigned long s = PFN_DOWN(kexec_crash_area.start); + unsigned long e = min(s + PFN_UP(kexec_crash_area.size), + PFN_UP(__pa(HYPERVISOR_VIRT_END - 1))); + + map_pages_to_xen((unsigned long)__va(kexec_crash_area.start), + s, e - s, PAGE_HYPERVISOR); + } + xen_virt_end = ((unsigned long)_end + (1UL << L2_PAGETABLE_SHIFT) - 1) & ~((1UL << L2_PAGETABLE_SHIFT) - 1); destroy_xen_mappings(xen_virt_end, XEN_VIRT_START + BOOTSTRAP_MAP_BASE); -- 1.7.2.5