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

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



At 09/02/2011 09:18 AM, Marc-André Lureau Write:
> Changes sinces v1:
> - apply only to piix3
> - check if piix3 controller is on correct address, or report error

I add usb controller:
    <controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x3'/>
    </controller>
The address 0x01.0x3 is used by piix3-usb-uhci. Your patch does not
detect this 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;

You must check the function. The slot 1 is reserved by qemu, we should only allow
the user to use function 1 for usb controller.

Thanks
Wen Congyang

>          }
>      }
>  
>      /* 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;
>  



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