diff options
author | Ard Biesheuvel <ardb@kernel.org> | 2022-10-12 14:57:32 +0200 |
---|---|---|
committer | Ard Biesheuvel <ardb@kernel.org> | 2022-11-09 12:42:03 +0100 |
commit | 895bc3a135ffe9475de04b30e274f57a176cd3ef (patch) | |
tree | 095e1bef70d74e863ba6bd043e4f3dc60e701d19 /drivers/firmware/efi/libstub/riscv-stub.c | |
parent | 1f1ba325a23df6739b6b5e52f40ec1aa228108b2 (diff) | |
download | linux-895bc3a135ffe9475de04b30e274f57a176cd3ef.tar.gz linux-895bc3a135ffe9475de04b30e274f57a176cd3ef.tar.bz2 linux-895bc3a135ffe9475de04b30e274f57a176cd3ef.zip |
efi: libstub: Factor out min alignment and preferred kernel load address
Factor out the expressions that describe the preferred placement of the
loaded image as well as the minimum alignment so we can reuse them in
the decompressor.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'drivers/firmware/efi/libstub/riscv-stub.c')
-rw-r--r-- | drivers/firmware/efi/libstub/riscv-stub.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/drivers/firmware/efi/libstub/riscv-stub.c b/drivers/firmware/efi/libstub/riscv-stub.c index b450ebf95977..c5a551f69a7f 100644 --- a/drivers/firmware/efi/libstub/riscv-stub.c +++ b/drivers/firmware/efi/libstub/riscv-stub.c @@ -12,16 +12,6 @@ #include "efistub.h" -/* - * RISC-V requires the kernel image to placed 2 MB aligned base for 64 bit and - * 4MB for 32 bit. - */ -#ifdef CONFIG_64BIT -#define MIN_KIMG_ALIGN SZ_2M -#else -#define MIN_KIMG_ALIGN SZ_4M -#endif - typedef void __noreturn (*jump_kernel_func)(unsigned long, unsigned long); static unsigned long hartid; @@ -125,9 +115,10 @@ efi_status_t handle_kernel_image(unsigned long *image_addr, * lowest possible memory region as long as the address and size meets * the alignment constraints. */ - preferred_addr = MIN_KIMG_ALIGN; + preferred_addr = EFI_KIMG_PREFERRED_ADDRESS; status = efi_relocate_kernel(image_addr, kernel_size, *image_size, - preferred_addr, MIN_KIMG_ALIGN, 0x0); + preferred_addr, efi_get_kimg_min_align(), + 0x0); if (status != EFI_SUCCESS) { efi_err("Failed to relocate kernel\n"); |