[libvirt] [v3 10/14] qemu: don't reserve slot 1 if a PIIX3 USB controller is defined there

Daniel Veillard veillard at redhat.com
Fri Sep 2 14:39:55 UTC 2011


On Fri, Sep 02, 2011 at 03:18:20AM +0200, Marc-André Lureau wrote:
> Changes sinces v1:
> - apply only to piix3
> - check if piix3 controller is on correct address, or report error
> ---
>  src/qemu/qemu_command.c |   10 +++++++++-
>  1 files changed, 9 insertions(+), 1 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 2b8f548..3b1b4e5 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -1089,6 +1089,7 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs)
>  {
>      int i;
>      bool reservedIDE = false;
> +    bool reservedUSB = false;
>      bool reservedVGA = false;
>  
>      /* Host bridge */
> @@ -1119,13 +1120,20 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs)
>                  def->controllers[i]->info.addr.pci.slot = 1;
>                  def->controllers[i]->info.addr.pci.function = 1;
>              }
> +        } else if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
> +                   def->controllers[i]->idx == 0 &&
> +                   def->controllers[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
> +                   def->controllers[i]->info.addr.pci.domain == 0 &&
> +                   def->controllers[i]->info.addr.pci.bus == 0 &&
> +                   def->controllers[i]->info.addr.pci.slot == 1) {
> +            reservedUSB = true;
>          }
>      }
>  
>      /* PIIX3 (ISA bridge, IDE controller, something else unknown, USB controller)
>       * hardcoded slot=1, multifunction device
>       */
> -    if (!reservedIDE &&
> +    if (!reservedIDE && !reservedUSB &&
>          qemuDomainPCIAddressReserveSlot(addrs, 1) < 0)
>          goto error;

  I had to change this a bit since the context for the patch was
  modfified, it's now

    for (function = 0; function < QEMU_PCI_ADDRESS_LAST_FUNCTION; function++) {
        if (function == 1 && (reservedIDE || reservedUSB))
            /* we have reserved this pci address */
            continue;

        if (qemuDomainPCIAddressReserveFunction(addrs, 1, function) < 0)
            goto error;
    }

please double check :-)
I will let you address Wen comments separately !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list