On a Monday in 2020, Laine Stump wrote:
If a pcie-root-port or pcie-downstream-port has hotplug='off' in its
<target> subelement, and if the qemu binary supports the hotplug=false
option, then it will be added to the commandline for the pcie
controller. This controller will then not allow any hotplug/unplug of
devices while the guest is running (and the hotplug capability won't
be advertised to the guest OS, so the guest OS also won't present
unplugging of PCI devices as an option).

 <controller type='pci' model='pcie-root-port'>
   <target hotplug='off'/>
 </controller>

For any PCI controllers other than pcie-downstream-port and
pcie-root-port, of for qemu binaries that don't support the hotplug
commandline option, an error will be logged during validation.

Signed-off-by: Laine Stump <la...@redhat.com>
---
src/qemu/qemu_command.c                       |  4 ++
src/qemu/qemu_validate.c                      | 31 +++++++++++++++
.../pcie-root-port-nohotplug.args             | 39 +++++++++++++++++++
tests/qemuxml2argvtest.c                      |  7 ++++
4 files changed, 81 insertions(+)
create mode 100644 tests/qemuxml2argvdata/pcie-root-port-nohotplug.args

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index df90f5edf5..f619ef32be 100644
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index fdeb3c2e65..9a10528251 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2436,6 +2436,13 @@ mymain(void)
    DO_TEST("pcie-root-port-model-ioh3420",
            QEMU_CAPS_DEVICE_IOH3420);

+    DO_TEST("pcie-root-port-nohotplug",
+            QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
+            QEMU_CAPS_DEVICE_IOH3420,
+            QEMU_CAPS_DEVICE_X3130_UPSTREAM,
+            QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM,
+            QEMU_CAPS_PCIE_ROOT_PORT_HOTPLUG);
+

Can you use DO_TEST_CAPS_LATEST instead to verify this works with a real-world
capability set?

Jano

    DO_TEST("autoindex",
            QEMU_CAPS_DEVICE_PCI_BRIDGE,
            QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
--
2.25.2

Attachment: signature.asc
Description: PGP signature

Reply via email to