[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 3/8] Reset unmanaged PCI host devices before hotplug



On Mon, Aug 17, 2009 at 03:10:16PM +0100, Mark McLoughlin wrote:
> Right now we're only resetting managed devices before hotplug, but we
> should reset them irrespective of whether they are managed.
> 
> * src/qemu_driver.c: reset all PCI hostdevs before hotplug
> ---
>  src/qemu_driver.c |   27 +++++++++++++--------------
>  1 files changed, 13 insertions(+), 14 deletions(-)
> 
> diff --git a/src/qemu_driver.c b/src/qemu_driver.c
> index a638c10..06bbf2a 100644
> --- a/src/qemu_driver.c
> +++ b/src/qemu_driver.c
> @@ -5310,30 +5310,29 @@ static int qemudDomainAttachHostPciDevice(virConnectPtr conn,
>      virDomainHostdevDefPtr hostdev = dev->data.hostdev;
>      char *cmd, *reply;
>      unsigned domain, bus, slot;
> +    pciDevice *pci;
>  
>      if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs+1) < 0) {
>          virReportOOMError(conn);
>          return -1;
>      }
>  
> -    if (hostdev->managed) {
> -        pciDevice *pci = pciGetDevice(conn,
> -                                      hostdev->source.subsys.u.pci.domain,
> -                                      hostdev->source.subsys.u.pci.bus,
> -                                      hostdev->source.subsys.u.pci.slot,
> -                                      hostdev->source.subsys.u.pci.function);
> -        if (!dev)
> -            return -1;
> -
> -        if (pciDettachDevice(conn, pci) < 0 ||
> -            pciResetDevice(conn, pci) < 0) {
> -            pciFreeDevice(conn, pci);
> -            return -1;
> -        }
> +    pci = pciGetDevice(conn,
> +                       hostdev->source.subsys.u.pci.domain,
> +                       hostdev->source.subsys.u.pci.bus,
> +                       hostdev->source.subsys.u.pci.slot,
> +                       hostdev->source.subsys.u.pci.function);
> +    if (!dev)
> +        return -1;
>  
> +    if ((hostdev->managed && pciDettachDevice(conn, pci) < 0) ||
> +        pciResetDevice(conn, pci) < 0) {
>          pciFreeDevice(conn, pci);
> +        return -1;
>      }
>  
> +    pciFreeDevice(conn, pci);
> +
>      if (virAsprintf(&cmd, "pci_add auto host host=%.2x:%.2x.%.1x",
>                      hostdev->source.subsys.u.pci.bus,
>                      hostdev->source.subsys.u.pci.slot,


ACk


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]