hw/pci: hw/cxl: Add UIO support in CXL and PCIe stack.
A message that is not in the archive (sent off-list or not yet received): CGME20261104113003epcas5p43fd57f95a6f4b1a0c6ee2a8b1ab8cad5@epcas5p4.samsung.com
cover hw/pci: hw/cxl: Add UIO support in CXL and PCIe stack.
Hi All,
This is the v1 of the "UIO feature enablement in Qemu" series, a follow up of RFC V2 [1] with the review comments addressed. The series adds enumeration and configuration support
for the PCIe Unordered I/O (UIO) feature across the standard PCIe and the CXL stack of QEMU, and establishes the foundation for the OS to discover, negotiate and configure UIO capabilities on CXL ports and devices.
UIO is a transaction layer enhancement that relaxes the strict transaction ordering rules of PCIe and moves the ordering control from the fabric to the requester. UIO, introduced from PCIe 6.1, in CXL follows the CXL.io protocol, where a device sends read and write requests directly to the HDM decoder of a peer .mem device at the switch level and the host is bypassed in the data path. For that, the requester, the completer and the intermediate ports of the topology carry the UIO dependent capabilities:
- 256-byte flit mode
- Streamlined Virtual Channel (SVC) Extended Capability
- PCIe Device 3 Extended Capability
In the example topology below, Dev A is the requester, Dev B and Dev C are the completers, and the root port and the switch ports sit in the data path as the intermediate ports:
__________________________________________
| |
| CXL Host Bridge |
| (Root Port/RC) |
|__________________________________________|
|
___________________|______________________
| |
| CXL Switch |
|__________________________________________|
| | |
___|____ ___|_____ ___|____
| | | | | |
| Dev A | | Dev B | | Dev C |
| (Req) | |(Target) | |(Target)|
|________| |_________| |________|With all the dependent capabilities enabled on Dev A and Dev B and on the ports of the path between them, Dev A issues its CXL.io read and write requests to the HDM decoder of Dev B on the UIO virtual channel: the switch routes the requests from the downstream port of Dev A to the downstream port of Dev B, and the root port and the host bridge are bypassed in the data path.
V1:
- x-256b-flit defaults to off on all port types, keeping the config space and migration state compatible.
- x-uio is moved to the pxb-cxl host bridge; the CXL type 3 device warns and leaves UIO disabled at realize time when x-uio is set without x-svc and x-256b-flit.
- SVC validates the Protocol Selected field of a guest's Resource Control writes against the resource capability.
- The Flit Status bit of the Link Status 2 register is derived again after a device reset, so it stays consistent with the Flit Disable bit of the Link Control register.
- Series reduced from 10 to 8 patches; properties are defined in the patches that use them.
RFC V2:
- The Device 3 capability is added to the PCIe stack and wired to the CXL type 3 device.
- The UIO related DVSEC registers are added to the CXL stack.
- UIO becomes a generic capability instead of being tied to the type 3 device.
- The SVC capability is extended to the CXL type 3 device, and the x-svc and x-uio properties are added.
Contents
--------
New properties:
- x-256b-flit: enables 256-byte flit mode signaling (Flit Mode Supported, Flit Status), as an extension of the implementation from Davidlohr Bueso's patch series [2]. Accepted by all the ports derived from PCIEPort and by the CXL type 3 device. Defaults to off.
- x-svc: adds the SVC capability to a port or to the CXL type 3 device.
- x-uio: carries the UIO capability. On the pxb-cxl host bridge it marks the root ports within the host bridge as UIO capable; a CXL root port advertises UIO when its parent host bridge carries x-uio and its own x-svc and x-256b-flit are set; the CXL type 3 device carries the UIO capability, with the Device 3 capability, when x-uio, x-svc and x-256b-flit are all set.
Patches:
1) Refactor the flitmode field from PCIESlot to PCIEPort and default the x-256b-flit property to off.
2) Move the x-256b-flit property from cxl_root_port to pcie_root_port.
3) Wire the UIO capability into the HDM decoder and DVSEC registers, and add the x-uio property to the pxb-cxl host bridge.
4) Add the PCIe Streamlined Virtual Channel (SVC) extended capability.
5) Wire the SVC initialization into the port realize functions.
6) Add the PCIe Device 3 extended capability.
7) Wire the SVC and Device 3 capabilities to the CXL Type 3 device.
8) Add documentation for the UIO options with an example topology.
Testing:
Linux kernel enumeration on a q35 topology with a CXL switch and three type 3 devices: SVC and Dev3 capability discovery, HDM decoder UIO bits, flit mode status and the per-VC state of the UIO enablement path.
Linux kernel series for this work is maintained separately and follows later.
This series has been written on top of:
Base commit: 3c99db7705c1a885c795b7c14f751c7a3ba29ed8
Repository: https://gitlab.com/jic23/qemu
Branch: cxl-2026-01-09-draft
Future work:
Provide UIO requester capability to the CXL Type 2 device for E2E testing.
Thanks!
References
[1] https://lore.kernel.org/qemu-devel/1212772528.01787732102473.JavaMail.epsvc@epcpadp1new/
[2] https://lore.kernel.org/all/[email protected]/
Shrihari E S and Dongjoo Seo (8):
hw/pci: Refactor flitmode from PCIESlot to PCIEPort
hw/pci: Move 'x-256b-flit' property from cxl_root_port to pcie_root_port hw/cxl: Wire UIO capability into HDM decoder and DVSEC registers hw/pci: Add PCIe Streamlined Virtual Channel (SVC) capability hw/pci: Wire SVC initialization into port realize functions hw/pci: Add PCIe Device3 capability support
hw/cxl: Wire SVC and Dev3 capabilities to CXL Type 3 device
cxl: Add documentation for CXL UIO support
docs/system/devices/cxl.rst | 54 +++++++- hw/cxl/cxl-component-utils.c | 55 ++++++++- hw/mem/cxl_type3.c | 36 +++++- hw/pci-bridge/cxl_downstream.c | 18 ++- hw/pci-bridge/cxl_root_port.c | 37 +++++- hw/pci-bridge/cxl_upstream.c | 26 ++++- hw/pci-bridge/gen_pcie_root_port.c | 3 + hw/pci-bridge/pci_expander_bridge.c | 17 ++- hw/pci-bridge/pcie_root_port.c | 15 +++ hw/pci-bridge/xio3130_downstream.c | 6 + hw/pci-bridge/xio3130_upstream.c | 19 +++ hw/pci/meson.build | 2 +- hw/pci/pci.c | 7 ++ hw/pci/pcie.c | 105 ++++++++++++++++- hw/pci/pcie_dev3.c | 111 ++++++++++++++++++ hw/pci/pcie_svc.c | 185 ++++++++++++++++++++++++++++++ include/hw/cxl/cxl_component.h | 2 +- include/hw/cxl/cxl_device.h | 2 + include/hw/pci-bridge/cxl_upstream_port.h | 2 +- include/hw/pci/pci_bridge.h | 1 + include/hw/pci/pcie.h | 11 ++ include/hw/pci/pcie_dev3.h | 26 +++++ include/hw/pci/pcie_port.h | 6 +- include/hw/pci/pcie_regs.h | 100 ++++++++++++++++ include/hw/pci/pcie_svc.h | 20 ++++ 25 files changed, 832 insertions(+), 34 deletions(-)
Signature · 1 line
2.34.1