Thunderbolt PCIe hotplug layer
cover Thunderbolt PCIe hotplug layer
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.
The series intentionally keeps regular QEMU PCI endpoint devices intact. Devices behind the new layer remain normal QEMU PCI devices; the Thunderbolt root port controls guest-visible link presence, publishes ACPI properties, and emits PCIe hotplug notifications.
The patch adds:
* thunderbolt-root-port, creating a thunderbolt-bus secondary bus.
* thunderbolt-pcie-pci-bridge for tunnelled PCI endpoints.
* thunderbolt-vga, a separate stdvga-compatible hotpluggable endpoint.
* README/specs documentation with VGA, USB storage, and NVMe examples.
* qtest coverage for the Thunderbolt VGA hotplug path.
The regular QEMU VGA device is not changed and remains non-hotpluggable. The Thunderbolt display path uses the separate thunderbolt-vga device type.
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 expected warnings for MIT inheritance in thunderbolt-vga.c and possible MAINTAINERS coverage.
Open questions:
* Whether this should be split into smaller review patches after the overall Thunderbolt modelling direction is accepted.
* Which MAINTAINERS entry should own the Thunderbolt PCIe layer.
* Whether the guest-visible properties are sufficient for non-macOS guests that may also benefit from Thunderbolt-style tunnelling.
Dmitry R (1):
hw/pci-bridge: add Thunderbolt PCIe hotplug layer
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 +++ 9 files changed, 1258 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
Signature · 1 line
2.47.3
RFC PATCH 1/1 hw/pci-bridge: add Thunderbolt PCIe hotplug layer
Add a Thunderbolt-flavoured PCIe root port and bus for guest-visible PCIe tunnelling experiments. Devices behind the new bus remain normal QEMU PCI devices; the Thunderbolt root port controls link presence through a connected QOM property and emits the usual PCIe hotplug notifications.
Add a Thunderbolt PCIe-to-PCI bridge for tunnelled PCI endpoints and a separate thunderbolt-vga device type for stdvga-compatible display hotplug tests. The regular VGA device implementation is not touched and remains non-hotpluggable.
Add qtest coverage for the Thunderbolt VGA hotplug path and documentation with HMP examples for VGA, USB storage, and NVMe hotplug.
thunderbolt-vga.c keeps the MIT license because it is derived from the existing stdvga implementation in hw/display/vga-pci.c, which carries the same license.
--- 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 +++ 9 files changed, 1258 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
README.md new file +91 -0
@@ -0,0 +1,91 @@ +SPDX-License-Identifier: GPL-2.0-or-later + +# QEMU Thunderbolt PCIe hotplug layer + +This branch adds a Thunderbolt-flavoured PCIe hotplug layer for QEMU +experiments. The implementation keeps normal QEMU PCI devices intact and +adds a new Thunderbolt bus/root-port layer around them. + +The primary goal is to provide hotplug and hot-unplug for real and virtual +devices in guests that do not support those devices being added or removed +directly. macOS is the main validation target for this path: devices can be +tunnelled through a guest-visible Thunderbolt layer even when direct PCIe +hotplug for the same endpoint is not usable. + +The regular QEMU `VGA` device is not changed and is not made hotpluggable. +Thunderbolt display experiments use a separate `thunderbolt-vga` device type. + +## Added device types + +- `thunderbolt-root-port`: a PCIe root port that creates a `thunderbolt-bus`. + Its `connected` QOM property controls guest-visible link presence. +- `thunderbolt-pcie-pci-bridge`: a PCIe-to-PCI bridge for tunnelled PCI + endpoints with Thunderbolt-related ACPI properties. +- `thunderbolt-vga`: a hotpluggable stdvga-compatible endpoint with constrained + default EDID settings for guest hotplug tests. + +## Basic boot example + +Start the guest with its normal boot display and an empty Thunderbolt root +port: + +```sh +qemu-system-x86_64 \ + -machine q35 \ + -device VGA,id=bootvga,bus=pcie.0,addr=0x06,vgamem_mb=4,xres=1280,yres=800,xmax=1280,ymax=800,refresh_rate=60000 \ + -device thunderbolt-root-port,id=tbrp0,bus=pcie.0,chassis=1,slot=1,addr=0x05 \ + ... +``` + +Hotplug and remove a Thunderbolt VGA endpoint through the QEMU monitor: + +```text +(qemu) device_add thunderbolt-vga,id=tbvga0,bus=tbrp0,addr=0x00 +(qemu) device_del tbvga0 +``` + +Disconnect or reconnect the whole Thunderbolt root port: + +```text +(qemu) qom-set /machine/peripheral/tbrp0 connected false +(qemu) qom-set /machine/peripheral/tbrp0 connected true +``` + +## USB storage example + +Attach a USB controller behind the Thunderbolt root port, then attach USB mass +storage to that controller: + +```text +(qemu) device_add qemu-xhci,id=tbxhci0,bus=tbrp0,addr=0x00 +(qemu) drive_add 0 if=none,id=TBUSB,file=TBUSB.raw,format=raw,cache=writeback,aio=threads +(qemu) device_add usb-storage,id=tbusb0,bus=tbxhci0.0,drive=TBUSB,serial=tb-usb-stick0 +``` + +After the guest ejects or unmounts the disk, remove the device and controller: + +```text +(qemu) device_del tbusb0 +(qemu) device_del tbxhci0 +``` + +## NVMe example + +```text +(qemu) drive_add 0 if=none,id=TBNVME,file=TBNVME.qcow2,format=qcow2 +(qemu) device_add nvme,id=tbnvme0,bus=tbrp0,addr=0x00,serial=tb-nvme0,drive=TBNVME +(qemu) device_del tbnvme0 +``` + +## Validation status + +The development validation used macOS guests booted from overlay disk images so +the base images stayed immutable. The tested hotplug flows covered: + +- `thunderbolt-vga` detection and removal while the standard boot VGA remained. +- NVMe controller hotplug and driver instance disappearance after unplug. +- USB controller hotplug, USB storage mount/write/eject, controller removal, + replug, and data persistence verification. + +The qtest coverage checks that regular `VGA` hotplug still fails while +`thunderbolt-vga` can be hotplugged behind `thunderbolt-root-port`.
docs/specs/index.rst +1 -0
@@ -31,6 +31,7 @@ guest hardware that is specific to QEMU. pvpanic spdm standard-vga + thunderbolt-pcie-hotplug virt-ctlr vmcoreinfo vmgenid
docs/specs/thunderbolt-pcie-hotplug.rst new file +99 -0
99 lines not on this page · raw message
hw/display/meson.build +1 -0
@@ -19,6 +19,7 @@ system_ss.add(when: 'CONFIG_SSD0323', if_true: files('ssd0323.c')) system_ss.add(when: 'CONFIG_XEN_BUS', if_true: files('xenfb.c')) system_ss.add(when: 'CONFIG_VGA_PCI', if_true: files('vga-pci.c')) +system_ss.add(when: 'CONFIG_VGA_PCI', if_true: files('thunderbolt-vga.c')) system_ss.add(when: 'CONFIG_VGA_ISA', if_true: files('vga-isa.c')) system_ss.add(when: 'CONFIG_VGA_MMIO', if_true: files('vga-mmio.c')) system_ss.add(when: 'CONFIG_VMWARE_VGA', if_true: files('vmware_vga.c'))
hw/display/thunderbolt-vga.c new file +275 -0
275 lines not on this page · raw message
hw/pci-bridge/meson.build +2 -0
@@ -3,7 +3,9 @@ pci_ss.add(when: 'CONFIG_PCI_BRIDGE', if_true: files('pci_bridge_dev.c')) pci_ss.add(when: 'CONFIG_I82801B11', if_true: files('i82801b11.c')) pci_ss.add(when: 'CONFIG_IOH3420', if_true: files('ioh3420.c')) pci_ss.add(when: 'CONFIG_PCIE_PORT', if_true: files('pcie_root_port.c', 'gen_pcie_root_port.c')) +pci_ss.add(when: 'CONFIG_PCIE_PORT', if_true: files('thunderbolt_root_port.c')) pci_ss.add(when: 'CONFIG_PCIE_PCI_BRIDGE', if_true: files('pcie_pci_bridge.c')) +pci_ss.add(when: 'CONFIG_PCIE_PCI_BRIDGE', if_true: files('thunderbolt_pcie_pci_bridge.c')) pci_ss.add(when: 'CONFIG_PXB', if_true: files('pci_expander_bridge.c'), if_false: files('pci_expander_bridge_stubs.c')) pci_ss.add(when: 'CONFIG_XIO3130', if_true: files('xio3130_upstream.c', 'xio3130_downstream.c'))
hw/pci-bridge/thunderbolt_pcie_pci_bridge.c new file +156 -0
156 lines not on this page · raw message
hw/pci-bridge/thunderbolt_root_port.c new file +565 -0
565 lines not on this page · raw message
tests/qtest/display-vga-test.c +68 -0
91 lines not on this page · raw message
Signature · 1 line
2.47.3
Quoted 7 lines · Dmitry R
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.
Very happy to see this.
Quoted 32 lines
The series intentionally keeps regular QEMU PCI endpoint devices intact. Devices behind the new layer remain normal QEMU PCI devices; the Thunderbolt root port controls guest-visible link presence, publishes ACPI properties, and emits PCIe hotplug notifications.
The patch adds:
* thunderbolt-root-port, creating a thunderbolt-bus secondary bus.
* thunderbolt-pcie-pci-bridge for tunnelled PCI endpoints.
* thunderbolt-vga, a separate stdvga-compatible hotpluggable endpoint.
* README/specs documentation with VGA, USB storage, and NVMe examples.
* qtest coverage for the Thunderbolt VGA hotplug path.The regular QEMU VGA device is not changed and remains non-hotpluggable. The Thunderbolt display path uses the separate thunderbolt-vga device type.
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 expected warnings for MIT inheritance inthunderbolt-vga.cand possibleMAINTAINERScoverage.
Quoted 4 lines
Open questions:
* Whether this should be split into smaller review patches after the overall Thunderbolt modelling direction is accepted.
I'd prefer a split up version, as it is, I'm not ever sure which part of the patch does modeling refer to.
Quoted 1 line
* Which
MAINTAINERSentry should own the Thunderbolt PCIe layer.
Are you going to be available long term for review? if yes you can add an entry with yourself as reviewer, and it will inherit maintainer from pci-bridge
Quoted 24 lines
* Whether the guest-visible properties are sufficient for non-macOS guests that may also benefit from Thunderbolt-style tunnelling.
Dmitry R (1):
hw/pci-bridge: add Thunderbolt PCIe hotplug layerREADME.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 +++ 9 files changed, 1258 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.cSignature · 1 line
2.47.3
v2 cover Thunderbolt PCIe hotplug layer
In reply to Dmitry RThis 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
Signature · 1 line
2.47.3
RFC PATCH v2 1/5 hw/pci-bridge: add Thunderbolt root port
Add thunderbolt-root-port and its secondary thunderbolt-bus type. This is the core Thunderbolt PCIe modelling piece. Devices behind the root port remain normal QEMU PCI devices, while the root port controls guest-visible link presence and hotplug signalling.
The connected QOM property allows the whole Thunderbolt port to be disconnected or reconnected without changing endpoint device implementations.
--- hw/pci-bridge/meson.build | 1 + hw/pci-bridge/thunderbolt_root_port.c | 565 ++++++++++++++++++++++++++ 2 files changed, 566 insertions(+) create mode 100644 hw/pci-bridge/thunderbolt_root_port.c
hw/pci-bridge/meson.build +1 -0
@@ -3,6 +3,7 @@ pci_ss.add(when: 'CONFIG_PCI_BRIDGE', if_true: files('pci_bridge_dev.c')) pci_ss.add(when: 'CONFIG_I82801B11', if_true: files('i82801b11.c')) pci_ss.add(when: 'CONFIG_IOH3420', if_true: files('ioh3420.c')) pci_ss.add(when: 'CONFIG_PCIE_PORT', if_true: files('pcie_root_port.c', 'gen_pcie_root_port.c')) +pci_ss.add(when: 'CONFIG_PCIE_PORT', if_true: files('thunderbolt_root_port.c')) pci_ss.add(when: 'CONFIG_PCIE_PCI_BRIDGE', if_true: files('pcie_pci_bridge.c')) pci_ss.add(when: 'CONFIG_PXB', if_true: files('pci_expander_bridge.c'), if_false: files('pci_expander_bridge_stubs.c'))
hw/pci-bridge/thunderbolt_root_port.c new file +565 -0
565 lines not on this page · raw message
Signature · 1 line
2.47.3
RFC PATCH v2 2/5 hw/pci-bridge: add Thunderbolt PCIe-to-PCI bridge
In reply to Dmitry RAdd thunderbolt-pcie-pci-bridge for PCI endpoints tunnelled through the Thunderbolt PCIe layer. The bridge exposes Thunderbolt-related ACPI properties while leaving downstream PCI devices as regular QEMU devices.
--- hw/pci-bridge/meson.build | 1 + hw/pci-bridge/thunderbolt_pcie_pci_bridge.c | 156 ++++++++++++++++++++ 2 files changed, 157 insertions(+) create mode 100644 hw/pci-bridge/thunderbolt_pcie_pci_bridge.c
hw/pci-bridge/meson.build +1 -0
@@ -5,6 +5,7 @@ pci_ss.add(when: 'CONFIG_IOH3420', if_true: files('ioh3420.c')) pci_ss.add(when: 'CONFIG_PCIE_PORT', if_true: files('pcie_root_port.c', 'gen_pcie_root_port.c')) pci_ss.add(when: 'CONFIG_PCIE_PORT', if_true: files('thunderbolt_root_port.c')) pci_ss.add(when: 'CONFIG_PCIE_PCI_BRIDGE', if_true: files('pcie_pci_bridge.c')) +pci_ss.add(when: 'CONFIG_PCIE_PCI_BRIDGE', if_true: files('thunderbolt_pcie_pci_bridge.c')) pci_ss.add(when: 'CONFIG_PXB', if_true: files('pci_expander_bridge.c'), if_false: files('pci_expander_bridge_stubs.c')) pci_ss.add(when: 'CONFIG_XIO3130', if_true: files('xio3130_upstream.c', 'xio3130_downstream.c'))
hw/pci-bridge/thunderbolt_pcie_pci_bridge.c new file +156 -0
156 lines not on this page · raw message
Signature · 1 line
2.47.3
RFC PATCH v2 3/5 hw/display: add Thunderbolt VGA endpoint
In reply to Dmitry RAdd thunderbolt-vga as a separate stdvga-compatible hotpluggable endpoint for Thunderbolt display hotplug tests.
The regular QEMU VGA device is intentionally left untouched and remains non-hotpluggable. thunderbolt-vga.c keeps the MIT license because it is derived from the existing stdvga implementation in hw/display/vga-pci.c, which carries the same license.
--- hw/display/meson.build | 1 + hw/display/thunderbolt-vga.c | 275 +++++++++++++++++++++++++++++++++++ 2 files changed, 276 insertions(+) create mode 100644 hw/display/thunderbolt-vga.c
hw/display/meson.build +1 -0
@@ -19,6 +19,7 @@ system_ss.add(when: 'CONFIG_SSD0323', if_true: files('ssd0323.c')) system_ss.add(when: 'CONFIG_XEN_BUS', if_true: files('xenfb.c')) system_ss.add(when: 'CONFIG_VGA_PCI', if_true: files('vga-pci.c')) +system_ss.add(when: 'CONFIG_VGA_PCI', if_true: files('thunderbolt-vga.c')) system_ss.add(when: 'CONFIG_VGA_ISA', if_true: files('vga-isa.c')) system_ss.add(when: 'CONFIG_VGA_MMIO', if_true: files('vga-mmio.c')) system_ss.add(when: 'CONFIG_VMWARE_VGA', if_true: files('vmware_vga.c'))
hw/display/thunderbolt-vga.c new file +275 -0
275 lines not on this page · raw message
Signature · 1 line
2.47.3
RFC PATCH v2 4/5 tests/qtest: cover Thunderbolt VGA hotplug
In reply to Dmitry RAdd a qtest that starts a q35 machine with thunderbolt-root-port and verifies that regular VGA remains non-hotpluggable while thunderbolt-vga can be hotplugged behind the Thunderbolt root port.
The test also checks the constrained thunderbolt-vga display defaults used by the macOS validation flow.
--- tests/qtest/display-vga-test.c | 68 ++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+)
tests/qtest/display-vga-test.c +68 -0
@@ -9,6 +9,21 @@#include "qemu/osdep.h" #include "libqtest.h" +#include "qobject/qdict.h" + +static void assert_qom_uint (QTestState *qts,const char *path, +const char *property,uint64_t expected) +{ +QDict *rsp; + + rsp =qtest_qmp (qts,"{ 'execute': 'qom-get', 'arguments': {" +"'path': %s," +"'property': %s" +"} }" , path, property); +g_assert (qdict_haskey (rsp,"return" )); + g_assert_cmpuint(qdict_get_uint(rsp, "return"), ==, expected); +qobject_unref (rsp); +}static void pci_multihead (void ) {
@@ -18,6 +33,51 @@ static void pci_multihead(void)qtest_quit (qts); } +static void thunderbolt_vga_hotplug (void ) +{ +QTestState *qts; +QDict *rsp; +QDict *err; + + qts =qtest_init ("-machine q35 -display none -nodefaults -vga none " +"-device VGA,id=bootvga,bus=pcie.0,addr=0x02 " +"-device thunderbolt-root-port,id=tbrp0,bus=pcie.0," +"chassis=1,slot=1,addr=0x05" ); + + rsp =qtest_qmp (qts,"{ 'execute': 'device_add', " +"'arguments': {" +"'driver': 'VGA'," +"'id': 'badstd'," +"'bus': 'tbrp0'," +"'addr': '0x01'" +"} }" ); +g_assert (qdict_haskey (rsp,"error" )); + err =qdict_get_qdict (rsp,"error" ); + g_assert_cmpstr(qdict_get_str(err, "desc"), ==, +"Device 'VGA' does not support hotplugging" ); +qobject_unref (rsp); + + rsp =qtest_qmp (qts,"{ 'execute': 'device_add', " +"'arguments': {" +"'driver': 'thunderbolt-vga'," +"'id': 'tbvga0'," +"'bus': 'tbrp0'," +"'addr': '0x00'" +"} }" ); +g_assert (qdict_haskey (rsp,"return" )); +g_assert (!qdict_haskey (rsp,"error" )); +qobject_unref (rsp); + +assert_qom_uint (qts,"/machine/peripheral/tbvga0" ,"vgamem_mb" ,4 ); +assert_qom_uint (qts,"/machine/peripheral/tbvga0" ,"xres" ,1280 ); +assert_qom_uint (qts,"/machine/peripheral/tbvga0" ,"yres" ,800 ); +assert_qom_uint (qts,"/machine/peripheral/tbvga0" ,"xmax" ,1280 ); +assert_qom_uint (qts,"/machine/peripheral/tbvga0" ,"ymax" ,800 ); +assert_qom_uint (qts,"/machine/peripheral/tbvga0" ,"refresh_rate" ,60000 ); + +qtest_quit (qts); +} +static void test_vga (gconstpointer data) {QTestState *qts;
@@ -31,6 +91,7 @@ int main(int argc, char **argv)static const char *devices[] = {"cirrus-vga" ,"VGA" , +"thunderbolt-vga" ,"secondary-vga" ,"virtio-gpu-pci" ,"virtio-vga"
@@ -50,5 +111,12 @@ int main(int argc, char **argv)qtest_add_func ("/display/pci/multihead" , pci_multihead); } +if (qtest_has_machine ("q35" ) && +qtest_has_device ("thunderbolt-root-port" ) && +qtest_has_device ("thunderbolt-vga" )) { +qtest_add_func ("/display/pci/thunderbolt-vga-hotplug" , + thunderbolt_vga_hotplug); + } +return g_test_run (); }
Signature · 1 line
2.47.3
RFC PATCH v2 5/5 docs: document Thunderbolt PCIe hotplug layer
In reply to Dmitry RAdd documentation and usage examples for the Thunderbolt PCIe hotplug layer, including VGA, USB storage, and NVMe hotplug flows.
Add a MAINTAINERS entry for the Thunderbolt PCIe files with Dmitry R as reviewer, while keeping the files under the existing PCI area through their paths.
--- MAINTAINERS | 7 ++ README.md | 91 +++++++++++++++++++++++ docs/specs/index.rst | 1 + docs/specs/thunderbolt-pcie-hotplug.rst | 99 +++++++++++++++++++++++++ 4 files changed, 198 insertions(+) create mode 100644 README.md create mode 100644 docs/specs/thunderbolt-pcie-hotplug.rst
MAINTAINERS +7 -0
@@ -2223,6 +2223,13 @@ F: docs/pci* F: docs/specs/*pci* F: docs/system/sriov.rst +Thunderbolt PCIe +R: Dmitry R <[email protected]> +S: Maintained +F: docs/specs/thunderbolt-pcie-hotplug.rst +F: hw/display/thunderbolt-vga.c +F: hw/pci-bridge/thunderbolt*.c + ARM PCI Hotplug M: Gustavo Romero <[email protected]> L: [email protected]
README.md new file +91 -0
91 lines not on this page · raw message
docs/specs/index.rst +1 -0
@@ -31,6 +31,7 @@ guest hardware that is specific to QEMU. pvpanic spdm standard-vga + thunderbolt-pcie-hotplug virt-ctlr vmcoreinfo vmgenid
docs/specs/thunderbolt-pcie-hotplug.rst new file +99 -0
99 lines not on this page · raw message
Signature · 1 line
2.47.3