diff options
author | Matt Fleming <matt.fleming@intel.com> | 2014-08-05 06:52:11 -0400 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2014-10-03 13:40:57 -0400 |
commit | 5a17dae422d7de4b776a9753cd4673a343a25b4b (patch) | |
tree | b93452a42035324703987e88a3fca53d308bac2b /arch/x86 | |
parent | 161485e8273001e56b2f20755ad9b6217b601fb3 (diff) |
efi: Add efi= parameter parsing to the EFI boot stub
We need a way to customize the behaviour of the EFI boot stub, in
particular, we need a way to disable the "chunking" workaround, used
when reading files from the EFI System Partition.
One of my machines doesn't cope well when reading files in 1MB chunks to
a buffer above the 4GB mark - it appears that the "chunking" bug
workaround triggers another firmware bug. This was only discovered with
commit 4bf7111f5016 ("x86/efi: Support initrd loaded above 4G"), and
that commit is perfectly valid. The symptom I observed was a corrupt
initrd rather than any kind of crash.
efi= is now used to specify EFI parameters in two very different
execution environments, the EFI boot stub and during kernel boot.
There is also a slight performance optimization by enabling efi=nochunk,
but that's offset by the fact that you're more likely to run into
firmware issues, at least on x86. This is the rationale behind leaving
the workaround enabled by default.
Also provide some documentation for EFI_READ_CHUNK_SIZE and why we're
using the current value of 1MB.
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Roy Franz <roy.franz@linaro.org>
Cc: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Borislav Petkov <bp@suse.de>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/boot/compressed/eboot.c | 4 | ||||
-rw-r--r-- | arch/x86/platform/efi/efi.c | 19 |
2 files changed, 21 insertions, 2 deletions
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index f277184e2ac1..f4bdab1dbf66 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c | |||
@@ -1100,6 +1100,10 @@ struct boot_params *make_boot_params(struct efi_config *c) | |||
1100 | else | 1100 | else |
1101 | initrd_addr_max = hdr->initrd_addr_max; | 1101 | initrd_addr_max = hdr->initrd_addr_max; |
1102 | 1102 | ||
1103 | status = efi_parse_options(cmdline_ptr); | ||
1104 | if (status != EFI_SUCCESS) | ||
1105 | goto fail2; | ||
1106 | |||
1103 | status = handle_cmdline_files(sys_table, image, | 1107 | status = handle_cmdline_files(sys_table, image, |
1104 | (char *)(unsigned long)hdr->cmd_line_ptr, | 1108 | (char *)(unsigned long)hdr->cmd_line_ptr, |
1105 | "initrd=", initrd_addr_max, | 1109 | "initrd=", initrd_addr_max, |
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 850da94fef30..a1f745b0bf1d 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c | |||
@@ -943,8 +943,23 @@ static int __init parse_efi_cmdline(char *str) | |||
943 | if (*str == '=') | 943 | if (*str == '=') |
944 | str++; | 944 | str++; |
945 | 945 | ||
946 | if (!strncmp(str, "old_map", 7)) | 946 | while (*str) { |
947 | set_bit(EFI_OLD_MEMMAP, &efi.flags); | 947 | if (!strncmp(str, "old_map", 7)) { |
948 | set_bit(EFI_OLD_MEMMAP, &efi.flags); | ||
949 | str += strlen("old_map"); | ||
950 | } | ||
951 | |||
952 | /* | ||
953 | * Skip any options we don't understand. Presumably | ||
954 | * they apply to the EFI boot stub. | ||
955 | */ | ||
956 | while (*str && *str != ',') | ||
957 | str++; | ||
958 | |||
959 | /* If we hit a delimiter, skip it */ | ||
960 | if (*str == ',') | ||
961 | str++; | ||
962 | } | ||
948 | 963 | ||
949 | return 0; | 964 | return 0; |
950 | } | 965 | } |