| 1 |
/* |
| 2 |
* Copyright (c) 2021, ARM Limited. All rights reserved. |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: BSD-3-Clause |
| 5 |
* |
| 6 |
* The traditional arm64 Linux kernel load address is 512KiB from the |
| 7 |
* beginning of DRAM, caused by this having been the default value of the |
| 8 |
* kernel's CONFIG_TEXT_OFFSET Kconfig value. |
| 9 |
* However kernel version 5.8 changed the default offset (into a 2MB page) |
| 10 |
* to 0, so TF-A's default assumption is no longer true. Fortunately the |
| 11 |
* kernel got more relaxed about this offset at the same time, so it |
| 12 |
* tolerates the wrong offset, but issues a warning: |
| 13 |
* [Firmware Bug]: Kernel image misaligned at boot, please fix your bootloader! |
| 14 |
* |
| 15 |
* We cannot easily change the load address offset in TF-A to be 2MiB, because |
| 16 |
* this would break older kernels - and they are not as forgiving in this |
| 17 |
* respect. |
| 18 |
* |
| 19 |
* But we can allow users to load the kernel at the right offset, and |
| 20 |
* offer this trampoline here to transition to this new load address. |
| 21 |
* Any older kernels, or newer kernels misloaded, will overwrite this code |
| 22 |
* here, so it does no harm in this case. |
| 23 |
*/ |
| 24 |
|
| 25 |
#include <asm_macros.S> |
| 26 |
#include <common/bl_common.ld.h> |
| 27 |
|
| 28 |
.text |
| 29 |
.global _tramp_start |
| 30 |
|
| 31 |
_tramp_start: |
| 32 |
adr x4, _tramp_start |
| 33 |
orr x4, x4, #0x1fffff |
| 34 |
add x4, x4, #1 /* align up to 2MB */ |
| 35 |
br x4 |