Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86 boot: only pick up additional EFI memmap if add_efi_memmap flag

Applies on top of the previous patch:
x86 boot: add code to add BIOS provided EFI memory entries to kernel

Instead of always adding EFI memory map entries (if present) to the
memory map after initially finding either E820 BIOS memory map entries
and/or kernel command line memmap entries, -instead- only add such
additional EFI memory map entries if the kernel boot option:

add_efi_memmap

is specified.

Requiring this 'add_efi_memmap' option is backward compatible with
kernels that didn't load such additional EFI memory map entries in
the first place, and it doesn't override a configuration that tries
to replace all E820 or EFI BIOS memory map entries with ones given
entirely on the kernel command line.

Signed-off-by: Paul Jackson <pj@sgi.com>
Cc: "Yinghai Lu" <yhlu.kernel@gmail.com>
Cc: "Jack Steiner" <steiner@sgi.com>
Cc: "Mike Travis" <travis@sgi.com>
Cc: "Huang
Cc: Ying" <ying.huang@intel.com>
Cc: "Andi Kleen" <andi@firstfloor.org>
Cc: "Andrew Morton" <akpm@linux-foundation.org>
Cc: Paul Jackson <pj@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

authored by

Paul Jackson and committed by
Ingo Molnar
200001eb 5dab8ec1

+21 -2
+3
Documentation/kernel-parameters.txt
··· 2150 2150 usbhid.mousepoll= 2151 2151 [USBHID] The interval which mice are to be polled at. 2152 2152 2153 + add_efi_memmap [EFI; x86-32,X86-64] Include EFI memory map in 2154 + kernel's map of available physical RAM. 2155 + 2153 2156 vdso= [X86-32,SH,x86-64] 2154 2157 vdso=2: enable compat VDSO (default with COMPAT_VDSO) 2155 2158 vdso=1: enable VDSO (default)
+4
Documentation/x86/x86_64/uefi.txt
··· 36 36 services. 37 37 noefi turn off all EFI runtime services 38 38 reboot_type=k turn off EFI reboot runtime service 39 + - If the EFI memory map has additional entries not in the E820 map, 40 + you can include those entries in the kernels memory map of available 41 + physical RAM by using the following kernel command line parameter. 42 + add_efi_memmap include EFI memory map of available physical RAM
+14 -2
arch/x86/kernel/efi.c
··· 64 64 } 65 65 early_param("noefi", setup_noefi); 66 66 67 + int add_efi_memmap; 68 + EXPORT_SYMBOL(add_efi_memmap); 69 + 70 + static int __init setup_add_efi_memmap(char *arg) 71 + { 72 + add_efi_memmap = 1; 73 + return 0; 74 + } 75 + early_param("add_efi_memmap", setup_add_efi_memmap); 76 + 77 + 67 78 static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) 68 79 { 69 80 return efi_call_virt2(get_time, tm, tc); ··· 230 219 * (zeropage) memory map. 231 220 */ 232 221 233 - static void __init add_efi_memmap(void) 222 + static void __init do_add_efi_memmap(void) 234 223 { 235 224 void *p; 236 225 ··· 417 406 if (memmap.desc_size != sizeof(efi_memory_desc_t)) 418 407 printk(KERN_WARNING "Kernel-defined memdesc" 419 408 "doesn't match the one from EFI!\n"); 420 - add_efi_memmap(); 409 + if (add_efi_memmap) 410 + do_add_efi_memmap(); 421 411 422 412 /* Setup for EFI runtime service */ 423 413 reboot_type = BOOT_EFI;