diff options
author | Yinghai Lu <yinghai@kernel.org> | 2014-09-04 00:50:07 -0400 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2014-09-08 15:52:02 -0400 |
commit | 47226ad4f4cfd1e91ded7f2ec42f83ff1c624663 (patch) | |
tree | 7c0ff8f605f549acec05db97ccd992bcab277121 /arch | |
parent | 52addcf9d6669fa439387610bc65c92fa0980cef (diff) |
x86/efi: Only load initrd above 4g on second try
Mantas found that after commit 4bf7111f5016 ("x86/efi: Support initrd
loaded above 4G"), the kernel freezes at the earliest possible moment
when trying to boot via UEFI on Asus laptop.
Revert to old way to load initrd under 4G on first try, second try will
use above 4G buffer when initrd is too big and does not fit under 4G.
[ The cause of the freeze appears to be a firmware bug when reading
file data into buffers above 4GB, though the exact reason is unknown.
Mantas reports that the hang can be avoid if the file size is a
multiple of 512 bytes, but I've seen some ASUS firmware simply
corrupting the file data rather than freezing.
Laszlo fixed an issue in the upstream EDK2 DiskIO code in Aug 2013
which may possibly be related, commit 4e39b75e ("MdeModulePkg/DiskIoDxe:
fix source/destination pointer of overrun transfer").
Whatever the cause, it's unlikely that a fix will be forthcoming
from the vendor, hence the workaround - Matt ]
Cc: Laszlo Ersek <lersek@redhat.com>
Reported-by: Mantas Mikulėnas <grawity@gmail.com>
Reported-by: Harald Hoyer <harald@redhat.com>
Tested-by: Anders Darander <anders@chargestorm.se>
Tested-by: Calvin Walton <calvin.walton@kepstin.ca>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/boot/compressed/eboot.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index f277184e2ac1..dca9842d8f91 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c | |||
@@ -1032,7 +1032,6 @@ struct boot_params *make_boot_params(struct efi_config *c) | |||
1032 | int i; | 1032 | int i; |
1033 | unsigned long ramdisk_addr; | 1033 | unsigned long ramdisk_addr; |
1034 | unsigned long ramdisk_size; | 1034 | unsigned long ramdisk_size; |
1035 | unsigned long initrd_addr_max; | ||
1036 | 1035 | ||
1037 | efi_early = c; | 1036 | efi_early = c; |
1038 | sys_table = (efi_system_table_t *)(unsigned long)efi_early->table; | 1037 | sys_table = (efi_system_table_t *)(unsigned long)efi_early->table; |
@@ -1095,15 +1094,20 @@ struct boot_params *make_boot_params(struct efi_config *c) | |||
1095 | 1094 | ||
1096 | memset(sdt, 0, sizeof(*sdt)); | 1095 | memset(sdt, 0, sizeof(*sdt)); |
1097 | 1096 | ||
1098 | if (hdr->xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G) | ||
1099 | initrd_addr_max = -1UL; | ||
1100 | else | ||
1101 | initrd_addr_max = hdr->initrd_addr_max; | ||
1102 | |||
1103 | status = handle_cmdline_files(sys_table, image, | 1097 | status = handle_cmdline_files(sys_table, image, |
1104 | (char *)(unsigned long)hdr->cmd_line_ptr, | 1098 | (char *)(unsigned long)hdr->cmd_line_ptr, |
1105 | "initrd=", initrd_addr_max, | 1099 | "initrd=", hdr->initrd_addr_max, |
1106 | &ramdisk_addr, &ramdisk_size); | 1100 | &ramdisk_addr, &ramdisk_size); |
1101 | |||
1102 | if (status != EFI_SUCCESS && | ||
1103 | hdr->xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G) { | ||
1104 | efi_printk(sys_table, "Trying to load files to higher address\n"); | ||
1105 | status = handle_cmdline_files(sys_table, image, | ||
1106 | (char *)(unsigned long)hdr->cmd_line_ptr, | ||
1107 | "initrd=", -1UL, | ||
1108 | &ramdisk_addr, &ramdisk_size); | ||
1109 | } | ||
1110 | |||
1107 | if (status != EFI_SUCCESS) | 1111 | if (status != EFI_SUCCESS) |
1108 | goto fail2; | 1112 | goto fail2; |
1109 | hdr->ramdisk_image = ramdisk_addr & 0xffffffff; | 1113 | hdr->ramdisk_image = ramdisk_addr & 0xffffffff; |