From 561a20249631809e676652fdfd7471497d1e6263 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Tue, 31 Jul 2012 15:21:02 -0400 Subject: [PATCH] xen/mmu/enlighten: Fix memblock_x86_reserve_range downport. This is not for upstream as it memblock_x86_reserve_range is not used upstream anymore. When I back-ported the patches: xen/x86: Use memblock_reserve for sensitive areas. xen/mmu: Recycle the Xen provided L4, L3, and L2 pages I simply used sed s/memblock_reserve/memblock_x86_reserve_range/. That was incorrect as the parameters are different - memblock_reserve as second expects the size, while memblock_x86_reserve_range expects the physical address. This patch fixes those bugs. Signed-off-by: Konrad Rzeszutek Wilk --- arch/x86/xen/enlighten.c | 7 ++++--- arch/x86/xen/mmu.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 02a42979d54b..ee832ceb7c77 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -943,7 +943,7 @@ static void __init xen_reserve_mfn(unsigned long mfn) return; pfn = mfn_to_pfn(mfn); if (phys_to_machine_mapping_valid(pfn)) - memblock_x86_reserve_range(PFN_PHYS(pfn), PAGE_SIZE, "XEN MFN"); + memblock_x86_reserve_range(PFN_PHYS(pfn), PFN_PHYS(pfn) + PAGE_SIZE, "XEN MFN"); } static void __init xen_reserve_internals(void) { @@ -954,7 +954,7 @@ static void __init xen_reserve_internals(void) /* xen_start_info does not exist in the M2P, hence can't use * xen_reserve_mfn. */ - memblock_x86_reserve_range(__pa(xen_start_info), PAGE_SIZE, "XEN START INFO"); + memblock_x86_reserve_range(__pa(xen_start_info), __pa(xen_start_info) + PAGE_SIZE, "XEN START INFO"); xen_reserve_mfn(PFN_DOWN(xen_start_info->shared_info)); xen_reserve_mfn(xen_start_info->store_mfn); @@ -975,7 +975,8 @@ static void __init xen_reserve_internals(void) /* We could use xen_reserve_mfn here, but would end up looping quite * a lot (and call memblock_reserve for each PAGE), so lets just use * the easy way and reserve it wholesale. */ - memblock_x86_reserve_range(__pa(xen_start_info->mfn_list), size, "P2M ARRAY"); + memblock_x86_reserve_range(__pa(xen_start_info->mfn_list), + __pa(xen_start_info->mfn_list) + size, "P2M ARRAY"); /* The pagetables are reserved in mmu.c */ } diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index 1931b95f0bab..cefba8fc5d32 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c @@ -1922,7 +1922,7 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) check_pt_base(&pt_base, &pt_end, addr[i]); /* Our (by three pages) smaller Xen pagetable that we are using */ - memblock_x86_reserve_range(PFN_PHYS(pt_base), (pt_end - pt_base) * PAGE_SIZE, "XEN PAGETABLES"); + memblock_x86_reserve_range(PFN_PHYS(pt_base), PFN_PHYS(pt_end), "XEN PAGETABLES"); /* Revector the xen_start_info */ xen_start_info = (struct start_info *)__va(__pa(xen_start_info)); } -- 2.50.1