mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/5] ARM64: make barebox compatible with KVM
@ 2024-10-09  6:05 Ahmad Fatoum
  2024-10-09  6:05 ` [PATCH 1/5] ARM64: io: implement I/O accessors in assembly Ahmad Fatoum
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2024-10-09  6:05 UTC (permalink / raw)
  To: barebox; +Cc: ejo

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




^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-10-15  6:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-09  6:05 [PATCH 0/5] ARM64: make barebox compatible with KVM Ahmad Fatoum
2024-10-09  6:05 ` [PATCH 1/5] ARM64: io: implement I/O accessors in assembly Ahmad Fatoum
2024-10-09  6:05 ` [PATCH 2/5] ARM64: board-dt-2nd: grow stack down from start of binary Ahmad Fatoum
2024-10-09  6:05 ` [PATCH 3/5] mtd: cfi-flash: use I/O accessors for reads/writes of MMIO regions Ahmad Fatoum
2024-10-09  6:05 ` [PATCH 4/5] ARM64: mmu: flush cacheable regions prior to remapping Ahmad Fatoum
2024-10-09  6:05 ` [PATCH 5/5] virtio: don't use DMA API unless required Ahmad Fatoum
2024-10-14 12:48   ` Sascha Hauer
2024-10-14 13:05     ` Ahmad Fatoum
2024-10-14 13:06   ` [PATCH] fixup! " Ahmad Fatoum
2024-10-15  6:54 ` [PATCH 0/5] ARM64: make barebox compatible with KVM Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox