[PATCH v2 00/20] hw/core: Introduce Remote Port Co-simulation Protocol

Ruslan Ruslichenko posted 20 patches 1 week, 4 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260915160044.345788-1-ruslichenko.r@gmail.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Peter Xu <peterx@redhat.com>, "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
hw/core/Kconfig                             |   4 +
hw/core/meson.build                         |  10 +
hw/core/remote-port-ats.c                   | 412 +++++++++++
hw/core/remote-port-gpio.c                  | 210 ++++++
hw/core/remote-port-memory-master.c         | 369 +++++++++
hw/core/remote-port-memory-slave.c          | 242 ++++++
hw/core/remote-port-proto.c                 | 467 ++++++++++++
hw/core/remote-port-stream.c                | 246 ++++++
hw/core/remote-port.c                       | 782 ++++++++++++++++++++
hw/core/trace-events                        |  22 +
include/hw/core/remote-port-ats.h           |  76 ++
include/hw/core/remote-port-gpio.h          |  34 +
include/hw/core/remote-port-memory-master.h |  81 ++
include/hw/core/remote-port-memory-slave.h  |  35 +
include/hw/core/remote-port-proto.h         | 541 ++++++++++++++
include/hw/core/remote-port.h               | 164 ++++
include/system/memory.h                     |   8 +
system/physmem.c                            |  53 ++
18 files changed, 3756 insertions(+)
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-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
[PATCH v2 00/20] hw/core: Introduce Remote Port Co-simulation Protocol
Posted by Ruslan Ruslichenko 1 week, 4 days ago
From: Ruslan Ruslichenko <Ruslan_Ruslichenko@epam.com>

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).

Updates in v2:

- Removed global 'machine-path' and 'sync-quantum' cmdline options
- Added EventNotifier for communication between IO and CPU threads, instead of pipes and sockets
- Made chrdev_id mandatory and simplified chardev configuration
- MemoryTransaction .access handler dropped and reworked RPMemoryTransaction to use existing .read/write_with_attrs
- Reduced coupling with HW Device Tree by making rp devices register themselves within rp core using rp-chan property
- Dropped debug macros and added tracepoints instead
- Added reference to sample project using QEMU with SystemC
- Addressed review comments from v1 patch series:
  https://lists.gnu.org/archive/html/qemu-devel/2026-02/msg01760.html

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.

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

Added FDT support for Remote Port Memory Master and GPIO

Dependencies

Patches 19-20 in series are based on the following previously submitted series:
FDT based machine v3: https://lists.nongnu.org/archive/html/qemu-devel/2026-04/msg00415.html

Instantiation of Remote Port via FDT also registers its reset handler,
needed to start protocol thread.

Validation:

The Sample Project demonstrating test setup with QEMU/Remote Port and SystemC emulated PL011 UART module available by following link:
https://github.com/renesas/SysC_Island_MIT


Patch Summary
The series is organized as follows:

System/Global:

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: Add Remote Port protocol thread and handshake
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

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

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

Links:
[1] libsystemctlm library: https://github.com/Xilinx/libsystemctlm-soc

[2] SystemC TLM description: https://systemc.org/overview/systemc-tlm/


Ruslan Ruslichenko (20):
  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
  hw/core: Add Remote Port object skeleton
  hw/core: Add Remote Port protocol thread and handshake
  hw/core: Implement Remote Port response handling
  hw/core: Implement Remote Port time synchronization
  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
  hw/core: Add FDT support to Remote Port GPIO
  hw/core: Add FDT support to Remote Port memory master

 hw/core/Kconfig                             |   4 +
 hw/core/meson.build                         |  10 +
 hw/core/remote-port-ats.c                   | 412 +++++++++++
 hw/core/remote-port-gpio.c                  | 210 ++++++
 hw/core/remote-port-memory-master.c         | 369 +++++++++
 hw/core/remote-port-memory-slave.c          | 242 ++++++
 hw/core/remote-port-proto.c                 | 467 ++++++++++++
 hw/core/remote-port-stream.c                | 246 ++++++
 hw/core/remote-port.c                       | 782 ++++++++++++++++++++
 hw/core/trace-events                        |  22 +
 include/hw/core/remote-port-ats.h           |  76 ++
 include/hw/core/remote-port-gpio.h          |  34 +
 include/hw/core/remote-port-memory-master.h |  81 ++
 include/hw/core/remote-port-memory-slave.h  |  35 +
 include/hw/core/remote-port-proto.h         | 541 ++++++++++++++
 include/hw/core/remote-port.h               | 164 ++++
 include/system/memory.h                     |   8 +
 system/physmem.c                            |  53 ++
 18 files changed, 3756 insertions(+)
 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-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