Commit 1f2ff682 authored by Yinghai Lu's avatar Yinghai Lu Committed by H. Peter Anvin

x86, mm: Use memblock memory loop instead of e820_RAM

We need to handle E820_RAM and E820_RESERVED_KERNEL at the same time.

Also memblock has page aligned range for ram, so we could avoid mapping
partial pages.
Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
Link: http://lkml.kernel.org/r/CAE9FiQVZirvaBMFYRfXMmWEcHbKSicQEHz4VAwUv0xFCk51ZNw@mail.gmail.comAcked-by: default avatarJacob Shin <jacob.shin@amd.com>
Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
Cc: <stable@vger.kernel.org>
parent 6ede1fd3
...@@ -921,18 +921,19 @@ void __init setup_arch(char **cmdline_p) ...@@ -921,18 +921,19 @@ void __init setup_arch(char **cmdline_p)
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
if (max_pfn > max_low_pfn) { if (max_pfn > max_low_pfn) {
int i; int i;
for (i = 0; i < e820.nr_map; i++) { unsigned long start, end;
struct e820entry *ei = &e820.map[i]; unsigned long start_pfn, end_pfn;
if (ei->addr + ei->size <= 1UL << 32) for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn,
continue; NULL) {
if (ei->type == E820_RESERVED) end = PFN_PHYS(end_pfn);
if (end <= (1UL<<32))
continue; continue;
start = PFN_PHYS(start_pfn);
max_pfn_mapped = init_memory_mapping( max_pfn_mapped = init_memory_mapping(
ei->addr < 1UL << 32 ? 1UL << 32 : ei->addr, max((1UL<<32), start), end);
ei->addr + ei->size);
} }
/* can we preseve max_low_pfn ?*/ /* can we preseve max_low_pfn ?*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment