{"id":2219336,"url":"http://patchwork.ozlabs.org/api/1.0/covers/2219336/?format=json","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.0/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260402215629.745866-1-ruslichenko.r@gmail.com>","date":"2026-04-02T21:55:45","name":"[v3,00/33] hw/arm: Introduce generic FDT-driven machine","submitter":{"id":92275,"url":"http://patchwork.ozlabs.org/api/1.0/people/92275/?format=json","name":"Ruslan Ruslichenko","email":"ruslichenko.r@gmail.com"},"series":[{"id":498555,"url":"http://patchwork.ozlabs.org/api/1.0/series/498555/?format=json","date":"2026-04-02T21:55:47","name":"hw/arm: Introduce generic FDT-driven machine","version":3,"mbox":"http://patchwork.ozlabs.org/series/498555/mbox/"}],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=rxnBhLSG;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fmwgg6Dl6z1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 03 Apr 2026 08:57:18 +1100 (AEDT)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1w8Q1w-0008BW-12; Thu, 02 Apr 2026 17:56:48 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <ruslichenko.r@gmail.com>)\n id 1w8Q1u-0008AU-55\n for qemu-devel@nongnu.org; Thu, 02 Apr 2026 17:56:46 -0400","from mail-ed1-x529.google.com ([2a00:1450:4864:20::529])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <ruslichenko.r@gmail.com>)\n id 1w8Q1q-00070n-O1\n for qemu-devel@nongnu.org; Thu, 02 Apr 2026 17:56:45 -0400","by mail-ed1-x529.google.com with SMTP id\n 4fb4d7f45d1cf-66bb66db39dso2176741a12.0\n for <qemu-devel@nongnu.org>; Thu, 02 Apr 2026 14:56:42 -0700 (PDT)","from thinkpad-t470s.. (93-143-182-244.adsl.net.t-com.hr.\n [93.143.182.244]) by smtp.googlemail.com with ESMTPSA id\n a640c23a62f3a-b9c3cac0e1asm134009166b.27.2026.04.02.14.56.38\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 02 Apr 2026 14:56:39 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775167001; x=1775771801; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=4PObQlThuLE5ltMUSrHMUcDNoBf7hiETI6gYFqvbHmc=;\n b=rxnBhLSG48eYlcUcw47MhzYF1ROU1uWDMTvWEN+W45o2UuCLZ+VLW5GfE91HFDeTCy\n dPM7LxDoC7FZoHcGKq1DSHxVnUie3qFA3bWMnFFsEi2kWulbMvwO8MCqnXD6XwKIeill\n IVGBu4JyYQtcRGGhNUwBpZgY9XIzdNaiqehbUooK5sH+op8svhsvneKE1lp7qiUw7+dZ\n j1aoLwCJsagefRBG4i0tEQ16FH+/89U/hxrvtTXYgveh0X7bcUHWzKXFKrHfPmyIgUYo\n 66qgyZDNm338dSNdIgtdRy4+HkxBBYgwDrHfw+KdD/Y6wrB6LjRNx2ZWIEhrt/3UAI3z\n JXYg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775167001; x=1775771801;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=4PObQlThuLE5ltMUSrHMUcDNoBf7hiETI6gYFqvbHmc=;\n b=ORCk3m8V1T13/MHqlXN9jh2S2f0SP/Y5tbP2PNETDk5WxhPIalde72LqaffIkJfQUG\n 9A7b+UxxyGwSY+qXxcPTWSKDXwOYebFP7+DC88rY2eI1wTMxcit7qWk4WkA/om2u8tib\n a+Y9So20yd++vMNy3iIYpKrPmVBaA7TGQCpbMxxEpMTc/qEAd1Sl0nDhieMR31ukkbQD\n CctZPa/EpLQKivtij0cFxfmRE2OwzpA+kUbAqABr3eRPA9ubonp6/PMotXo86W2alPvy\n pnMq46zRG2lbzS4E9wOBPgWMIz2XUZF4JrgwM7MaQm3HLkaSsrwnQYv+VghJzuMhn/by\n JSIw==","X-Gm-Message-State":"AOJu0Yx5zsz883kgiRLveN2S5UlzQN17DnkwdFap+93z5SRYj0RMULEt\n GAWbdK2tt5PIxBuXyC3nze9i1Sk12bl9VABlxkspQegoVgm+yUAMsU1YIcO21Cxr","X-Gm-Gg":"ATEYQzzFSZRA55U6/VrUJp0pMRYpF7seHEJKZDgmiRoubLVNzHe282tma/quEz23NYN\n a/y7uJ1sEduBZpCQdyNLlg5XDzA50ImmMKC7XDN5rG02OQ/0QuQSIvlR12UCaCACVhwYJERWfAb\n 7C4QPf566oUalds+q+IHMyqkR/PJ594epkscDhvrRfP9kZL5Qpw6ivC+RhAA93YaK7PWFWPPDpN\n QlMZprQ978qmtSAU+Xq1orW/2VCTW/d240jYu0EYtJbyQwi7WRNrdOA6Gtol+XLulCx9ltRoDXr\n unXwKVVGLu0gk3GIFXoflC8lI6MLMGYdBqbs0TwH/JGTTB+IuiD+6vyPyF/CrE/Pi+5BCVDFAr1\n FOVVM9uHzUYzZwzdIe/vd5dPzsj6eOWQzBWQ3DMSbv73ludd/oHw2mUyNnX1sFT7g3es8aaSeHy\n jJdzQZNU9OdDycYNmI6EVliMYxCSTorDQIwBdeTi4Vud+QHESjL69pCIkwa8AONa3+BlVyFA==","X-Received":"by 2002:a17:907:1b09:b0:b9b:5164:906b with SMTP id\n a640c23a62f3a-b9c672ae620mr22658566b.6.1775167000206;\n Thu, 02 Apr 2026 14:56:40 -0700 (PDT)","From":"Ruslan Ruslichenko <ruslichenko.r@gmail.com>","To":"qemu-devel@nongnu.org","Cc":"qemu-arm@nongnu.org, alex.bennee@linaro.org, peter.maydell@linaro.org,\n artem_mygaiev@epam.com, volodymyr_babchuk@epam.com,\n takahiro.nakata.wr@renesas.com,\n \"Edgar E . Iglesias\" <edgar.iglesias@gmail.com>,\n Ruslan_Ruslichenko@epam.com, balaton@eik.bme.hu,\n Alistair Francis <alistair.francis@wdc.com>,\n David Gibson <david@gibson.dropbear.id.au>","Subject":"[PATCH v3 00/33] hw/arm: Introduce generic FDT-driven machine","Date":"Thu,  2 Apr 2026 23:55:45 +0200","Message-ID":"<20260402215629.745866-1-ruslichenko.r@gmail.com>","X-Mailer":"git-send-email 2.43.0","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Received-SPF":"pass client-ip=2a00:1450:4864:20::529;\n envelope-from=ruslichenko.r@gmail.com; helo=mail-ed1-x529.google.com","X-Spam_score_int":"-20","X-Spam_score":"-2.1","X-Spam_bar":"--","X-Spam_report":"(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"From: Ruslan Ruslichenko <Ruslan_Ruslichenko@epam.com>\n\nThis patch series introduces a new ARM machine model, arm-generic-fdt, and the underlying infrastructure required\nto instantiate a QEMU machine entirely from a Device Tree.\n\nUpdates in v3:\n- Added support for binding host memory backends.\n- Simplified the main qdev initialization logic.\n- Reworked logging withing the FDT framework.\n- Moved the 'hw-dtb' parameter to be a machine option.\n- Addressed other comments from v2.\n\nUpdates in v2:\nThis version add support for an sbsa-ref compatible platform. Major additions include:\n\nGICv3: via the FDTGenericIntc interface.\nGPEX PCI Host: Dynamic mapping of MMIO windows via aliases and irq routing via a new gsi-irqs property.\nBlock Devices: New support for binding QEMU block backends to FDT nodes using blockdev.\nTesting: Added two new functional tests ensuring the machine can boot successfully similar sbsa-ref platform.\n\nAlso addressed comments received in v1.\n\nOrigin & Motivation\nThis feature originates from the AMD QEMU repository (https://github.com/Xilinx/qemu).\n\nCurrently, adding support for a new ARM board in QEMU requires writing a dedicated C source file to define the memory map,\ninstantiate devices, and wire interrupts. Any modification to the board configuration requires a corresponding change in\nthe source code and a rebuild of the QEMU binary.\n\nThis series introduces an alternative approach: defining the board configuration via a Device Tree Blob (DTB) provided at\nthe command line. The new arm-generic-fdt machine parses this DTB at runtime to dynamically construct the system topology.\n\nBeyond providing more flexible board creation, this infrastructure is a prerequisite for enabling Hardware Co-Simulation\nworkflows (e.g., using the Remote-Port protocol: https://mail.gnu.org/archive/html/qemu-devel/2026-02/msg01760.html).\nIn mixed simulation environments where QEMU emulates the CPU subsystem and an external simulator (such as SystemC) handles\ncustom logic, the memory map and interrupt lines often need to change dynamically based on the external hardware configuration,\nmaking static C models impractical.\n\nImplementation Overview\nThe series implements an FDT loading framework in hw/core/fdt_generic_util.c capable of:\n\nParsing and creating device models from FDT nodes.\nSetting QOM properties based on FDT properties.\nConnecting IRQs for SysBus devices (via FDTGenericIntc).\nMapping memory regions for IO devices or system RAM (via FDTGenericMMap).\nAttaching block devices specified via blockdev interface.\nNOTE: GPIO wiring for non-SysBus devices is not supported.\n\nTesting\nTesting can be performed by two scripts within patch series.\nPre-compiled dtb binaries for tests are currently placed at tests/data/dtb/aarch64/arm-generic-fdt.\n\nThe Device Trees to emulate VM similar sources used for testing can be found by following links:\n\nHardware DTS: https://gist.github.com/ruslichenkor/82245d89fb2a64dc7f1b694504cb840e#file-arm64-sbsa-hw-dts\nGuest DTS: https://gist.github.com/ruslichenkor/82245d89fb2a64dc7f1b694504cb840e#file-arm64-sbsa-guest-dts\n\nExample command to launch a VM similar to SBSA-ref:\n\n/qemu/build/qemu-system-aarch64 \\\n        --machine arm-generic-fdt,hw-dtb=arm64-sbsa-hw.dtb \\\n        -dtb arm64-sbsa-guest.dtb \\\n        -serial mon:stdio \\\n        -netdev user,id=net0 \\\n        -device e1000e,netdev=net0 \\\n        -device bochs-display \\\n        -blockdev driver=file,filename=./SBSA_FLASH0.fd,node-name=pflash0 \\\n        -blockdev driver=file,filename=./SBSA_FLASH1.fd,node-name=pflash1 \\\n        -device usb-kbd -device usb-tablet \\\n        -drive file=./alpine-standard-3.23.3-aarch64.iso,if=none,id=cdrom0,readonly=on \\\n        -device ide-cd,bus=ahci.0,unit=0,drive=cdrom0\n\nAlso it is possible to run simple ARM64 VM with direct kernel boot.\nThe example device tree for minimal VM machine can be found here:\n\nHardware DTS: https://gist.github.com/ruslichenkor/19a1b7d937dbf889190e670cb677e43e#file-arm64-virt-hw-dts\nGuest DTS: https://gist.github.com/ruslichenkor/19a1b7d937dbf889190e670cb677e43e#file-arm64-virt-guest-dts\n\nExample command for direct kernel boot:\n\n./qemu-system-aarch64 \\\n    -machine arm-generic-fdt,hw-dtb=arm64-virt-hw.dtb \\\n    -dtb arm64-virt-guest.dtb \\\n    -cpu cortex-a57 -smp 4 -m 256 \\\n    -drive id=disk0,file=./core-image-minimal-qemuarm64.rootfs-20251218190831.ext4,if=none,format=raw \\\n    -device virtio-blk-device,drive=disk0 \\\n    -kernel ./Image \\\n    -nographic \\\n    -append 'root=/dev/vda console=ttyAMA0 mem=256M swiotlb=0 '\n\nOpen Questions\nLocation of Test Binaries:\nI have added the compiled Device Tree Blobs (DTB) required for the functional tests into tests/data/dtb.\n\nQuestion: Is this the preferred location for static test binaries, or should they be placed elsewhere?\n\nPatch Summary\nhw/core: Add Generic FDT parsing infrastructure and utility functions (fdt_generic_util)\nhw/arm: Add the arm-generic-fdt machine model\nhw/core/sysbus: Add IO memory mapping for standard SysBus devices\nsystem/memory: Allow MemoryRegions to be configured from FDT\nhw/intc: Add FDT support for ARM GICv3 (IRQ translation and default wiring)\nhw/pci-host: Add gsi-irqs property for INTx mapping\ntarget/arm: Add FDT support for CPU timers\n\nRuslan Ruslichenko (33):\n  system/device_tree: update qemu_fdt_getprop_cell\n  system/device_tree: add few parsing and traversal helpers\n  util/log: add log entry for fdt generic utils\n  hw/core: introduce generic FDT device model registry\n  hw/core/fdt_generic: implement FDT machine creation helpers\n  hw/core/fdt_generic: add cpu clusters management\n  hw/core/fdt_generic_util: implement main fdt parse routine\n  hw/core/fdt_generic_util: implement fdt_init_qdev\n  qdev: Add qdev_prop_get_array_elem_type() helper\n  qom/object: export object_resolve_link()\n  hw/core/fdt_generic_util: initilize qdev properties from fdt\n  hw/core/fdt_generic_util: actually realize device\n  hw/core/fdt_generic_util: add TYPE_FDT_GENERIC_MMAP\n  hw/core/fdt_generic_util: add TYPE_FDT_GENERIC_INTC\n  hw/core/fdt_generic_util: implement fdt_get_irq/_info API\n  hw/core/fdt_generic_util: map device memory regions\n  hw/core/fdt_generic_util: Connect device irqs\n  hw/core/fdt_generic_util: realize cpu clusters\n  hw/core: add fdt_generic to the build\n  hw/arm: add generic ARM machine initialized by FDT\n  hw/arm/arm_generic_fdt: Add support for host-backed RAM regions\n  hw/core/sysbus: implement FDT_GENERIC_MMAP_CLASS interface\n  hw/intc/arm_gic: implement FDT_GENERIC_INTC and fdt support\n  target/arm/cpu: add fdt support for armv8-timer\n  system/memory: add setters for MemoryRegion properties\n  system/memory: implement FDT_GENERIC_MMAP interface\n  hw/core/fdt_generic_util: initialize serial devices\n  system/memory: add QOM aliases for fdt support\n  hw/intc/arm_gicv3: Implement FDTGenericIntc interface\n  hw/core/fdt_generic_util: Add deferred device initialization support\n  hw/core/fdt_generic_util: Add blockdev binding support\n  hw/pci-host: add gsi-irqs property array\n  tests/functional: Add functional tests for arm-generic-fdt machine\n\n hw/arm/arm_generic_fdt.c                      |  266 ++++\n hw/arm/boot.c                                 |    8 +-\n hw/arm/meson.build                            |    2 +\n hw/arm/raspi4b.c                              |    8 +-\n hw/arm/vexpress.c                             |    4 +-\n hw/core/fdt_generic.c                         |  259 ++++\n hw/core/fdt_generic_util.c                    | 1194 +++++++++++++++++\n hw/core/meson.build                           |    2 +\n hw/core/qdev-properties.c                     |   12 +\n hw/core/sysbus.c                              |   28 +\n hw/intc/arm_gic.c                             |   32 +\n hw/intc/arm_gic_common.c                      |   50 +\n hw/intc/arm_gicv3.c                           |   45 +\n hw/intc/arm_gicv3_common.c                    |   68 +\n hw/pci-host/gpex.c                            |    6 +\n include/hw/core/fdt_generic.h                 |  134 ++\n include/hw/core/fdt_generic_util.h            |  145 ++\n include/hw/core/qdev-properties.h             |    1 +\n include/hw/pci-host/gpex.h                    |    3 +\n include/qemu/log.h                            |    1 +\n include/qom/object.h                          |   12 +\n include/system/device_tree.h                  |   27 +-\n qom/object.c                                  |    2 +-\n system/device_tree.c                          |  210 ++-\n system/memory.c                               |  357 ++++-\n target/arm/cpu.c                              |  112 ++\n .../arm-generic-fdt/arm64-sbsa-guest.dtb      |  Bin 0 -> 673 bytes\n .../aarch64/arm-generic-fdt/arm64-sbsa-hw.dtb |  Bin 0 -> 5290 bytes\n tests/functional/aarch64/meson.build          |    2 +\n .../aarch64/test_arm_generic_fdt.py           |  114 ++\n .../aarch64/test_arm_generic_fdt_alpine.py    |   61 +\n util/log.c                                    |    1 +\n 32 files changed, 3138 insertions(+), 28 deletions(-)\n create mode 100644 hw/arm/arm_generic_fdt.c\n create mode 100644 hw/core/fdt_generic.c\n create mode 100644 hw/core/fdt_generic_util.c\n create mode 100644 include/hw/core/fdt_generic.h\n create mode 100644 include/hw/core/fdt_generic_util.h\n create mode 100644 tests/data/dtb/aarch64/arm-generic-fdt/arm64-sbsa-guest.dtb\n create mode 100644 tests/data/dtb/aarch64/arm-generic-fdt/arm64-sbsa-hw.dtb\n create mode 100755 tests/functional/aarch64/test_arm_generic_fdt.py\n create mode 100755 tests/functional/aarch64/test_arm_generic_fdt_alpine.py"}