[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



Hi

----- Original Message -----
> 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

I see, we need to handle default mode too.
-                   def->controllers[i]->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI) {
+                   (def->controllers[i]->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI ||
+                    def->controllers[i]->model == -1)) {

Would that solve the problem?

> 
> > ---
> >  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.

Do you mean function 2? The v2/v3 check is:

            if (def->controllers[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
                if (def->controllers[i]->info.addr.pci.domain != 0 ||
                    def->controllers[i]->info.addr.pci.bus != 0 ||
                    def->controllers[i]->info.addr.pci.slot != 1 ||
                    def->controllers[i]->info.addr.pci.function != 2) {
                    qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                    _("PIIX3 USB controller must have PCI address 0:0:1.2"));
                    goto error;

Is that correct?

thanks,



-- 
Marc-André Lureau


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