From: Ruslan Ruslichenko <[email protected]> hw/core: Introduce Remote Port Co-simulation Protocol
This patch series introduces the Remote Port (RP) subsystem, a framework designed to connect QEMU with external simulation environments (such as SystemC models or RTL simulators). Origin: The Remote Port protocol was originally developed by Edgar E. Iglesias. The original source code is available in the QEMU repository at AMD: https://github.com/Xilinx/qemu. Motivation In modern SoC and FPGA development, specialized hardware blocks are often verified using SystemC, Verilog, or VHDL long before silicon is available. While QEMU is optimized for high-performance CPU emulation and software development, it requires hardware models to be rewritten in C, which is time-consuming and duplicates effort. The Remote Port (RP) subsystem addresses this limitation by enabling a Co-simulation environment. It allows QEMU to act as the high-performance Processing Subsystem, booting complex operating systems (e.g. Linux), while delegating specific peripheral modeling to external simulators (SystemC, RTL) via a socket connection. The Remote Port protocol provides a socket-based interface that supports: Memory Transactions: Bidirectional memory accesses (Master and Slave) allowing QEMU to access remote devices and vice versa. Interrupts/GPIO: Propagation of interrupt signals between QEMU and the remote peer. IOMMU/ATS Support: Support for Address Translation Services, allowing remote devices to operate correctly behind IOMMU. Time Synchronization: Keeps QEMU and the external simulator in sync by advancing time in fixed steps (quantums). Integration with SystemC Ecosystem To connect the simulation side, the open-source libsystemctlm-soc library [1] is used. It acts as a bridge, translating Remote Port protocol packets into standard SystemC/TLM-2.0 transactions [2]. This allows users to attach existing TLM-2.0 compliant models to QEMU. Architecture Overview The series is structured into the following logical components: 1. Core Protocol & Infrastructure Establishes the socket connection and handshake (Hello protocol). Implements the packet dispatch loop and thread management. Introduces the -sync-quantum command line option to control simulation time-steps. 2. Memory Transaction Support RP Memory Slave: Allows the remote peer to initiate bus transactions within QEMU. RP Memory Master: Represents a memory region in QEMU that forwards accesses to the remote peer. 3. Address Translation Services (ATS) Implements the logic to handle ATS requests from remote masters. Integrates with QEMU's IOMMU notifiers to manage translation caches. 4. Device Tree (FDT) & Configuration Extends fdt-generic to automatically instantiate and wire up Remote Port devices based on Device Tree nodes. Provides helper functions for dynamic Qdev attachment (rp-adaptor, rp-chan). Dependencies This patch series is based on and extends the following previously submitted series: FDT based machine: https://mail.gnu.org/archive/html/qemu-devel/2026-01/msg05179.html SMMU support for platform bus: https://mail.gnu.org/archive/html/qemu-devel/2025-12/msg02637.html Validation: The functionality presented in this series has been validated using Renesas emulated peripherals. We are currently preparing a simplified SystemC reference IP core to serve as a functional demonstration and test case for this interface. We plan to provide this in a subsequent update. We would welcome feedback on the preferred location for this reference SystemC project, e.g. should it be included within the QEMU source tree under contrib/, tests/ or would it be preferable to maintain it as an external repository. Patch Summary The series is organized as follows: System/Global: system/vl: Introduce -machine-path command line option system: Introduce -sync-quantum command line option system/memory: Introduce unified MemoryTransaction and .access callback system/physmem: Add ats_do_translate helper Remote Port Core: hw/core: Add Remote Port protocol packet definition hw/core: Add Remote Port header helpers hw/core: Add Remote Port session state and hello protocol hw/core: Add Remote Port object skeleton hw/core: Setup Remote Port I/O channels hw/core: Add Remote Port protocol thread and handshake hw/core: Implement Remote Port packet dispatch logic hw/core: Implement Remote Port response handling hw/core: Implement Remote Port time synchronization hw/core: Implement Remote Port irq, sync and ATS helpers hw/core: Add Remote Port files to build Memory & Bus Access: hw/core: Implement Remote Port bus access helpers hw/core: Add Remote Port Memory Master object skeleton hw/core: Implement Remote Port Memory Master bus transactions hw/core: Add Remote Port memory slave device hw/core: Support IOMMU translation for Remote Port memory slave ATS & Streams: hw/core: Add Remote Port Stream device hw/core: Add Remote Port ATS device skeleton hw/core: Implement Remote Port ATS logic and cache management hw/core: Add ATS support to Remote Port memory slave FDT & GPIO: hw/core: Add Remote Port GPIO/Interrupt bridge hw/core: Add FDT support to Remote Port GPIO hw/core: Add FDT support to Remote Port memory master hw/core: Add Remote Port connection support to fdt-generic hw/core: Add Remote Port attachment helpers Links: [1] libsystemctlm library: https://github.com/Xilinx/libsystemctlm-soc [2] SystemC TLM description: https://systemc.org/overview/systemc-tlm/ Mirsad Ostrakovic (3): hw/core: Support IOMMU translation for Remote Port memory slave hw/core: Add Remote Port attachment helpers hw/core: Add ATS support to Remote Port memory slave Ruslan Ruslichenko (26): hw/core: Add Remote Port protocol packet definition hw/core: Add Remote Port header helpers hw/core: Add Remote Port session state and hello protocol hw/core: Implement Remote Port bus access helpers hw/core: Implement Remote Port irq, sync and ATS helpers system/vl: Introduce -machine-path command line option hw/core: Add Remote Port object skeleton hw/core: Setup Remote Port I/O channels hw/core: Add Remote Port protocol thread and handshake hw/core: Implement Remote Port packet dispatch logic hw/core: Implement Remote Port response handling hw/core: Implement Remote Port time synchronization system/memory: Introduce unified MemoryTransaction and .access callback hw/core: Add Remote Port Memory Master object skeleton hw/core: Implement Remote Port Memory Master bus transactions system/physmem: Add ats_do_translate helper hw/core: Add Remote Port ATS device skeleton hw/core: Implement Remote Port ATS logic and cache management hw/core: Add Remote Port memory slave device hw/core: Add Remote Port GPIO/Interrupt bridge hw/core: Add Remote Port Stream device hw/core: Add Remote Port files to build system: Introduce -sync-quantum command line option hw/core: Add FDT support to Remote Port GPIO hw/core: Add FDT support to Remote Port memory master hw/core: Add Remote Port connection support to fdt-generic hw/core/Kconfig | 4 + hw/core/fdt_generic_util.c | 130 ++- hw/core/meson.build | 11 + hw/core/remote-port-ats.c | 503 ++++++++++ hw/core/remote-port-gpio.c | 206 ++++ hw/core/remote-port-memory-master.c | 348 +++++++ hw/core/remote-port-memory-slave.c | 326 +++++++ hw/core/remote-port-proto.c | 466 +++++++++ hw/core/remote-port-qdev.c | 181 ++++ hw/core/remote-port-stream.c | 239 +++++ hw/core/remote-port.c | 985 ++++++++++++++++++++ hw/core/trace-events | 16 + include/hw/core/remote-port-ats.h | 78 ++ include/hw/core/remote-port-gpio.h | 33 + include/hw/core/remote-port-memory-master.h | 59 ++ include/hw/core/remote-port-memory-slave.h | 39 + include/hw/core/remote-port-proto.h | 547 +++++++++++ include/hw/core/remote-port.h | 194 ++++ include/system/memory.h | 31 + include/system/system.h | 4 + qemu-options.hx | 21 + system/memory.c | 66 +- system/physmem.c | 53 ++ system/vl.c | 12 + 24 files changed, 4537 insertions(+), 15 deletions(-) create mode 100644 hw/core/remote-port-ats.c create mode 100644 hw/core/remote-port-gpio.c create mode 100644 hw/core/remote-port-memory-master.c create mode 100644 hw/core/remote-port-memory-slave.c create mode 100644 hw/core/remote-port-proto.c create mode 100644 hw/core/remote-port-qdev.c create mode 100644 hw/core/remote-port-stream.c create mode 100644 hw/core/remote-port.c create mode 100644 include/hw/core/remote-port-ats.h create mode 100644 include/hw/core/remote-port-gpio.h create mode 100644 include/hw/core/remote-port-memory-master.h create mode 100644 include/hw/core/remote-port-memory-slave.h create mode 100644 include/hw/core/remote-port-proto.h create mode 100644 include/hw/core/remote-port.h -- 2.43.0
