3

In https://stackoverflow.com/questions/39614772/how-to-know-the-linux-kernel-run-either-el2-non-secure-or-el3-secure-mode, I saw in recent arm64 linux, the kernel runs at EL2 not EL1. Recently I'm doing linux port on a test board using u-boot-spl falcon mode. There too, when the CPU hardware started from EL3, the linux seems to be run in EL2 (from arm64, see https://elixir.bootlin.com/u-boot/latest/source/arch/arm/lib/spl.c#L55 and https://elixir.bootlin.com/u-boot/latest/source/arch/arm/cpu/armv8/transition.S#L13). My question is, for linux to run in EL2, is there anything I should set in the config, or is linux build agnostic to whether it will run in EL1 or EL2?

1 Answer 1

2

When we use u-boot as bootloader, (I think it will be the same if we do it using UEFI and grub, or arm reference design) the bootloader runs at EL3 and at the final code sets the elr (address to return to from the exception handling) to the entry address of linux. It then executes eret which makes it jump to linux address kept in elr, and the EL is automatically lowered to EL2 at the same time. In linux, the code examines if FEAT_VHE is implemented (virtualization hardware extension) and if so, it remains in EL2. When VHE is implemented, many accesses to EL1 registers are actually accessing those in EL2 (this part not 100% sure, I remember something like that). So for building linux, we don't have to set anything. (but I think if we turn CONFIG_ARM64_VHE off, it might run in EL1).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .