diff options
author | Maarten Lankhorst <m.b.lankhorst@gmail.com> | 2011-12-16 07:30:58 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2011-12-16 11:34:35 -0500 |
commit | 2d2da60fb40a80cc59383121ccf763e0e0e8a42a (patch) | |
tree | e0a17e115c545bdf7e065cf0ef53326da70ca407 /arch/x86/boot | |
parent | 291f36325f9f252bd76ef5f603995f37e453fc60 (diff) |
x86, efi: Break up large initrd reads
The efi boot stub tries to read the entire initrd in 1 go, however
some efi implementations hang if too much if asked to read too much
data at the same time. After some experimentation I found out that my
asrock p67 board will hang if asked to read chunks of 4MiB, so use a
safe value.
elilo reads in chunks of 16KiB, but since that requires many read
calls I use a value of 1 MiB. hpa suggested adding individual
blacklists for when systems are found where this value causes a crash.
Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Link: http://lkml.kernel.org/r/4EEB3A02.3090201@gmail.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/boot')
-rw-r--r-- | arch/x86/boot/compressed/eboot.c | 20 | ||||
-rw-r--r-- | arch/x86/boot/compressed/eboot.h | 1 |
2 files changed, 15 insertions, 6 deletions
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index 4055e63d0b04..fec216f4fbc3 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c | |||
@@ -643,14 +643,22 @@ grow: | |||
643 | u64 size; | 643 | u64 size; |
644 | 644 | ||
645 | size = initrds[j].size; | 645 | size = initrds[j].size; |
646 | status = efi_call_phys3(fh->read, initrds[j].handle, | 646 | while (size) { |
647 | &size, addr); | 647 | u64 chunksize; |
648 | if (status != EFI_SUCCESS) | 648 | if (size > EFI_READ_CHUNK_SIZE) |
649 | goto free_initrd_total; | 649 | chunksize = EFI_READ_CHUNK_SIZE; |
650 | else | ||
651 | chunksize = size; | ||
652 | status = efi_call_phys3(fh->read, | ||
653 | initrds[j].handle, | ||
654 | &chunksize, addr); | ||
655 | if (status != EFI_SUCCESS) | ||
656 | goto free_initrd_total; | ||
657 | addr += chunksize; | ||
658 | size -= chunksize; | ||
659 | } | ||
650 | 660 | ||
651 | efi_call_phys1(fh->close, initrds[j].handle); | 661 | efi_call_phys1(fh->close, initrds[j].handle); |
652 | |||
653 | addr += size; | ||
654 | } | 662 | } |
655 | 663 | ||
656 | } | 664 | } |
diff --git a/arch/x86/boot/compressed/eboot.h b/arch/x86/boot/compressed/eboot.h index f66d023e91ef..39251663e65b 100644 --- a/arch/x86/boot/compressed/eboot.h +++ b/arch/x86/boot/compressed/eboot.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #define DESC_TYPE_CODE_DATA (1 << 0) | 12 | #define DESC_TYPE_CODE_DATA (1 << 0) |
13 | 13 | ||
14 | #define EFI_PAGE_SIZE (1UL << EFI_PAGE_SHIFT) | 14 | #define EFI_PAGE_SIZE (1UL << EFI_PAGE_SHIFT) |
15 | #define EFI_READ_CHUNK_SIZE (1024 * 1024) | ||
15 | 16 | ||
16 | #define PIXEL_RGB_RESERVED_8BIT_PER_COLOR 0 | 17 | #define PIXEL_RGB_RESERVED_8BIT_PER_COLOR 0 |
17 | #define PIXEL_BGR_RESERVED_8BIT_PER_COLOR 1 | 18 | #define PIXEL_BGR_RESERVED_8BIT_PER_COLOR 1 |