memblock: Allow memblock_init to be called early

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 <[email protected]>
Cc: Yinghai Lu <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: H. Peter Anvin <[email protected]>
This commit is contained in:
Jeremy Fitzhardinge 2010-10-06 15:52:29 -07:00 • committed by H. Peter Anvin
commit 236260b90d
2 changed files with 9 additions and 0 deletions

View file

@ -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;