Commit ecda0628 authored by Yinghai Lu's avatar Yinghai Lu Committed by Ingo Molnar

x86: check mptable physptr with max_low_pfn on 32bit

Impact: fix early crash on LinuxBIOS systems

Kevin O'Connor reported that Coreboot aka LinuxBIOS tries to put
mptable somewhere very high, well above max_low_pfn (below which
BIOSes generally put the mptable), causing a panic.

The BIOS will probably be changed to be compatible with older
Linus versions, but nevertheless the MP-spec does not forbid
an MP-table in arbitrary system RAM, so make sure it all
works even if the table is in an unexpected place.

Check physptr with max_low_pfn * PAGE_SIZE.
Reported-by: default avatarKevin O'Connor <kevin@koconnor.net>
Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
Cc: Stefan Reinauer <stepan@coresystems.de>
Cc: coreboot@coreboot.org
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 8e6dafd6
...@@ -710,13 +710,22 @@ static int __init smp_scan_config(unsigned long base, unsigned long length, ...@@ -710,13 +710,22 @@ static int __init smp_scan_config(unsigned long base, unsigned long length,
* of physical memory; so that simply reserving * of physical memory; so that simply reserving
* PAGE_SIZE from mpf->physptr yields BUG() * PAGE_SIZE from mpf->physptr yields BUG()
* in reserve_bootmem. * in reserve_bootmem.
* also need to make sure physptr is below than
* max_low_pfn
* we don't need reserve the area above max_low_pfn
*/ */
unsigned long end = max_low_pfn * PAGE_SIZE; unsigned long end = max_low_pfn * PAGE_SIZE;
if (mpf->physptr + size > end)
size = end - mpf->physptr; if (mpf->physptr < end) {
#endif if (mpf->physptr + size > end)
size = end - mpf->physptr;
reserve_bootmem_generic(mpf->physptr, size,
BOOTMEM_DEFAULT);
}
#else
reserve_bootmem_generic(mpf->physptr, size, reserve_bootmem_generic(mpf->physptr, size,
BOOTMEM_DEFAULT); BOOTMEM_DEFAULT);
#endif
} }
return 1; return 1;
......
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