aboutsummaryrefslogtreecommitdiff
path: root/plat/arm/board/arm_fpga/kernel_trampoline.S
blob: f4c08ef28939c740199f4100f2b29dbba66d473d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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