diff options
author | Tejun Heo <tj@kernel.org> | 2011-07-12 05:15:58 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2011-07-14 14:47:47 -0400 |
commit | ab5d140b9eafae402aa3e673a63c5ef6164a9dd2 (patch) | |
tree | 499d3be0c75ef1f5f8922eae5c2a6428246e9b32 | |
parent | 0608f70c78a384c2f225f2de226ca057a196f108 (diff) |
x86: Use __memblock_alloc_base() in early_reserve_e820()
early_reserve_e820() implements its own ad-hoc early allocator using
memblock_x86_find_in_range_size(). Use __memblock_alloc_base()
instead and remove the unnecessary @startt parameter (it's top-down
allocation anyway).
Signed-off-by: Tejun Heo <tj@kernel.org>
Link: http://lkml.kernel.org/r/1310462166-31469-6-git-send-email-tj@kernel.org
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r-- | arch/x86/include/asm/e820.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/e820.c | 30 | ||||
-rw-r--r-- | arch/x86/kernel/mpparse.c | 6 |
3 files changed, 9 insertions, 29 deletions
diff --git a/arch/x86/include/asm/e820.h b/arch/x86/include/asm/e820.h index 908b96957d88..37782566af24 100644 --- a/arch/x86/include/asm/e820.h +++ b/arch/x86/include/asm/e820.h | |||
@@ -117,7 +117,7 @@ static inline void early_memtest(unsigned long start, unsigned long end) | |||
117 | 117 | ||
118 | extern unsigned long e820_end_of_ram_pfn(void); | 118 | extern unsigned long e820_end_of_ram_pfn(void); |
119 | extern unsigned long e820_end_of_low_ram_pfn(void); | 119 | extern unsigned long e820_end_of_low_ram_pfn(void); |
120 | extern u64 early_reserve_e820(u64 startt, u64 sizet, u64 align); | 120 | extern u64 early_reserve_e820(u64 sizet, u64 align); |
121 | 121 | ||
122 | void memblock_x86_fill(void); | 122 | void memblock_x86_fill(void); |
123 | void memblock_find_dma_reserve(void); | 123 | void memblock_find_dma_reserve(void); |
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 0f9ff58d06d7..b99d9402ae8b 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -737,35 +737,17 @@ core_initcall(e820_mark_nvs_memory); | |||
737 | /* | 737 | /* |
738 | * pre allocated 4k and reserved it in memblock and e820_saved | 738 | * pre allocated 4k and reserved it in memblock and e820_saved |
739 | */ | 739 | */ |
740 | u64 __init early_reserve_e820(u64 startt, u64 sizet, u64 align) | 740 | u64 __init early_reserve_e820(u64 size, u64 align) |
741 | { | 741 | { |
742 | u64 size = 0; | ||
743 | u64 addr; | 742 | u64 addr; |
744 | u64 start; | ||
745 | 743 | ||
746 | for (start = startt; ; start += size) { | 744 | addr = __memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ACCESSIBLE); |
747 | start = memblock_x86_find_in_range_size(start, &size, align); | 745 | if (addr) { |
748 | if (!start) | 746 | e820_update_range_saved(addr, size, E820_RAM, E820_RESERVED); |
749 | return 0; | 747 | printk(KERN_INFO "update e820_saved for early_reserve_e820\n"); |
750 | if (size >= sizet) | 748 | update_e820_saved(); |
751 | break; | ||
752 | } | 749 | } |
753 | 750 | ||
754 | #ifdef CONFIG_X86_32 | ||
755 | if (start >= MAXMEM) | ||
756 | return 0; | ||
757 | if (start + size > MAXMEM) | ||
758 | size = MAXMEM - start; | ||
759 | #endif | ||
760 | |||
761 | addr = round_down(start + size - sizet, align); | ||
762 | if (addr < start) | ||
763 | return 0; | ||
764 | memblock_x86_reserve_range(addr, addr + sizet, "new next"); | ||
765 | e820_update_range_saved(addr, sizet, E820_RAM, E820_RESERVED); | ||
766 | printk(KERN_INFO "update e820_saved for early_reserve_e820\n"); | ||
767 | update_e820_saved(); | ||
768 | |||
769 | return addr; | 751 | return addr; |
770 | } | 752 | } |
771 | 753 | ||
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c index 9103b89c145a..8faeaa0ed2cc 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c | |||
@@ -836,10 +836,8 @@ early_param("alloc_mptable", parse_alloc_mptable_opt); | |||
836 | 836 | ||
837 | void __init early_reserve_e820_mpc_new(void) | 837 | void __init early_reserve_e820_mpc_new(void) |
838 | { | 838 | { |
839 | if (enable_update_mptable && alloc_mptable) { | 839 | if (enable_update_mptable && alloc_mptable) |
840 | u64 startt = 0; | 840 | mpc_new_phys = early_reserve_e820(mpc_new_length, 4); |
841 | mpc_new_phys = early_reserve_e820(startt, mpc_new_length, 4); | ||
842 | } | ||
843 | } | 841 | } |
844 | 842 | ||
845 | static int __init update_mp_table(void) | 843 | static int __init update_mp_table(void) |