Files
cyborg/pci-sim
Chandan Kumar (raukadah) c523612230 pci-sim: Add CentOS Stream 10 support
CentOS Stream 10 ships kernel 6.12 but backports IOMMU and VFIO
API changes from upstream 6.15+. The existing compat header gates
on LINUX_VERSION_CODE alone, which selects the wrong (old) API on
CentOS because the kernel reports 6.12 while the actual signatures
are 6.15-style. This prevents the module from compiling on
RHEL-family kernels.

The compat header now defines a single PCI_SIM_HAS_615_API
predicate that checks LINUX_VERSION_CODE >= 6.15 or
RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(10, 3), and all five
feature macros alias it. Adding future distro gates is a one-line
edit.

The QEMU test scripts hardcoded qemu-system-x86_64, which does
not exist on CentOS/RHEL where the binary is
/usr/libexec/qemu-kvm. All five QEMU-related scripts now
auto-detect the binary via a QEMU_BIN environment variable with
PATH-based fallback.

The DevStack build_pci_sim() function used raw apt-get calls.
It now uses devstack's is_ubuntu/is_fedora helpers with
install_package for distro-aware package selection.

Build and test documentation is updated with CentOS/Fedora
install commands and CentOS Stream 10 as a compatibility target.

A cyborg-tempest-centos-10-stream Zuul CI job is added
to the weekly-periodic and experimental pipeline to
validate pci-sim on CentOS Stream 10.

Assisted-By: Claude Code (claude-opus-4-6)
Change-Id: I7ecae754465510be9efc55667bb5ed1d5f9a5f68
Signed-off-by: Chandan Kumar (raukadah) <chkumar@redhat.com>
2026-07-09 12:33:32 +01:00
..
2026-07-09 12:33:32 +01:00

Fake PCI SR-IOV VFIO test fixture

fake_pci_sriov.ko is a self-contained module for testing SR-IOV control-plane flows without physical SR-IOV hardware. It creates fake PCI host bridges with physical functions and software-created virtual functions. The VFs can be bound to VFIO and assigned to QEMU guests.

For the standalone repository build from the repository root with:

make

or from this directory with:

make -C /lib/modules/$(uname -r)/build M=$PWD modules

The built module is fake_pci_sriov.ko.

Local helpers

The helper scripts are intentionally kept next to the out-of-tree module so relative paths work in standalone development checkouts and DevStack jobs.

cleanup_fake_pci_sriov.sh

Best-effort cleanup for fake VFs, fake PFs, driver overrides, and the loaded module. DevStack and smoke tests use this to make repeated runs deterministic.

test_pci_sim_loopback.py

Host-side loopback test. It loads the module, enables VFs, waits for /dev/ttyPCI_SIM<N>, and checks that bytes written to each TTY are read back from the same TTY.

run_fake_pci_multi_pf_smoke.sh

Host-side multi-PF smoke test. It verifies multiple fake PFs, expected class codes, VF creation, and cleanup.

run_fake_pci_qemu_vfio_smoke.sh

Bounded QEMU/VFIO smoke test. It verifies that a fake VF can bind to pci_sim_vfio_pci and that QEMU can start with the VF assigned.

run_cirros_vfio_guest_probe.sh

CirrOS guest probe test. It logs in over the serial console and runs guest-side PCI and TTY discovery commands.

run_cirros_vfio_userdata_echo.sh

CirrOS config-drive end-to-end test. Guest user-data probes the VF and verifies the emulated UART loopback path inside the guest.

cirros_vfio_userdata_echo.sh

Guest-side user-data script copied into the config-drive generated by run_cirros_vfio_userdata_echo.sh.

Common test targets are available from this directory after building the module:

make test-loopback
make test-multi-pf