aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2013-01-24 15:19:45 -0500
committerH. Peter Anvin <hpa@linux.intel.com>2013-01-29 18:12:24 -0500
commitb422a3091748c38b68052e8ba021652590b1f25c (patch)
tree07802b9b5cc8b1e72c4d09b179be1fe5e9ad4d12 /arch/x86/kernel
parentc9b3234a6abadaa12684083d39552939baaed1f4 (diff)
x86: Factor out e820_add_kernel_range()
Separate out the reservation of the kernel static memory areas into a separate function. Also add support for case when memmap=xxM$yyM is used without exactmap. Need to remove reserved range at first before we add E820_RAM range, otherwise added E820_RAM range will be ignored. Signed-off-by: Yinghai Lu <yinghai@kernel.org> Link: http://lkml.kernel.org/r/1359058816-7615-5-git-send-email-yinghai@kernel.org Cc: Jacob Shin <jacob.shin@amd.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/setup.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 268193746cd8..5552d04b0cc1 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -702,6 +702,27 @@ static void __init trim_bios_range(void)
702 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); 702 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
703} 703}
704 704
705/* called before trim_bios_range() to spare extra sanitize */
706static void __init e820_add_kernel_range(void)
707{
708 u64 start = __pa_symbol(_text);
709 u64 size = __pa_symbol(_end) - start;
710
711 /*
712 * Complain if .text .data and .bss are not marked as E820_RAM and
713 * attempt to fix it by adding the range. We may have a confused BIOS,
714 * or the user may have used memmap=exactmap or memmap=xxM$yyM to
715 * exclude kernel range. If we really are running on top non-RAM,
716 * we will crash later anyways.
717 */
718 if (e820_all_mapped(start, start + size, E820_RAM))
719 return;
720
721 pr_warn(".text .data .bss are not marked as E820_RAM!\n");
722 e820_remove_range(start, size, E820_RAM, 0);
723 e820_add_region(start, size, E820_RAM);
724}
725
705static int __init parse_reservelow(char *p) 726static int __init parse_reservelow(char *p)
706{ 727{
707 unsigned long long size; 728 unsigned long long size;
@@ -897,20 +918,7 @@ void __init setup_arch(char **cmdline_p)
897 insert_resource(&iomem_resource, &data_resource); 918 insert_resource(&iomem_resource, &data_resource);
898 insert_resource(&iomem_resource, &bss_resource); 919 insert_resource(&iomem_resource, &bss_resource);
899 920
900 /* 921 e820_add_kernel_range();
901 * Complain if .text .data and .bss are not marked as E820_RAM and
902 * attempt to fix it by adding the range. We may have a confused BIOS,
903 * or the user may have incorrectly supplied it via memmap=exactmap. If
904 * we really are running on top non-RAM, we will crash later anyways.
905 */
906 if (!e820_all_mapped(code_resource.start, __pa(__brk_limit), E820_RAM)) {
907 pr_warn(".text .data .bss are not marked as E820_RAM!\n");
908
909 e820_add_region(code_resource.start,
910 __pa(__brk_limit) - code_resource.start + 1,
911 E820_RAM);
912 }
913
914 trim_bios_range(); 922 trim_bios_range();
915#ifdef CONFIG_X86_32 923#ifdef CONFIG_X86_32
916 if (ppro_with_ram_bug()) { 924 if (ppro_with_ram_bug()) {