Hi All,
I have revisited/rewritten my previously posted patches. Here is
the RFC. Since this patchset is a complete rewrite, I am starting
with v1 here.
The semantics is as discussed before
https://www.redhat.com/archives/libvir-list/2016-April/msg01057.html
As I went on to refactor the code to support multifunction virtio devices,
I realised the abort/cleanup path would be a nightmare there, in case of
failures. So, dropped that attempt. The current RFC limits to the real
practical use cases of Multifunction PCI hostdevices. All new test code
to support multifunction PCI hostdevices and test cases are added to
prove the functionality.
So, to summarise
=============
Patch 1 - is a bug fix
Patch 2-6 - Adds all PCI/VFIO/Multifunction/multiple devices per IOMMU group
support to our mock test environment.
Patches till here, are kind of basic and independent but necessary for the
remaining patches.
=============
Patch 7-14 - Detect and auto-address PCI multifunction devices.
=============
Patch 15-25 - Refactor/Prepare for hotplug/unplug
Patch 26-28 - Finally implement Hotplug/Unplug
Thanks,
Shivaprasad
---
Shivaprasad G Bhat (28):
Fix the iommu group path in mock pci
util: move the hostdev passthrough support functions to utility
tests: pci: Mock the iommu groups and vfio
virpcitest: Change the stub driver to vfio from pci-stub
virpcimock: Mock the SRIOV Virtual functions
tests: qemu: Add test case for pci-hostdev hotplug
tests: Add a baseline test for multifunction pci device use case
util: virpci: detect if the device is a multifunction device from sysfs
tests: qemu: mock pci environment for qemuargv2xmltests
virhostdev: Introduce virHostdevPCIDevicesBelongToSameSlot
qemu: address: Separate the slots into multiple aggregates
qemu: address: Enable auto addressing multifunction cards
util: make virHostdevIsVirtualFunction() public
conf: qemu: validate multifunction hostdevice domain configs
conf: Add helper to get active functions of a slot of domain
qemu: hostdev: Move the hostdev preparation to a separate function
qemu: hotplug: Move the detach of PCI device to the beginnging of live hotplug
qemu: hotplug: move assignment outside qemuDomainAttachHostPCIDevice
Introduce virDomainDeviceDefParseXMLMany
Introduce qemuDomainDeviceParseXMLMany
qemu: refactor qemuDomain[Attach|Detach]DeviceConfig
qemu: refactor qemuDomain[Attach|Detach]DeviceLive
qemu: hotplug: Queue and wait for multiple devices
domain: addr: Introduce virDomainPCIAddressEnsureMultifunctionAddress
qemu: hotplug: Implement multifunction device hotplug
qemu: hotplug : Prevent updates to mulitfunction device
qemu: hotplug: Move out the Single function check
qemu: hotplug: Implement multifunction device unplug
src/conf/device_conf.h | 7
src/conf/domain_addr.c | 127 ++++++-
src/conf/domain_addr.h | 41 +-
src/conf/domain_conf.c | 194 +++++++++-
src/conf/domain_conf.h | 39 ++
src/libvirt_private.syms | 14 +
src/node_device/node_device_udev.c | 2
src/qemu/qemu_capabilities.c | 5
src/qemu/qemu_domain.c | 72 ++++
src/qemu/qemu_domain.h | 19 +
src/qemu/qemu_domain_address.c | 375 ++++++++++++++++++-
src/qemu/qemu_domain_address.h | 15 +
src/qemu/qemu_driver.c | 197 +++++++---
src/qemu/qemu_hostdev.c | 70 ----
src/qemu/qemu_hostdev.h | 3
src/qemu/qemu_hotplug.c | 389 ++++++++++++++++----
src/qemu/qemu_hotplug.h | 14 +
src/util/virhostdev.c | 96 +++++
src/util/virhostdev.h | 11 +
src/util/virpci.c | 22 +
src/util/virpci.h | 8
src/util/virprocess.h | 2
tests/Makefile.am | 7
tests/qemuargv2xmldata/hostdev-pci-address.args | 2
tests/qemuargv2xmldata/hostdev-pci-address.xml | 2
tests/qemuargv2xmltest.c | 18 +
tests/qemuhotplugtest.c | 98 ++++-
.../qemuhotplug-hostdev-pci.xml | 6
.../qemuhotplug-multifunction-hostdev-pci-2.xml | 14 +
.../qemuhotplug-multifunction-hostdev-pci.xml | 20 +
.../qemuhotplug-base-live+hostdev-pci.xml | 60 +++
...hotplug-base-live+multifunction-hostdev-pci.xml | 76 ++++
.../qemuhotplug-pseries-base-live+hostdev-pci.xml | 53 +++
...eries-base-live+multifunction-hostdev-pci-2.xml | 61 +++
...pseries-base-live+multifunction-hostdev-pci.xml | 69 ++++
.../qemuhotplug-pseries-base-live.xml | 45 ++
.../hostdev-pci-address-device.args | 2
.../hostdev-pci-address-device.xml | 2
tests/qemuxml2argvdata/hostdev-pci-address.args | 2
tests/qemuxml2argvdata/hostdev-pci-address.xml | 2
.../hostdev-pci-multifunction.args | 31 ++
.../qemuxml2argvdata/hostdev-pci-multifunction.xml | 59 +++
.../hostdev-pci-no-primary-function.xml | 23 +
tests/qemuxml2argvdata/hostdev-pci-validate.args | 25 +
tests/qemuxml2argvdata/hostdev-pci-validate.xml | 29 +
.../qemuxml2argvdata/hostdev-vfio-multidomain.args | 2
.../qemuxml2argvdata/hostdev-vfio-multidomain.xml | 2
tests/qemuxml2argvdata/hostdev-vfio.args | 2
tests/qemuxml2argvdata/hostdev-vfio.xml | 2
tests/qemuxml2argvdata/net-hostdev-fail.xml | 2
.../qemuxml2argvdata/net-hostdev-multidomain.args | 2
tests/qemuxml2argvdata/net-hostdev-multidomain.xml | 2
tests/qemuxml2argvdata/net-hostdev-vfio.args | 2
tests/qemuxml2argvdata/net-hostdev-vfio.xml | 2
tests/qemuxml2argvdata/net-hostdev.args | 2
tests/qemuxml2argvdata/net-hostdev.xml | 2
tests/qemuxml2argvdata/pci-rom.args | 4
tests/qemuxml2argvdata/pci-rom.xml | 4
tests/qemuxml2argvdata/pseries-hostdevs-1.args | 5
tests/qemuxml2argvdata/pseries-hostdevs-3.args | 5
tests/qemuxml2argvtest.c | 17 +
tests/qemuxml2xmloutdata/hostdev-pci-address.xml | 2
.../hostdev-pci-multifunction.xml | 79 ++++
tests/qemuxml2xmloutdata/hostdev-vfio.xml | 2
tests/qemuxml2xmloutdata/net-hostdev-vfio.xml | 2
tests/qemuxml2xmloutdata/net-hostdev.xml | 2
tests/qemuxml2xmloutdata/pci-rom.xml | 4
tests/qemuxml2xmloutdata/pseries-hostdevs-1.xml | 4
tests/qemuxml2xmloutdata/pseries-hostdevs-3.xml | 4
tests/qemuxml2xmltest.c | 1
tests/virhostdevtest.c | 39 --
tests/virpcimock.c | 199 +++++++++-
tests/virpcitest.c | 12 -
tests/virpcitestdata/0000-06-12.0.config | Bin
tests/virpcitestdata/0000-06-12.1.config | Bin
tests/virpcitestdata/0000-06-12.2.config | Bin
tests/virpcitestdata/0005-90-01.1.config | Bin
tests/virpcitestdata/0005-90-01.2.config | Bin
tests/virpcitestdata/0005-90-01.3.config | Bin
tests/virprocessmock.c | 28 +
80 files changed, 2463 insertions(+), 400 deletions(-)
create mode 100644 tests/qemuhotplugtestdevices/qemuhotplug-hostdev-pci.xml
create mode 100644
tests/qemuhotplugtestdevices/qemuhotplug-multifunction-hostdev-pci-2.xml
create mode 100644
tests/qemuhotplugtestdevices/qemuhotplug-multifunction-hostdev-pci.xml
create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-base-live+hostdev-pci.xml
create mode 100644
tests/qemuhotplugtestdomains/qemuhotplug-base-live+multifunction-hostdev-pci.xml
create mode 100644
tests/qemuhotplugtestdomains/qemuhotplug-pseries-base-live+hostdev-pci.xml
create mode 100644
tests/qemuhotplugtestdomains/qemuhotplug-pseries-base-live+multifunction-hostdev-pci-2.xml
create mode 100644
tests/qemuhotplugtestdomains/qemuhotplug-pseries-base-live+multifunction-hostdev-pci.xml
create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-pseries-base-live.xml
create mode 100644 tests/qemuxml2argvdata/hostdev-pci-multifunction.args
create mode 100644 tests/qemuxml2argvdata/hostdev-pci-multifunction.xml
create mode 100644 tests/qemuxml2argvdata/hostdev-pci-no-primary-function.xml
create mode 100644 tests/qemuxml2argvdata/hostdev-pci-validate.args
create mode 100644 tests/qemuxml2argvdata/hostdev-pci-validate.xml
create mode 100644 tests/qemuxml2xmloutdata/hostdev-pci-multifunction.xml
create mode 100644 tests/virpcitestdata/0000-06-12.0.config
create mode 100644 tests/virpcitestdata/0000-06-12.1.config
create mode 100644 tests/virpcitestdata/0000-06-12.2.config
create mode 100644 tests/virpcitestdata/0005-90-01.3.config
create mode 100644 tests/virprocessmock.c
--
Signature