tune-cortexa32: Add AArch32 QEMU machine
v2 cover tune-cortexa32: Add AArch32 QEMU machine
Cortex-A32 is an AArch32-only ARMv8-A core - it has no AArch64 mode at all. The current tune-cortexa32.inc lacks the thumb feature, and its AArch32 crypto FPU selection and PACKAGE_EXTRA_ARCHS names are wrong for a Thumb-2 build.
Adds a qemuarmv8a32 machine so the above is actually exercisable: QEMU has no Cortex-A32 model, so it runs on the 'virt' machine with qemu-system-aarch64 using the Cortex-A32's AArch64-capable sibling, the Cortex-A35, with 'aarch64=off' so the guest is AArch32-only. This provides the ARMv8-A AArch32 feature set including the crypto extensions needed by the crypto tune, and the same binary supports KVM on AArch64 hosts whose CPUs implement AArch32 at EL1 via '-cpu host,aarch64=off'. The kernel is built as a zImage and u-boot uses qemu_arm_defconfig, matching the other 32-bit ARM QEMU machines.
AI-Generated: Claude Code (Claude Opus 4.8)
---
Changes in v2:
- Drop merged AArch32 ARMv8-A patches
- Cherry-pick upstream QEMU support to Allow aarch64=off for TCG
- Rework qemuarmv8a32 so it runs on qemu-system-aarch64 with aarch64=off
- Link to v1: https://patch.msgid.link/[email protected]
---
Alex Kiernan (2):
qemu: Backport support for 'aarch64=off' with TCG
qemuarmv8a32: add QEMU machine for AArch32 ARMv8-A
meta/conf/machine/qemuarmv8a32.conf | 38 ++++++ meta/recipes-devtools/qemu/qemu.inc | 2 + ...lear-AArch64-ID-regs-from-ARMISARegisters.patch | 110 +++++++++++++++++ ...-Allow-aarch64-off-to-be-set-for-TCG-CPUs.patch | 134 +++++++++++++++++++++ meta/recipes-kernel/linux/linux-yocto_6.18.bb | 2 +- 5 files changed, 285 insertions(+), 1 deletion(-)
---
base-commit: ddb2dd22942f2fcacb6b88d5b37d2a26ca832982
change-id: 20260701-tune-a32-78f0212484c9
Best regards,
Signature · 1 line
Alex Kiernan <[email protected]>
PATCH v2 1/2 qemu: Backport support for 'aarch64=off' with TCG
Backport the two-commit series from qemu master which allows the 'aarch64' CPU feature to be disabled under TCG for CPUs which support AArch32 at their highest implemented exception level. This allows an AArch32-only ARMv8-A guest to be run with qemu-system-aarch64 as e.g. '-cpu cortex-a35,aarch64=off', matching the '-cpu host,aarch64=off' invocation used with KVM, and is used by the qemuarmv8a32 machine.
AI-Generated: Claude Code (Claude Fable 5)
--- meta/recipes-devtools/qemu/qemu.inc | 2 + ...lear-AArch64-ID-regs-from-ARMISARegisters.patch | 110 +++++++++++++++++ ...-Allow-aarch64-off-to-be-set-for-TCG-CPUs.patch | 134 +++++++++++++++++++++ 3 files changed, 246 insertions(+)
meta/recipes-devtools/qemu/qemu.inc +2 -0
@@ -34,6 +34,8 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \ file://0011-qemu-Ensure-pip-and-the-python-venv-aren-t-used-for-.patch \ file://0012-meson-fix-close_range-detection-on-older-glibc.patch \ file://0013-hw-scsi-vhost-scsi-include-standard-headers-for-vhost-worker-structs.patch \ + file://0014-target-arm-Clear-AArch64-ID-regs-from-ARMISARegisters.patch \ + file://0015-target-arm-Allow-aarch64-off-to-be-set-for-TCG-CPUs.patch \ file://qemu-guest-agent.init \ file://qemu-guest-agent.udev \ file://0001-ui-sdl2.c-force-disable-SDL_HINT_VIDEO_X11_FORCE_EGL.patch \
meta/recipes-devtools/qemu/qemu/0014-target-arm-Clear-AArch64-ID-regs-from-ARMISARegisters.patch new file +110 -0
110 lines not on this page · raw message
meta/recipes-devtools/qemu/qemu/0015-target-arm-Allow-aarch64-off-to-be-set-for-TCG-CPUs.patch new file +134 -0
134 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v2 2/2 qemuarmv8a32: add QEMU machine for AArch32 ARMv8-A
In reply to Alex KiernanAdd 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-aarch64 using the Cortex-A32's AArch64-capable sibling, the Cortex-A35, with 'aarch64=off' so the guest is AArch32-only. This provides the ARMv8-A AArch32 feature set including the crypto extensions needed by the crypto tune, and the same binary supports KVM on AArch64 hosts whose CPUs implement AArch32 at EL1 via '-cpu host,aarch64=off'. 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, Claude Fable 5)
--- meta/conf/machine/qemuarmv8a32.conf | 38 +++++++++++++++++++++++++++ meta/recipes-kernel/linux/linux-yocto_6.18.bb | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-)
meta/conf/machine/qemuarmv8a32.conf new file +38 -0
@@ -0,0 +1,38 @@ +#@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 +# QEMU has no Cortex-A32 model; use its AArch64-capable sibling, the +# Cortex-A35, with AArch64 disabled so the guest is AArch32-only ARMv8-A. +# KVM needs an AArch64 host whose CPU supports AArch32 at EL1. +QB_SYSTEM_NAME = "qemu-system-aarch64" +QB_MACHINE = "-machine virt" +QB_CPU = "-cpu cortex-a35,aarch64=off" +QB_SMP ?= "-smp 4" +QB_CPU_KVM = "-cpu host,aarch64=off -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"
meta/recipes-kernel/linux/linux-yocto_6.18.bb +1 -1
@@ -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"
Signature · 1 line
2.43.0
Re: [OE-core] [PATCH v2 2/2] qemuarmv8a32: add QEMU machine for AArch32 ARMv8-A
Quoted 11 lines · Alex Kiernan via lists.openembedded.org
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-aarch64 using the Cortex-A32's AArch64-capable sibling, the Cortex-A35, with 'aarch64=off' so the guest is AArch32-only. This provides the ARMv8-A AArch32 feature set including the crypto extensions needed by the crypto tune, and the same binary supports KVM on AArch64 hosts whose CPUs implement AArch32 at EL1 via '-cpu host,aarch64=off'. The kernel is built as a zImage and u-boot uses
qemu_arm_defconfig, matching the other 32-bit ARM QEMU machines.
Whilst this is an interesting machine, I’m not sure I see a lot of value in adding it to oe-core. You could easily maintain a tiny BSP layer to do this, for example.
If we’re adding this to core then we either need to support it (which means someone needs to confirm that they’ll be maintaining it, we need to build it on the autobuilder which means more resources are used on every build, and build release artefacts for it), or explicitly say that it’s in the same tier as qemuppc etc where someone commits to maintaining the BSP but it’s not tested automatically and may well be broken.
Personally, I feel that qemuppc/qemumips are in that second tier for historical reasons, and if they were being added to core now I'd say to put them in a separate layer.
Ross
Re: [OE-core] [PATCH v2 2/2] qemuarmv8a32: add QEMU machine for AArch32 ARMv8-A
Quoted 14 lines · Ross Burton
Quoted 11 lines · Alex Kiernan via lists.openembedded.org
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-aarch64 using the Cortex-A32's AArch64-capable sibling, the Cortex-A35, with 'aarch64=off' so the guest is AArch32-only. This provides the ARMv8-A AArch32 feature set including the crypto extensions needed by the crypto tune, and the same binary supports KVM on AArch64 hosts whose CPUs implement AArch32 at EL1 via '-cpu host,aarch64=off'. The kernel is built as a zImage and u-boot uses
qemu_arm_defconfig, matching the other 32-bit ARM QEMU machines.
Quoted 6 lines
Whilst this is an interesting machine, I’m not sure I see a lot of value in adding it to oe-core. You could easily maintain a tiny BSP layer to do this, for example.
If we’re adding this to core then we either need to support it (which means someone needs to confirm that they’ll be maintaining it, we need to build it on the autobuilder which means more resources are used on every build, and build release artefacts for it), or explicitly say that it’s in the same tier as qemuppc etc where someone commits to maintaining the BSP but it’s not tested automatically and may well be broken.
Personally, I feel that qemuppc/qemumips are in that second tier for historical reasons, and if they were being added to core now I'd say to put them in a separate layer.
That's fair. Mostly it was having done the work to get the tune right (which is already in), it was having a way to demonstrate it without an actual board. But I agree without it hitting the AB matrix, it'll likely rot.
Happy for it to be dropped.
Signature · 1 line
Alex Kiernan