[libvirt] [v10 3/6] change qemu driver to use hostdev common library

Jim Fehlig jfehlig at suse.com
Mon Jan 20 23:52:59 UTC 2014


Chunyan Liu wrote:
> Change qemu driver to use hostdev common library instead of APIs in
> qemu_hostdev.[ch] Improve some test files.
>   

[...]

> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index d39cdc4..29d4371 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -50,7 +50,6 @@
>  #include "qemu_capabilities.h"
>  #include "qemu_command.h"
>  #include "qemu_cgroup.h"
> -#include "qemu_hostdev.h"
>  #include "qemu_hotplug.h"
>  #include "qemu_monitor.h"
>  #include "qemu_bridge_filter.h"
> @@ -94,11 +93,10 @@
>  #include "virstring.h"
>  #include "viraccessapicheck.h"
>  #include "viraccessapicheckqemu.h"
> +#include "virhostdev.h"
>  
>  #define VIR_FROM_THIS VIR_FROM_QEMU
>  
> -#define QEMU_DRIVER_NAME "QEMU"
> -
>  #define QEMU_NB_MEM_PARAM  3
>  
>  #define QEMU_NB_BLOCK_IO_TUNE_PARAM  6
> @@ -698,18 +696,6 @@ qemuStateInitialize(bool privileged,
>      if (qemuSecurityInit(qemu_driver) < 0)
>          goto error;
>  
> -    if ((qemu_driver->activePciHostdevs = virPCIDeviceListNew()) == NULL)
> -        goto error;
> -
> -    if ((qemu_driver->activeUsbHostdevs = virUSBDeviceListNew()) == NULL)
> -        goto error;
> -
> -    if ((qemu_driver->inactivePciHostdevs = virPCIDeviceListNew()) == NULL)
> -        goto error;
> -
> -    if ((qemu_driver->activeScsiHostdevs = virSCSIDeviceListNew()) == NULL)
> -        goto error;
> -
>      if (!(qemu_driver->sharedDevices = virHashCreate(30, qemuSharedDeviceEntryFree)))
>          goto error;
>  
> @@ -989,10 +975,6 @@ qemuStateCleanup(void) {
>  
>      virNWFilterUnRegisterCallbackDriver(&qemuCallbackDriver);
>      virObjectUnref(qemu_driver->config);
> -    virObjectUnref(qemu_driver->activePciHostdevs);
> -    virObjectUnref(qemu_driver->inactivePciHostdevs);
> -    virObjectUnref(qemu_driver->activeUsbHostdevs);
> -    virObjectUnref(qemu_driver->activeScsiHostdevs);
>      virHashFree(qemu_driver->sharedDevices);
>      virObjectUnref(qemu_driver->caps);
>      virQEMUCapsCacheFree(qemu_driver->qemuCapsCache);
> @@ -10785,12 +10767,12 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev,
>                            const char *driverName,
>                            unsigned int flags)
>  {
> -    virQEMUDriverPtr driver = dev->conn->privateData;
>      virPCIDevicePtr pci = NULL;
>      unsigned domain = 0, bus = 0, slot = 0, function = 0;
>      int ret = -1;
>      virNodeDeviceDefPtr def = NULL;
>      char *xml = NULL;
> +    virHostdevManagerPtr hostdev_mgr;
>  
>      virCheckFlags(0, -1);
>  
> @@ -10814,9 +10796,9 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev,
>  
>      if (!driverName) {
>          /* prefer vfio */
> -        if (qemuHostdevHostSupportsPassthroughVFIO())
> +        if (virHostdevHostSupportsPassthroughVFIO())
>              driverName = "vfio";
> -        else if (qemuHostdevHostSupportsPassthroughLegacy())
> +        else if (virHostdevHostSupportsPassthroughKVM())
>              driverName = "kvm";
>      }
>  
>   

This needs rebased after df802272.  And as mentioned in 1/6, we should
use the existing SupportsPassthroughLegacy name.

But in general, I think this series is in good shape.  I had a chance to
test the series on a machine with dual-port Broadcom BCM5709, which does
not have FLR.  I didn't notice any change in behavior after applying
this series.

It would be nice to get this merged early in the release cycle, meaning
soon.  Do any other libvirt maintainers have comments that Chunyan could
address in a V11?  I'd give an updated version a soft ACK, since I've
only recently become familiar with this code :-).

Regards,
Jim




More information about the libvir-list mailing list