@@ -11,6 +11,7 @@
*/
#include <linux/linkage.h>
#include <linux/init.h>
+#include <linux/sizes.h>
#include <asm/assembler.h>
@@ -110,7 +111,8 @@ ENTRY(efi_stub_entry)
2:
/* Jump to kernel entry point */
mov x0, x20
- mov x1, xzr
+ and x1, x21, #~(SZ_2M - 1)
+ and x1, x1, #(SZ_1G - 1)
mov x2, xzr
mov x3, xzr
br x21
@@ -38,8 +38,9 @@ efi_status_t __init handle_kernel_image(efi_system_table_t *sys_table,
if (*image_addr != preferred_offset) {
const unsigned long alloc_size = kernel_memsize + TEXT_OFFSET;
- status = efi_low_alloc(sys_table, alloc_size, SZ_2M,
- reserve_addr);
+ status = efi_high_alloc(sys_table, alloc_size, SZ_2M,
+ reserve_addr,
+ (dram_base | (SZ_1G - 1)) + 1);
/*
* Check whether the new allocation crosses a 512 MB alignment
PoC for relocated kernel code. This puts the kernel at the top of the lowest naturally aligned 1 GB region of memory, and relocates the kernel so that the relative alignment of physical and virtual memory is at least 1 GB as well. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> --- arch/arm64/kernel/efi-entry.S | 4 +++- arch/arm64/kernel/efi-stub.c | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-)