conf: introduce option to enable/disable pci hotplug on pci-root controller

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/kvm accelerator only.This feature was
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@anisinha.ca>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
Ani Sinha
2021-10-01 14:59:46 +05:30
committed by Laine Stump
parent fdec09b00a
commit 8eadf82fb5
7 changed files with 83 additions and 6 deletions

View File

@@ -3776,11 +3776,15 @@ generated by libvirt. :since:`Since 1.2.19 (QEMU only).`
controller's "port" configuration value, which is visible to the virtual
machine. If set, port must be between 0 and 255.
``hotplug``
pcie-root-port and pcie-switch-downstream-port controllers can also have a
``hotplug`` attribute in the ``<target>`` subelement, which is used to
disable hotplug/unplug of devices on a particular controller. The default
setting of ``hotplug`` is ``on``; it should be set to ``off`` to disable
hotplug/unplug of devices on a particular controller. :since:`Since 6.3.0`
pci-root (:since:`Since 7.9.0`), pcie-root-port (:since:`Since 6.3.0`) and
pcie-switch-downstream-port controllers (:since:`Since 6.3.0`) can
also have a ``hotplug`` attribute in the ``<target>`` subelement, which is
used to disable hotplug/unplug of devices on a particular controller. For
the pci-root controller, the setting affects the ACPI based hotplug. For the
rest, the setting affects both ACPI based hotplug as well as PCIE native
hotplug. The default setting of ``hotplug`` is ``on``; it should be set to
``off`` to disable hotplug/unplug of devices on a particular controller.
``busNr``
pci-expander-bus and pcie-expander-bus controllers can have an optional
``busNr`` attribute (1-254). This will be the bus number of the new bus; All