[PATCH 0/5] ARM64: make barebox compatible with KVM
Ahmad Fatoum
a.fatoum at pengutronix.de
Tue Oct 8 23:05:06 PDT 2024
It was noticed by a patch series[1] for OpenEmbedded-core that
neither barebox nor U-Boot reach their shell when tested on a native
AArch64 server with Qemu running with KVM enabled.
After investigation and help from the Qemu/KVM maintainers[2], it turns
out that software that wants to run under KVM needs to take care what
instructions it uses for MMIO accesses:
Accessing a MMIO region will trap and KVM will check the exception
syndrome register and extract the information it needs to emulate the
access.
However, not all instructions that access memory can be described by
this Instruction Specific Syndrome. Notably, the pre- and post-index
variants of ldr/str don't have valid syndromes on trap; this is because
the instruction not only access the memory specified by the register,
but also increments the address in the register and KVM would need to
decode these instructions to be able to emulate that, which it currently
does not.
Linux doesn't suffer from this issue, because it implements readl/writel
in assembly and makes sure they only use KVM-friendly instructions.
This series does the same for barebox and also fixes other crashes
and slow-downs related to I/O that were noticed along the way.
[1]: https://lore.kernel.org/all/b77f2c6737c330ef9ecce325d50a4aaa25b3e536.camel@linuxfoundation.org/
[2]: https://lore.kernel.org/all/89f184d6-5b61-4c77-9f3b-c0a8f6a75d60@pengutronix.de/
Ahmad Fatoum (5):
ARM64: io: implement I/O accessors in assembly
ARM64: board-dt-2nd: grow stack down from start of binary
mtd: cfi-flash: use I/O accessors for reads/writes of MMIO regions
ARM64: mmu: flush cacheable regions prior to remapping
virtio: don't use DMA API unless required
arch/arm/cpu/board-dt-2nd-aarch64.S | 2 +-
arch/arm/cpu/mmu_64.c | 105 ++++++++++++++++++++++++++--
arch/arm/include/asm/io.h | 5 +-
arch/arm/include/asm/io64.h | 99 ++++++++++++++++++++++++++
drivers/mtd/nor/cfi_flash.c | 2 +-
drivers/mtd/nor/cfi_flash.h | 15 +++-
drivers/virtio/virtio_ring.c | 85 +++++++++++++++++++---
include/linux/virtio_ring.h | 1 +
8 files changed, 293 insertions(+), 21 deletions(-)
create mode 100644 arch/arm/include/asm/io64.h
--
2.39.5
More information about the barebox
mailing list