Index | Thread | Search

From:
Marc Zyngier <maz@kernel.org>
Subject:
[PATCH 0/4] Fixes for arm64 when running at EL2
To:
tech@openbsd.org
Cc:
kettenis@openbsd.org
Date:
Sun, 12 Apr 2026 11:18:20 +0100

Download raw body.

Thread
Hi all,

Disclaimer: this is my first OpenBSD contribution, so I apologise
in advance if the way these changes are written fail to match the OpenBSD
expectations (I'm more used to another OS kernel). Guidance appreciated.

I have been debugging OpenBSD boot failures when running as a KVM/arm64
nested virt guest, where the guest is entered at EL2 and runs on virtual
CPUs that are VHE only.

There are three main issues at hand:

- HCR_EL2.TGE is never explicitly set, leading to crashes upon reaching
  userspace

- the detection of HCR_EL2.E2H being RES1 is unreliable

- the timer interrupt is not the correct one when running at EL2

With these points addressed, I'm able to boot and use OpenBSD booted
at EL2 as a KVM/arm64 guest, and these patches are written from that
particular guest.

I have tested it as a guest for all combinations of EL1/EL2 and DT/ACPI.
I have not been able to test it on Apple hardware, and help on this would
be much appreciated.

Thanks,

	M.

Marc Zyngier (4):
  Make sure that HCR_EL2.TGE is set if running at EL2
  Handle HCR_EL2.E2H RES1 behaviour
  Pick the correct timer interrupt for the running EL
  Generate FDT entry for the EL2 virtual timer when available in GTDT

 sys/arch/arm64/arm64/locore.S          | 28 ++++++++++++++++++----
 sys/arch/arm64/dev/agtimer.c           | 32 +++++++++++++++++++++++++-
 sys/arch/arm64/stand/efiboot/efiacpi.c | 15 ++++++++++--
 3 files changed, 67 insertions(+), 8 deletions(-)

-- 
2.51.0