This RFC adds a Thunderbolt-flavoured PCIe hotplug layer for QEMU.
The main goal is hotplug and hot-unplug of real and virtual devices in
guests where direct hotplug for those devices is not supported or not
usable. macOS is the main validation target for this path: the guest can
observe endpoints through a guest-visible Thunderbolt layer even when direct
PCIe hotplug for the same endpoint is not usable.
In v2, the series is split so the modelling part is explicit:
* patch 1 adds the Thunderbolt root port and thunderbolt-bus. This is the
core Thunderbolt PCIe model: endpoint devices remain normal QEMU PCI
devices, while the root port controls guest-visible link presence and PCIe
hotplug signalling.
* patch 2 adds the Thunderbolt PCIe-to-PCI bridge for tunnelled PCI
endpoints.
* patch 3 adds a separate thunderbolt-vga endpoint for display hotplug tests.
The regular QEMU VGA device remains untouched and non-hotpluggable.
* patch 4 adds qtest coverage.
* patch 5 adds documentation and MAINTAINERS coverage.
I added myself as reviewer for the Thunderbolt PCIe files. The files still
match the existing PCI area through their paths, so PCI maintainership is
inherited by normal get_maintainer.pl matching.
Runtime validation performed so far:
* macOS guest booted from QCOW2 overlays over immutable base disk images.
* Thunderbolt VGA hotplug/removal while the standard boot VGA remains.
* NVMe hotplug/removal with guest driver instance checks.
* USB controller hotplug, USB storage mount/write/eject, controller removal,
replug, and data persistence verification.
Build/test validation:
* ninja -C build qemu-system-x86_64 tests/qtest/display-vga-test
* meson test -C build qtest-x86_64/display-vga-test --print-errorlogs
* scripts/checkpatch.pl --no-tree --no-signoff on the full diff:
0 errors, with one expected warning for MIT inheritance in thunderbolt-vga.c.
Changes since v1:
* Split the single large patch into five patches.
* Clarified that the modelling piece is the Thunderbolt root port/bus.
* Added a MAINTAINERS entry with Dmitry R as reviewer.
Dmitry R (5):
hw/pci-bridge: add Thunderbolt root port
hw/pci-bridge: add Thunderbolt PCIe-to-PCI bridge
hw/display: add Thunderbolt VGA endpoint
tests/qtest: cover Thunderbolt VGA hotplug
docs: document Thunderbolt PCIe hotplug layer
MAINTAINERS | 7 +
README.md | 91 ++++
docs/specs/index.rst | 1 +
docs/specs/thunderbolt-pcie-hotplug.rst | 99 ++++
hw/display/meson.build | 1 +
hw/display/thunderbolt-vga.c | 275 ++++++++++
hw/pci-bridge/meson.build | 2 +
hw/pci-bridge/thunderbolt_pcie_pci_bridge.c | 156 ++++++
hw/pci-bridge/thunderbolt_root_port.c | 565 ++++++++++++++++++++
tests/qtest/display-vga-test.c | 68 +++
10 files changed, 1265 insertions(+)
create mode 100644 README.md
create mode 100644 docs/specs/thunderbolt-pcie-hotplug.rst
create mode 100644 hw/display/thunderbolt-vga.c
create mode 100644 hw/pci-bridge/thunderbolt_pcie_pci_bridge.c
create mode 100644 hw/pci-bridge/thunderbolt_root_port.c
--
2.47.3