Bug 820869

Summary: Fix automatic PCI address assignment for USB2 companion controllers
Product: Red Hat Enterprise Linux 6 Reporter: Daniel Berrangé <berrange>
Component: libvirtAssignee: Daniel Berrangé <berrange>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.4CC: acathrow, ajia, cfergeau, dallan, dyasny, dyuan, hdegoede, iheim, mzhan, oourfali, rwu, weizhan
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.9.10-20.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 822160 (view as bug list) Environment:
Last Closed: 2012-06-20 06:58:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 803458, 822160    

Description Daniel Berrangé 2012-05-11 09:05:59 UTC
Description of problem:
When creating a USB2 controller, there are actually 4 devices. The primary ehci controller and 3 companion uhci controllers. The PCI address assignment code is not aware of the special requirement that these 4 devices should be configured to use just 1 slot with multi-function turned on.

Version-Release number of selected component (if applicable):
libvirt-0.9.10-16.el6

How reproducible:
Always

Steps to Reproduce:
1. Add the following XML to a guest

    <controller type='usb' index='0' model='ich9-ehci1'/>
    <controller type='usb' index='0' model='ich9-uhci1'/>
    <controller type='usb' index='0' model='ich9-uhci2'/>
    <controller type='usb' index='0' model='ich9-uhci3'/>

Actual results:
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
    </controller>

Expected results:
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x2'/>
    </controller>


Additional info:

Comment 3 Daniel Berrangé 2012-05-14 10:22:36 UTC
First cut of patch:

https://www.redhat.com/archives/libvir-list/2012-May/msg00722.html

Comment 6 Daniel Berrangé 2012-05-15 16:21:12 UTC
Fix comprises the following 3 upstream commits.

commit 03b804a200e214e3faf264b16f41a640c1344962
Author: Daniel P. Berrange <berrange>
Date:   Mon May 14 13:22:58 2012 +0100

    Set a sensible default master start port for ehci companion controllers
    
commit 1ebd52cb871f87b7868503b28448e96d59e41d63
Author: Daniel P. Berrange <berrange>
Date:   Mon May 14 11:16:22 2012 +0100

    Fix logic for assigning PCI addresses to USB2 companion controllers

commit 2c195fdbf3293792e39bc4f06755ae751025b0ea
Author: Daniel P. Berrange <berrange>
Date:   Tue May 15 16:16:49 2012 +0100

    Fix virDomainDeviceInfoIsSet() to check all struct fields

Comment 10 weizhang 2012-05-17 15:52:13 UTC
verify pass on 
qemu-kvm-0.12.1.2-2.292.el6.x86_64
kernel-2.6.32-270.el6.x86_64
libvirt-0.9.10-20.el6.x86_64


After start guest with 4 usb controller like
    <controller type='usb' index='0' model='ich9-ehci1'/>
    <controller type='usb' index='0' model='ich9-uhci1'/>
    <controller type='usb' index='0' model='ich9-uhci2'/>
    <controller type='usb' index='0' model='ich9-uhci3'/>

dumpxml will show
    <controller type='usb' index='0' model='ich9-ehci1'>
      <alias name='usb0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <alias name='usb0'/>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <alias name='usb0'/>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <alias name='usb0'/>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x2'/>

Comment 11 Alex Jia 2012-05-18 02:31:29 UTC
(In reply to comment #10)
> verify pass on 
> qemu-kvm-0.12.1.2-2.292.el6.x86_64
> kernel-2.6.32-270.el6.x86_64
> libvirt-0.9.10-20.el6.x86_64
> 
> 
> After start guest with 4 usb controller like
>     <controller type='usb' index='0' model='ich9-ehci1'/>
>     <controller type='usb' index='0' model='ich9-uhci1'/>
>     <controller type='usb' index='0' model='ich9-uhci2'/>
>     <controller type='usb' index='0' model='ich9-uhci3'/>
> 
> dumpxml will show
Incomplete, it had better to log in guest then check whether these 4 controllers  use just 1 slot by lspci.

Comment 14 errata-xmlrpc 2012-06-20 06:58:18 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2012-0748.html