summaryrefslogtreecommitdiff
path: root/drivers/firmware/efi/libstub
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2022-10-17 17:06:39 +0300
committerArd Biesheuvel <ardb@kernel.org>2022-11-09 14:42:01 +0300
commitaaeb3fc614d65ec5c0b838ed1afb59c3f0f04643 (patch)
treea22b7934b5f0065bab33a177b2c907108dc62ff2 /drivers/firmware/efi/libstub
parent0d60ffeec53cc378cc282d51e870275c642532c6 (diff)
downloadlinux-aaeb3fc614d65ec5c0b838ed1afb59c3f0f04643.tar.xz
arm64: efi: Move dcache cleaning of loaded image out of efi_enter_kernel()
The efi_enter_kernel() routine will be shared between the existing EFI stub and the zboot decompressor, and the version of dcache_clean_to_poc() that the core kernel exports to the stub will not be available in the latter case. So move the handling into the .c file which will remain part of the stub build that integrates directly with the kernel proper. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'drivers/firmware/efi/libstub')
-rw-r--r--drivers/firmware/efi/libstub/arm64-stub.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/firmware/efi/libstub/arm64-stub.c b/drivers/firmware/efi/libstub/arm64-stub.c
index 259e4b852d63..bcb21afd8aeb 100644
--- a/drivers/firmware/efi/libstub/arm64-stub.c
+++ b/drivers/firmware/efi/libstub/arm64-stub.c
@@ -156,7 +156,7 @@ efi_status_t handle_kernel_image(unsigned long *image_addr,
*/
*image_addr = (u64)_text;
*reserve_size = 0;
- return EFI_SUCCESS;
+ goto clean_image_to_poc;
}
status = efi_allocate_pages_aligned(*reserve_size, reserve_addr,
@@ -172,5 +172,13 @@ efi_status_t handle_kernel_image(unsigned long *image_addr,
*image_addr = *reserve_addr;
memcpy((void *)*image_addr, _text, kernel_size);
+clean_image_to_poc:
+ /*
+ * Clean the copied Image to the PoC, and ensure it is not shadowed by
+ * stale icache entries from before relocation.
+ */
+ dcache_clean_poc(*image_addr, *image_addr + kernel_size);
+ asm("ic ialluis");
+
return EFI_SUCCESS;
}