[libvirt] [PATCH v3 00/13] PCI Multifunction device hotplug support

Shivaprasad G Bhat shivaprasadbhat at gmail.com
Mon May 23 20:55:01 UTC 2016

V2 was posted here.

Changes from V2:
-Squashed the original patch 1 with the patch which actually enables
multifunction hotplug as suggested.
-As suggested, introduced the virDomainDeviceDefParseMany for
-Retained the patch which validates the function address before releasing. I
feel this should be retained as originally checks used to happen for slots.
-Changed the assign address logic to simply decrementally assign function
numbers to the devices in the list. The CONNECT_TYPE flags are yet to be
-Split the original patch 8 into multiple simpler patches for easier reading.
The original motivation was to help introduce test cases for multifunction
hotplug which is not possible for functions static in qemu_driver.c. So,
moved the functions to qemu_domain.c and qemu_hotplug.c. Hopefully, the
movements helps adding good number of test cases.

V1 was posted here.


Changes from V1
Fixed couple of issues in address validation and assignment.
Added Rollback of the hotplug if anything fails in between.
Removed Patch 6 completely as it exposed way too many bugs. Changed the approach
a bit by introducing 2 new patches which take care of hostdevice preparation
and help reverting.

1)  Hardening the hotplug checks to disallow multifunction cards
    hotplug as though they are single function cards.
2)  Documentation update.
3)  Test cases. This is easier now with the helper functions moved out of
4)  Should the events be delayed till all the functions are
    hotplugged/unplugged? Something can fail and the revert may not be possible
    Or the guest may refuse to free the device. If we show events
    for those which got free, the rest of them may never be freed and also
    that may not be usable by guest if the function 0 is not part of it. Need to
    think more on this. Any suggestions ?


Shivaprasad G Bhat (13):
      Release address in function granularity than slot
      Validate address in virDomainPCIAddressReleaseAddr
      Introduce PCI Multifunction device parser
      Introduce virDomainPCIMultifunctionDeviceAddressAssign
      Separate the hostdevice preparation and checks to a new funtion
      Move the qemu[*]DomainDeviceConfig to qemu_domain.c
      Move qemuDomain[*]Live functions to qemu_hotplug.c
      Introduce qemuDomain*DeviceLiveInternal
      Introduce qemuDomain*DeviceConfigInternal
      Move the virDomainDefCompatibleDevice checks a level down
      Move the detach of PCI device to the beginnging of live hotplug
      Pass virDomainDeviceDefListPtr to hotplug functions
      Enable PCI Multifunction hotplug/unplug

 src/conf/domain_addr.c         |  153 ++++++-
 src/conf/domain_addr.h         |    4 
 src/conf/domain_conf.c         |  123 +++++-
 src/conf/domain_conf.h         |   19 +
 src/libvirt_private.syms       |    5 
 src/qemu/qemu_domain.c         |  460 +++++++++++++++++++++
 src/qemu/qemu_domain.h         |   17 +
 src/qemu/qemu_domain_address.c |    2 
 src/qemu/qemu_driver.c         |  882 ++++++----------------------------------
 src/qemu/qemu_hotplug.c        |  625 ++++++++++++++++++++++++----
 src/qemu/qemu_hotplug.h        |   24 +
 11 files changed, 1421 insertions(+), 893 deletions(-)


More information about the libvir-list mailing list