Skip to content

Commit

Permalink
memblock: Allow memblock_init to be called early
Browse files Browse the repository at this point in the history
The Xen setup code needs to call memblock_x86_reserve_range() very early,
so allow it to initialize the memblock subsystem before doing so.  The
second memblock_init() is ignored.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
LKML-Reference: <4CACFDAD.3090900@goop.org>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
  • Loading branch information
Jeremy Fitzhardinge authored and H. Peter Anvin committed Oct 11, 2010
1 parent 153db80 commit 236260b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/x86/xen/enlighten.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <linux/console.h>
#include <linux/pci.h>
#include <linux/gfp.h>
#include <linux/memblock.h>

#include <xen/xen.h>
#include <xen/interface/xen.h>
Expand Down Expand Up @@ -1183,6 +1184,8 @@ asmlinkage void __init xen_start_kernel(void)
local_irq_disable();
early_boot_irqs_off();

memblock_init();

xen_raw_console_write("mapping kernel into physical memory\n");
pgd = xen_setup_kernel_pagetable(pgd, xen_start_info->nr_pages);

Expand Down
6 changes: 6 additions & 0 deletions mm/memblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,12 @@ void __init memblock_analyze(void)

void __init memblock_init(void)
{
static int init_done __initdata = 0;

if (init_done)
return;
init_done = 1;

/* Hookup the initial arrays */
memblock.memory.regions = memblock_memory_init_regions;
memblock.memory.max = INIT_MEMBLOCK_REGIONS;
Expand Down

0 comments on commit 236260b

Please sign in to comment.