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

Re: [libvirt] [PATCH] Set a sensible default master start port for ehci companion controllers



Did some more digging on that.
The id is constructed in the function qemuUsbId:
static void
qemuUsbId(virBufferPtr buf, int idx)
{
    if (idx == 0)
        virBufferAsprintf(buf, "usb");
    else
        virBufferAsprintf(buf, "usb%d", idx);
}

So, as you can see it is either usb, or usbX...
However, according to https://bugzilla.redhat.com/show_bug.cgi?id=820869, all controllers should contain the same index, resulting in an ID duplication (as, IIUC, the idx which is passed is the controller index).

I don't know the importance of the ID to qemu-kvm, but perhaps it should be a concatenation of both the qemu name and the index, i.e.,
ich9-usb-ehci1-0 instead of usb, ich9-usb-ehci1-1 instead of usb1 and etc.

What do you think?

----- Original Message -----
> From: "Oved Ourfalli" <ovedo redhat com>
> To: "Daniel P. Berrange" <berrange redhat com>
> Cc: libvir-list redhat com
> Sent: Tuesday, May 15, 2012 8:41:32 AM
> Subject: Re: [libvirt] [PATCH] Set a sensible default master start port for	ehci companion controllers
> 
> Hey,
> 
> I built libvirt RPM with this fix (and the previous addresses fix),
> and I get the following error when running a VM with USB support:
> internal error Process exited while reading console log output:
> qemu-kvm: -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x4.0x7:
> Duplicate ID 'usb' for device
> 
> This error happened also without these fixes (I thought these patches
> will address that, so I waited, but looks like the problem might not
> be related to it).
> 
> Did you encounter such a problem when you tested it?
> 
> The relevant devices I pass are:
>       <controller index="0" model="ich9-ehci1" type="usb"/>
>       <controller index="0" model="ich9-uhci1" type="usb">
>               <master startport="0"/>
>       </controller>
>       <controller index="0" model="ich9-uhci2" type="usb">
>               <master startport="2"/>
>       </controller>
>       <controller index="0" model="ich9-uhci3" type="usb">
>               <master startport="4"/>
>       </controller>
>       <redirdev bus="usb" type="spicevmc"/>
>       <redirdev bus="usb" type="spicevmc"/>
> 
> Thank you,
> Oved
> ----- Original Message -----
> > From: "Daniel P. Berrange" <berrange redhat com>
> > To: libvir-list redhat com
> > Cc: "Oved Ourfalli" <ovedo redhat com>, "Hans de Goede"
> > <hdegoede redhat com>, "Daniel P. Berrange"
> > <berrange redhat com>
> > Sent: Monday, May 14, 2012 3:24:40 PM
> > Subject: [PATCH] Set a sensible default master start port for ehci
> > companion controllers
> > 
> > From: "Daniel P. Berrange" <berrange redhat com>
> > 
> > The uhci1, uhci2, uhci3 companion controllers for ehci1 must
> > have a master start port set. Since this value is predictable
> > we should set it automatically if the app does not supply it
> > ---
> >  src/conf/domain_conf.c                             |   22
> >  ++++++++++++++++++
> >  .../qemuxml2argv-usb-ich9-ehci-addr.xml            |   24
> >  +++++---------------
> >  2 files changed, 28 insertions(+), 18 deletions(-)
> > 
> > diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> > index 54ac1db..f4775be 100644
> > --- a/src/conf/domain_conf.c
> > +++ b/src/conf/domain_conf.c
> > @@ -4066,6 +4066,28 @@ virDomainControllerDefParseXML(xmlNodePtr
> > node,
> >          VIR_FREE(vectors);
> >          break;
> >      }
> > +    case VIR_DOMAIN_CONTROLLER_TYPE_USB: {
> > +        /* If the XML has a uhci1, uhci2, uhci3 controller and no
> > +         * master port was given, we should set a sensible one */
> > +        int masterPort = -1;
> > +        switch (def->model) {
> > +        case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI1:
> > +            masterPort = 0;
> > +            break;
> > +        case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI2:
> > +            masterPort = 2;
> > +            break;
> > +        case VIR_DOMAIN_CONTROLLER_MODEL_USB_ICH9_UHCI3:
> > +            masterPort = 4;
> > +            break;
> > +        }
> > +        if (masterPort != -1 &&
> > +            def->info.mastertype ==
> > VIR_DOMAIN_CONTROLLER_MASTER_NONE) {
> > +            def->info.mastertype =
> > VIR_DOMAIN_CONTROLLER_MASTER_USB;
> > +            def->info.master.usb.startport = masterPort;
> > +        }
> > +        break;
> > +    }
> >  
> >      default:
> >          break;
> > diff --git
> > a/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-ehci-addr.xml
> > b/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-ehci-addr.xml
> > index 8eff1d7..ad85d63 100644
> > --- a/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-ehci-addr.xml
> > +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-ehci-addr.xml
> > @@ -19,19 +19,13 @@
> >      <controller type='usb' index='1' model='ich9-ehci1'>
> >      </controller>
> >  
> > -    <controller type='usb' index='0' model='ich9-uhci1'>
> > -      <master startport='0'/>
> > -    </controller>
> > -    <controller type='usb' index='1' model='ich9-uhci1'>
> > -      <master startport='0'/>
> > -    </controller>
> > +    <controller type='usb' index='0' model='ich9-uhci1'/>
> > +    <controller type='usb' index='1' model='ich9-uhci1'/>
> >      <controller type='usb' index='2' model='ich9-uhci1'>
> >        <master startport='0'/>
> >      </controller>
> >  
> > -    <controller type='usb' index='0' model='ich9-uhci3'>
> > -      <master startport='4'/>
> > -    </controller>
> > +    <controller type='usb' index='0' model='ich9-uhci3'/>
> >      <controller type='usb' index='1' model='ich9-uhci3'>
> >        <master startport='4'/>
> >      </controller>
> > @@ -39,15 +33,9 @@
> >        <master startport='4'/>
> >      </controller>
> >  
> > -    <controller type='usb' index='2' model='ich9-uhci2'>
> > -      <master startport='2'/>
> > -    </controller>
> > -    <controller type='usb' index='1' model='ich9-uhci2'>
> > -      <master startport='2'/>
> > -    </controller>
> > -    <controller type='usb' index='0' model='ich9-uhci2'>
> > -      <master startport='2'/>
> > -    </controller>
> > +    <controller type='usb' index='2' model='ich9-uhci2'/>
> > +    <controller type='usb' index='1' model='ich9-uhci2'/>
> > +    <controller type='usb' index='0' model='ich9-uhci2'/>
> >      <memballoon model='virtio'/>
> >    </devices>
> >  </domain>
> > --
> > 1.7.10.1
> > 
> > 
> 
> --
> libvir-list mailing list
> libvir-list redhat com
> https://www.redhat.com/mailman/listinfo/libvir-list
> 


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