hw/arm: Add generic FDT-based machine and infrastructure
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest27 patches 14 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/27 | system/device_tree: update qemu_fdt_getprop/_cellhw/ hw/ hw/ +3 more | +55 | 1 reply | |
| 2/27 | system/device_tree: add few parsing and traversal helpersinclude/ system/ | +233 | 2 replies | |
| 3/27 | util/log: add log entry for fdt generic utilsinclude/ util/ | +2 | 0 replies | |
| 4/27 | hw/core: introduce generic FDT device model registryhw/ include/ | +217 | 0 replies | |
| 5/27 | hw/core/fdt_generic: implement FDT machine creation helpershw/ include/ | +95 | 0 replies | |
| 6/27 | hw/core/fdt_generic: add cpu clusters managementhw/ include/ | +90 | 0 replies | |
| 7/27 | hw/core/fdt_generic_util: implement main fdt parse routinehw/ include/ | +261 | 0 replies | |
| 8/27 | hw/core/fdt_generic_util: implement fdt_init_qdevhw/ | +224 | 0 replies | |
| 9/27 | hw/core/fdt_generic_util: initilize qdev properties from fdthw/ | +282 | 0 replies | |
| 10/27 | hw/core/fdt_generic_util: actually realize devicehw/ | +20 | 0 replies | |
| 11/27 | hw/core/fdt_generic_util: add TYPE_FDT_GENERIC_MMAPhw/ include/ | +55 | 0 replies | |
| 12/27 | hw/core/fdt_generic_util: add TYPE_FDT_GENERIC_INTChw/ include/ | +66 | 0 replies | |
| 13/27 | hw/core/fdt_generic_util: implement fdt_get_irq/_info APIhw/ include/ | +279 | 0 replies | |
| 14/27 | hw/core/fdt_generic_util: map device memoryhw/ | +103 | 0 replies | |
| 15/27 | hw/core/fdt_generic_util: Connect device irqshw/ include/ | +157 | 0 replies | |
| 16/27 | hw/core/fdt_generic_util: realize cpu clustershw/ | +11 | 0 replies | |
| 17/27 | hw/core: add fdt_generic to the buildhw/ | +2 | 0 replies | |
| 18/27 | hw/core/machine: add '-hw-dtb' option for machinehw/ include/ qemu-options.hx +1 more | +32 | 2 replies | |
| 19/27 | hw/arm: add generic ARM machine initialized by FDThw/ hw/ | +168 | 0 replies | |
| 20/27 | hw/core/sysbus: implement FDT_GENERIC_MMAP_CLASS interfacehw/ | +28 | 0 replies | |
| 21/27 | hw/intc/arm_gic: implement FDT_GENERIC_INTC and fdt supporthw/ hw/ | +82 | 0 replies | |
| 22/27 | target/arm/cpu: add fdt support for armv8-timertarget/ | +115 | 0 replies | |
| 23/27 | qom/object: export object_resolve_link()include/ qom/ | +13 | 0 replies | |
| 24/27 | system/memory: add setters for MemoryRegion propertiessystem/ | +161 | 0 replies | |
| 25/27 | system/memory: implement FDT_GENERIC_MMAP interfacesystem/ | +58 | 0 replies | |
| 26/27 | hw/core/fdt_generic_util: initialize serial deviceshw/ | +44 | 0 replies | |
| 27/27 | system/memory: add QOM aliases for fdt supportsystem/ | +24 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 00/27] hw/arm: Add generic FDT-based machine and infrastructure
From: Ruslan Ruslichenko <[email protected]>
This patch series introduces new ARM machine model, arm-generic-fdt, and the underlying infrastructure required to instantiate a QEMU machine from a Device Tree.
Origin
This feature originates from AMD QEMU repository and was originally developed by AMD. The sources available by link: https://github.com/Xilinx/qemu.
Motivation
Currently, adding support for a new ARM board in QEMU required writing a dedicated C source file to define the memory map, instantiate devices, and wire interrupts. Any modification to board configuration requires a corresponding change in the source code and rebuild of the QEMU binary.
This series introduce alternative approach to define board configuration via a Device Tree. The new arm-generic-fdt machine parses DTB at runtime to dynamically construct system topology.
Beyond providing more flexible board creation, the series provides the infrastructure needed to enable Hardware Co-Simulation workflows in future by using Remote-Port protocol:
https://mail.gnu.org/archive/html/qemu-devel/2025-12/msg02121.html.
In mixed simulation environments - where QEMU emulates CPU subsystem and external simulator (such as SystemC) handles custom logic - memory map and interrupt lines may need to be changed depending on external hardware configuration.
Implementation overview
The series implements FDT loading framework itself, which is capable of:
- Parsing and creating device models
- Set properties for them from a device tree
- Connect IRQs for SysBus devices
- Map memory regions for IO device or system RAM.
NOTE: The GPIO wiring for non-SysBus devices would be added in future patch series.
Patch Summary
- hw/core: Add Generic FDT parsing infrastructure and utility functions
- hw/arm: Add the arm-generic-machine model
- hw/core/sysbus: Add IO memory mapping for standard SysBus devices
- system/memory: Allow MemoryRegions to be configured from FDT
- hw/intc: Add FDT support for ARM GIC (IRQ translation and default wiring)
- target/arm: Add FDT support for CPU timers
Testing
Testing performed used Yocto core-image-minimal rootfs and kernel image.
The hardware description Device tree (used with '-hw-dtb' option) can be found here: https://gist.github.com/ruslichenkor/19a1b7d937dbf889190e670cb677e43e#file-arm64-virt-hw-dts
The guest device tree (used with standard '-dtb' option) can be found here: https://gist.github.com/ruslichenkor/19a1b7d937dbf889190e670cb677e43e#file-arm64-virt-guest-dts
Execute command itself:
./qemu-system-aarch64 \
-machine arm-generic-fdt \
-hw-dtb arm64-virt-hw.dtb \
-dtb arm64-virt-guest.dtb \
-cpu cortex-a57 -smp 4 -m 256 \
-drive id=disk0,file=./core-image-minimal-qemuarm64.rootfs-20251218190831.ext4,if=none,format=raw \
-device virtio-blk-device,drive=disk0 \
-kernel ./Image \
-nographic \
-append 'root=/dev/vda console=ttyAMA0 mem=256M swiotlb=0 'Ruslan Ruslichenko (27):
system/device_tree: update qemu_fdt_getprop/_cell system/device_tree: add few parsing and traversal helpers util/log: add log entry for fdt generic utils hw/core: introduce generic FDT device model registry hw/core/fdt_generic: implement FDT machine creation helpers hw/core/fdt_generic: add cpu clusters management hw/core/fdt_generic_util: implement main fdt parse routine hw/core/fdt_generic_util: implement fdt_init_qdev hw/core/fdt_generic_util: initilize qdev properties from fdt hw/core/fdt_generic_util: actually realize device hw/core/fdt_generic_util: add TYPE_FDT_GENERIC_MMAP hw/core/fdt_generic_util: add TYPE_FDT_GENERIC_INTC hw/core/fdt_generic_util: implement fdt_get_irq/_info API hw/core/fdt_generic_util: map device memory hw/core/fdt_generic_util: Connect device irqs hw/core/fdt_generic_util: realize cpu clusters hw/core: add fdt_generic to the build hw/core/machine: add '-hw-dtb' option for machine hw/arm: add generic ARM machine initialized by FDT hw/core/sysbus: implement FDT_GENERIC_MMAP_CLASS interface hw/intc/arm_gic: implement FDT_GENERIC_INTC and fdt support target/arm/cpu: add fdt support for armv8-timer qom/object: export object_resolve_link() system/memory: add setters for MemoryRegion properties system/memory: implement FDT_GENERIC_MMAP interface hw/core/fdt_generic_util: initialize serial devices system/memory: add QOM aliases for fdt support
hw/arm/arm_generic_fdt.c | 166 ++++ hw/arm/boot.c | 8 +- hw/arm/meson.build | 2 + hw/arm/raspi4b.c | 8 +- hw/arm/vexpress.c | 4 +- hw/arm/xlnx-zcu102.c | 3 +- hw/core/fdt_generic.c | 286 ++++++ hw/core/fdt_generic_util.c | 1349 ++++++++++++++++++++++++++++ hw/core/machine.c | 19 + hw/core/meson.build | 2 + hw/core/sysbus.c | 28 + hw/intc/arm_gic.c | 32 + hw/intc/arm_gic_common.c | 50 ++ include/hw/core/boards.h | 1 + include/hw/core/fdt_generic.h | 127 +++ include/hw/core/fdt_generic_util.h | 140 +++ include/qemu/log.h | 1 + include/qom/object.h | 12 + include/system/device_tree.h | 62 +- qemu-options.hx | 9 + qom/object.c | 2 +- system/device_tree.c | 236 ++++- system/memory.c | 248 ++++- system/vl.c | 3 + target/arm/cpu.c | 115 +++ util/log.c | 1 + 26 files changed, 2875 insertions(+), 39 deletions(-) create mode 100644 hw/arm/arm_generic_fdt.c create mode 100644 hw/core/fdt_generic.c create mode 100644 hw/core/fdt_generic_util.c create mode 100644 include/hw/core/fdt_generic.h create mode 100644 include/hw/core/fdt_generic_util.h
Signature · 1 line
2.43.0