aboutsummaryrefslogtreecommitdiff
path: root/plat/arm/board/arm_fpga/kernel_trampoline.S
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 05:09:52 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 05:09:52 +0000
commit2acdc134972f4b1faf7e4e86f3425d015dd6f089 (patch)
tree2ce8a4e341ac9f98fb265347777487eda74eba48 /plat/arm/board/arm_fpga/kernel_trampoline.S
parentd2ebd507612c6d0e62ab68cc89a76b29d47a4394 (diff)
parent138668cae2394deb5d695c70fe4aa9760c4458ee (diff)
downloadarm-trusted-firmware-2acdc134972f4b1faf7e4e86f3425d015dd6f089.tar.gz
Change-Id: I4e93f50d8d89ecf76a67a8412fa96bf8b7247421
Diffstat (limited to 'plat/arm/board/arm_fpga/kernel_trampoline.S')
-rw-r--r--plat/arm/board/arm_fpga/kernel_trampoline.S35
1 files changed, 35 insertions, 0 deletions
diff --git a/plat/arm/board/arm_fpga/kernel_trampoline.S b/plat/arm/board/arm_fpga/kernel_trampoline.S
new file mode 100644
index 000000000..f4c08ef28
--- /dev/null
+++ b/plat/arm/board/arm_fpga/kernel_trampoline.S
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2021, ARM Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * The traditional arm64 Linux kernel load address is 512KiB from the
+ * beginning of DRAM, caused by this having been the default value of the
+ * kernel's CONFIG_TEXT_OFFSET Kconfig value.
+ * However kernel version 5.8 changed the default offset (into a 2MB page)
+ * to 0, so TF-A's default assumption is no longer true. Fortunately the
+ * kernel got more relaxed about this offset at the same time, so it
+ * tolerates the wrong offset, but issues a warning:
+ * [Firmware Bug]: Kernel image misaligned at boot, please fix your bootloader!
+ *
+ * We cannot easily change the load address offset in TF-A to be 2MiB, because
+ * this would break older kernels - and they are not as forgiving in this
+ * respect.
+ *
+ * But we can allow users to load the kernel at the right offset, and
+ * offer this trampoline here to transition to this new load address.
+ * Any older kernels, or newer kernels misloaded, will overwrite this code
+ * here, so it does no harm in this case.
+ */
+
+#include <asm_macros.S>
+#include <common/bl_common.ld.h>
+
+.text
+.global _tramp_start
+
+_tramp_start:
+ adr x4, _tramp_start
+ orr x4, x4, #0x1fffff
+ add x4, x4, #1 /* align up to 2MB */
+ br x4