diff mbox series

[3/3] qemuarmv8a32: add QEMU machine for AArch32 ARMv8-A

Message ID 20260701-tune-a32-v1-3-a43f28b1d7a4@gmail.com
State New
Headers show
Series tune-cortexa32: AArch32 Thumb-2/crypto fixes, plus a QEMU machine | expand

Commit Message

Alex Kiernan July 1, 2026, 11:58 a.m. UTC
Add a QEMU machine for exercising an AArch32-only ARMv8-A target
(Cortex-A32) under emulation, defaulting to the cortexa32-crypto tune.
QEMU has no Cortex-A32 model, so it runs on the 'virt' machine with
qemu-system-arm and -cpu max, which provides the ARMv8-A AArch32 feature
set including the crypto extensions needed by the crypto tune. The kernel
is built as a zImage and u-boot uses qemu_arm_defconfig, matching the
other 32-bit ARM QEMU machines.

Map KMACHINE to qemuarma15 so the existing linux-yocto BSP is reused, and
add qemuarmv8a32 to linux-yocto's COMPATIBLE_MACHINE so a kernel can be
built for it.

AI-Generated: Claude Code (Claude Opus 4.8)
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Signed-off-by: Alex Kiernan <alexk@a-squared-projects.uk>
---
 meta/conf/machine/qemuarmv8a32.conf           | 36 +++++++++++++++++++++++++++
 meta/recipes-kernel/linux/linux-yocto_6.18.bb |  2 +-
 2 files changed, 37 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/conf/machine/qemuarmv8a32.conf b/meta/conf/machine/qemuarmv8a32.conf
new file mode 100644
index 000000000000..8e49a56ae720
--- /dev/null
+++ b/meta/conf/machine/qemuarmv8a32.conf
@@ -0,0 +1,36 @@ 
+#@TYPE: Machine
+#@NAME: QEMU ARMv8 AArch32 machine on Cortex-A32
+#@DESCRIPTION: Machine configuration for running an AArch32 system on QEMU
+
+DEFAULTTUNE = "cortexa32-crypto"
+
+require conf/machine/include/arm/armv8a/tune-cortexa32.inc
+require conf/machine/include/qemu.inc
+
+KERNEL_IMAGETYPE = "zImage"
+
+PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot"
+UBOOT_MACHINE ?= "qemu_arm_defconfig"
+
+SERIAL_CONSOLES ?= "115200;ttyAMA0 115200;hvc0"
+
+# For runqemu
+QB_SYSTEM_NAME = "qemu-system-arm"
+QB_MACHINE = "-machine virt"
+# QEMU doesn't know about Cortex-A32
+QB_CPU = "-cpu max"
+QB_SMP ?= "-smp 4"
+QB_CPU_KVM = "-cpu host -machine gic-version=3"
+# For graphics to work we need to define the VGA device as well as the necessary USB devices
+QB_GRAPHICS = "-device virtio-gpu-pci"
+QB_OPT_APPEND = "-device qemu-xhci -device usb-tablet -device usb-kbd"
+# Virtio Networking support
+QB_TAP_OPT = "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no"
+QB_NETWORK_DEVICE = "-device virtio-net-pci,netdev=net0,mac=@MAC@"
+# Virtio block device
+QB_ROOTFS_OPT = "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-pci,drive=disk0"
+# Virtio serial console
+QB_SERIAL_OPT = "-device virtio-serial-pci -chardev null,id=virtcon -device virtconsole,chardev=virtcon"
+QB_TCPSERIAL_OPT = "-device virtio-serial-pci -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1,nodelay=on -device virtconsole,chardev=virtcon"
+
+KMACHINE:qemuarmv8a32 = "qemuarma15"
diff --git a/meta/recipes-kernel/linux/linux-yocto_6.18.bb b/meta/recipes-kernel/linux/linux-yocto_6.18.bb
index 2b1298dedf9c..a818506bb6f3 100644
--- a/meta/recipes-kernel/linux/linux-yocto_6.18.bb
+++ b/meta/recipes-kernel/linux/linux-yocto_6.18.bb
@@ -52,7 +52,7 @@  KCONF_BSP_AUDIT_LEVEL = "1"
 
 KERNEL_DEVICETREE:qemuarmv5 = "arm/versatile-pb.dtb"
 
-COMPATIBLE_MACHINE = "^(qemuarm|qemuarmv5|qemuarm64|qemux86|qemuppc|qemuppc64|qemumips|qemumips64|qemux86-64|qemuriscv64|qemuriscv32|qemuloongarch64)$"
+COMPATIBLE_MACHINE = "^(qemuarm|qemuarmv5|qemuarmv8a32|qemuarm64|qemux86|qemuppc|qemuppc64|qemumips|qemumips64|qemux86-64|qemuriscv64|qemuriscv32|qemuloongarch64)$"
 
 # Functionality flags
 KERNEL_EXTRA_FEATURES ?= "features/netfilter/netfilter.scc"