summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJacob Shin2012-11-17 04:38:47 +0100
committerH. Peter Anvin2012-11-17 20:59:08 +0100
commit4eea6aa581abfeb2695ebe9f9d4672597e1bdd4b (patch)
treece814a181c41d9f5ae832b437252dac371db216c /arch
parentx86, mm: Set memblock initial limit to 1M (diff)
downloadkernel-qcow2-linux-4eea6aa581abfeb2695ebe9f9d4672597e1bdd4b.tar.gz
kernel-qcow2-linux-4eea6aa581abfeb2695ebe9f9d4672597e1bdd4b.tar.xz
kernel-qcow2-linux-4eea6aa581abfeb2695ebe9f9d4672597e1bdd4b.zip
x86, mm: if kernel .text .data .bss are not marked as E820_RAM, complain and fix
There could be cases where user supplied memmap=exactmap memory mappings do not mark the region where the kernel .text .data and .bss reside as E820_RAM, as reported here: https://lkml.org/lkml/2012/8/14/86 Handle it by complaining, and adding the range back into the e820. Signed-off-by: Jacob Shin <jacob.shin@amd.com> Link: http://lkml.kernel.org/r/1353123563-3103-11-git-send-email-yinghai@kernel.org Signed-off-by: Yinghai Lu <yinghai@kernel.org> Reviewed-by: Pekka Enberg <penberg@kernel.org> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/setup.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 4bd89218cbc3..d85cbd96525d 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -832,6 +832,20 @@ void __init setup_arch(char **cmdline_p)
insert_resource(&iomem_resource, &data_resource);
insert_resource(&iomem_resource, &bss_resource);
+ /*
+ * Complain if .text .data and .bss are not marked as E820_RAM and
+ * attempt to fix it by adding the range. We may have a confused BIOS,
+ * or the user may have incorrectly supplied it via memmap=exactmap. If
+ * we really are running on top non-RAM, we will crash later anyways.
+ */
+ if (!e820_all_mapped(code_resource.start, __pa(__brk_limit), E820_RAM)) {
+ pr_warn(".text .data .bss are not marked as E820_RAM!\n");
+
+ e820_add_region(code_resource.start,
+ __pa(__brk_limit) - code_resource.start + 1,
+ E820_RAM);
+ }
+
trim_bios_range();
#ifdef CONFIG_X86_32
if (ppro_with_ram_bug()) {