[PATCH v5 2/4] conf: introduce option to enable/disable pci hotplug on pci-root controller

Ján Tomko jtomko at redhat.com
Mon Sep 27 08:05:58 UTC 2021


On a Monday in 2021, Ani Sinha wrote:
>This change introduces libvirt xml support to enable/disable hotplug on the
>pci-root controller. It adds a 'target' subelement for the pci-root controller
>with a 'hotplug' property. This property can be used to enable or disable
>hotplug for the pci-root controller. For example, in order to disable hotplug
>on the pci-root controller, one has to use set '<target hotplug='off'>' as
>shown below:
>
><controller type='pci' model='pci-root'>
>  <target hotplug='off'/>
></controller>
>
>'<target hotplug='on'>' option would enable hotplug for pci-root controller.
>This is also the default value. This option is only available for pc machine
>types and is applicable for qemu only/kvm accelerator onlt.This feature was

s/onlt./only. /

>introduced from qemu version 5.2 with the following change in qemu repository:
>
>3d7e78aa7777f ("Introduce a new flag for i440fx to disable PCI hotplug on the root bus")
>
>The above qemu commit describes some reasons why users might to disable hotplug
>on PCI root buses.
>
>Related unit tests to exercise the new conf option has also been added.
>
>Signed-off-by: Ani Sinha <ani at anisinha.ca>
>---
> docs/formatdomain.rst                         | 12 ++++----
> src/qemu/qemu_validate.c                      |  9 +++++-
> .../pc-i440fx-acpi-root-hotplug-disable.xml   | 30 +++++++++++++++++++
> .../pc-i440fx-acpi-root-hotplug-enable.xml    | 30 +++++++++++++++++++
> .../pc-i440fx-acpi-root-hotplug-disable.xml   |  1 +
> .../pc-i440fx-acpi-root-hotplug-enable.xml    |  1 +
> tests/qemuxml2xmltest.c                       |  4 +++
> 7 files changed, 81 insertions(+), 6 deletions(-)
> create mode 100644 tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-disable.xml
> create mode 100644 tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-enable.xml
> create mode 120000 tests/qemuxml2xmloutdata/pc-i440fx-acpi-root-hotplug-disable.xml
> create mode 120000 tests/qemuxml2xmloutdata/pc-i440fx-acpi-root-hotplug-enable.xml
>
>@@ -3879,6 +3879,14 @@ qemuValidateDomainDeviceDefControllerPCI(const virDomainControllerDef *cont,
>     /* hotplug */
>     if (pciopts->hotplug != VIR_TRISTATE_SWITCH_ABSENT) {
>         switch ((virDomainControllerModelPCI) cont->model) {
>+        case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
>+            if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX_ACPI_ROOT_PCI_HOTPLUG)) {
>+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
>+                               _("setting the %s property on a pci-root device is not supported by this QEMU binary"),
>+                               "hotplug");

No need to create a new translatable string, the one used by the case
below can be reused:

                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                _("setting the hotplug property on a '%s' device is not supported by this QEMU binary"),
                                "pci-root");

Jano

>+                return -1;
>+            }
>+            break;
>         case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
>         case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT:
>             if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCIE_ROOT_PORT_HOTPLUG)) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210927/b521bebb/attachment-0001.sig>


More information about the libvir-list mailing list