Bug 877330 - Can not only use ich9-uhci1/2/3 model as usb controller model
Summary: Can not only use ich9-uhci1/2/3 model as usb controller model
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.0
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-11-16 09:33 UTC by weizhang
Modified: 2016-04-26 15:25 UTC (History)
11 users (show)

Fixed In Version: libvirt-1.2.17-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 05:36:10 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description weizhang 2012-11-16 09:33:10 UTC
Description of problem:
When I want to use a usb1.1 device only with model ich9-uhci1/2/3, it report error

virsh create test1.xml
error: Failed to create domain from test.xml
error: internal error process exited while connecting to monitor: qemu-kvm: -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,addr=0x2: Parameter 'masterbus' expects an USB masterbus
qemu-kvm: -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,addr=0x2: Device 'ich9-usb-uhci1' could not be initialized

Seems libvirt will automatically add masterbus for this model

If this model can only used with masterbus, then it should report error when edit/define xml.

Version-Release number of selected component (if applicable):
libvirt-0.10.2-8.el6.x86_64
qemu-kvm-0.12.1.2-2.323.el6.x86_64
kernel-2.6.32-329.el6.x86_64


How reproducible:
100%

Steps to Reproduce:
# cat test.xml
<domain type='kvm' id='20'>
  <name>test</name>
  <uuid>c631184e-3027-0edd-48be-8798c9c64682</uuid>
  <memory unit='KiB'>524288</memory>
  <currentMemory unit='KiB'>524288</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='x86_64' machine='rhel6.2.0'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/var/lib/libvirt/images/test.img'/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='ide' index='0'>
      <alias name='ide0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <alias name='usb0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </controller>
    <hub type='usb'>
       <address type='usb' bus='0' port='1'/>
    </hub>
    <memballoon model='none'>
      <alias name='balloon0'/>
    </memballoon>
  </devices>
</domain>

# virsh create test.xml

Actual result
report error
error: Failed to create domain from test.xml
error: internal error process exited while connecting to monitor: qemu-kvm: -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,addr=0x2: Parameter 'masterbus' expects an USB masterbus
qemu-kvm: -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,addr=0x2: Device 'ich9-usb-uhci1' could not be initialized

  
Actual results:
Report error

Expected results:
Succeed or report error when define/edit xml

Additional info:
with qemu-command line,
/usr/libexec/qemu-kvm -name test -M rhel6.2.0 -enable-kvm -m 512 -smp 1,sockets=1,cores=1,threads=1 -uuid c631184e-3027-0edd-48be-8798c9c64682 -nographic -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/test.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -device ich9-usb-uhci1,id=usb,bus=pci.0,addr=0xa -drive file=/var/lib/libvirt/images/kvm-rhel6u3-i386.img,if=none,id=drive-ide0-0-0,format=raw,cache=none -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -device usb-hub,id=hub0,bus=usb.0,port=1 -vnc 127.0.0.1:1 -k en-us -vga cirrus

guest can be started successfully without error

Comment 5 Jiri Denemark 2014-04-04 21:37:13 UTC
This bug was not selected to be addressed in Red Hat Enterprise Linux 6. We will look at it again within the Red Hat Enterprise Linux 7 product.

Comment 10 Michal Privoznik 2015-07-14 08:28:53 UTC
The patches that implement the feature are pushed for a while now:

commit 22c0d433ab848b9518f3d5015587beaec50290e1
Author:     Marc-André Lureau <marcandre.lureau@redhat.com>
AuthorDate: Fri Sep 2 21:28:27 2011 +0800
Commit:     Daniel Veillard <veillard@redhat.com>
CommitDate: Fri Sep 2 23:22:56 2011 +0800

    USB devices gain a new USB address child element
    
    Expand the domain and the QEmu driver code
    Adds a couple of tests

commit 33d11150b78eeaaaa10e2dc885de569221786617
Author:     Marc-André Lureau <marcandre.lureau@redhat.com>
AuthorDate: Fri Sep 2 21:26:55 2011 +0800
Commit:     Daniel Veillard <veillard@redhat.com>
CommitDate: Fri Sep 2 23:22:56 2011 +0800

    test: USB controller can have a PCI address child element
    
    add a few tests for the new constructs

commit d6d54cd19ebb24bfc75a2ab379864cf6002a33aa
Author:     Marc-André Lureau <marcandre.lureau@redhat.com>
AuthorDate: Fri Sep 2 21:21:23 2011 +0800
Commit:     Daniel Veillard <veillard@redhat.com>
CommitDate: Fri Sep 2 23:22:56 2011 +0800

    Add a new controller type 'usb' with optionnal 'model'
    
    The model by default is piix3-uchi.
    
    Example:
    <controller type='usb' index='0' model='ich9-ehci'/>

commit 2e4b5243b273f9c5904e17a37b38e7391592490b
Author:     Marc-André Lureau <marcandre.lureau@redhat.com>
AuthorDate: Fri Sep 2 21:14:29 2011 +0800
Commit:     Daniel Veillard <veillard@redhat.com>
CommitDate: Fri Sep 2 23:22:56 2011 +0800

    Add USB controller models
    
    List is: piix3-uhci piix4-uhci ehci ich9-ehci1 ich9-uhci1 ich9-uhci2
    ich9-uhci3 vt82c686b-uhci pci-ohci


And of course plenty of other commits that reworked the way we parse USB controllers.

Comment 12 Pei Zhang 2015-08-21 03:52:23 UTC
verify version :
libvirt-1.2.17-5.el7.x86_64
qemu-kvm-rhev-2.3.0-18.el7.x86_64

steps :
1.define or create a guest like following :
......
    <controller type='usb' index='0' model='ich9-uhci1'/> 

  <hub type='usb'>
       <address type='usb' bus='0' port='1'/>
    </hub>
......

# virsh define r70806.qcow2.xml 
error: Failed to define domain from r70806.qcow2.xml
error: No master USB controller specified


# virsh create r70806.qcow2.xml 
error: Failed to create domain from r70806.qcow2.xml
error: No master USB controller specified


Fail to define or start a guest with only ich9-uhci1 usb controller. 
It has a clear error message. 

Hi, Michal
I was wondering what the expected result is. Should it support only using one of ich9-uhci[1-3] usb controller, or these controllers must be used as companion controllers ,it will give clear error message if only use one of them.

Thanks a lot.

Comment 13 Michal Privoznik 2015-08-21 18:35:29 UTC
(In reply to Pei Zhang from comment #12)
> <snip/>
>
> Hi, Michal
> I was wondering what the expected result is. Should it support only using
> one of ich9-uhci[1-3] usb controller, or these controllers must be used as
> companion controllers ,it will give clear error message if only use one of
> them.

Yeah, there are a companion controllers. We are aiming on clear error message here.

> 
> Thanks a lot.

Comment 14 Pei Zhang 2015-09-01 04:05:59 UTC
Verified version:
libvirt-1.2.17-6.el7.x86_64
qemu-kvm-rhev-2.3.0-18.el7.x86_64

steps : 
1.only use one usb controller in domain xml:
<controller type='usb' index='0' model='ich9-uhci1'/>

# virsh define r72.xml 
error: Failed to define domain from r72.xml
error: No master USB controller specified

start a healthy guest , edit usb controller.
#virsh edit r72
<controller type='usb' index='0' model='ich9-uhci1'/>
......
try to save.
error: No master USB controller specified
Failed. Try again? [y,n,i,f,?]: 

Fail to define / create / edit.

2. use ich9-echi1 + ich9-uhci but using diff index .
#virsh edit r72
......
<controller type='usb' index='0' model='ich9-ehci1'/>
<controller type='usb' index='1' model='ich9-uhci1'/>
......

saved domain xml , then dumpxml to check.

# virsh dumpxml r72 | grep usb -A 3
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x7'/>
    </controller>
    <controller type='usb' index='1' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0' multifunction='on'/>
    </controller>

try to start it.
# virsh start r72
error: Failed to start domain r72
error: internal error: process exited while connecting to monitor: libust[21159/21159]: Warning: HOME environment variable not set. Disabling LTTng-UST per-user tracing. (in setup_local_apps() at lttng-ust-comm.c:305)
2015-09-01T02:09:19.740992Z qemu-kvm: -device ich9-usb-uhci1,masterbus=usb1.0,firstport=0,bus=pci.0,multifunction=on,addr=0xb: USB bus 'usb1.0' not found
2015-09-01T02:09:19.741030Z qemu-kvm: -device ich9-usb-uhci1,masterbus=usb1.0,firstport=0,bus=pci.0,multifunction=on,addr=0xb: Device 'ich9-usb-uhci1' could not be initialized


3.using piix4-uhci /piix4 + ich9-uhci1 with diff index.
<controller type='usb' index='0' model='piix3-uhci'/>
<controller type='usb' index='1' model='ich9-uhci3'/>

can define / edit ; fail to create / start , error as step2.

3.using ehci + ich9-uhci1 with diff index.
<controller type='usb' index='0' model='ehci'/>
<controller type='usb' index='1' model='ich9-uhci1'/>

can define / edit ; fail to create / start , error as step2.

4.using nec-xhci + ich9-uhci1 with diff index.
<controller type='usb' index='0' model='nec-xhci'/>
<controller type='usb' index='1' model='ich9-uhci1'/>

can define / edit ; fail to create / start , error as step2.

Hi, Michal

Now, the error message looks like these :
1.if I only use one usb controller of ich9-uhci[1-3] in domain xml , it always gives an error message : 

error: No master USB controller specified.

2.if I use other USB controllers together but the controller index is different.
It will be OK when define /edit. and will give error when I try to start guest:

2015-09-01T02:09:19.740992Z qemu-kvm: -device ich9-usb-uhci1,masterbus=usb1.0,firstport=0,bus=pci.0,multifunction=on,addr=0xb: USB bus 'usb1.0' not found
2015-09-01T02:09:19.741030Z qemu-kvm: -device ich9-usb-uhci1,masterbus=usb1.0,firstport=0,bus=pci.0,multifunction=on,addr=0xb: Device 'ich9-usb-uhci1' could not be initialized

I was wondering if this is an expected result.

Thanks a lot.
pzhang

Comment 15 Michal Privoznik 2015-09-01 15:24:51 UTC
(In reply to Pei Zhang from comment #14)
> Verified version:
> libvirt-1.2.17-6.el7.x86_64
> qemu-kvm-rhev-2.3.0-18.el7.x86_64
> 
> steps : 
> 1.only use one usb controller in domain xml:
> <controller type='usb' index='0' model='ich9-uhci1'/>
> 
> # virsh define r72.xml 
> error: Failed to define domain from r72.xml
> error: No master USB controller specified
> 
> start a healthy guest , edit usb controller.
> #virsh edit r72
> <controller type='usb' index='0' model='ich9-uhci1'/>
> ......
> try to save.
> error: No master USB controller specified
> Failed. Try again? [y,n,i,f,?]: 
> 
> Fail to define / create / edit.
> 
> 2. use ich9-echi1 + ich9-uhci but using diff index .
> #virsh edit r72
> ......
> <controller type='usb' index='0' model='ich9-ehci1'/>
> <controller type='usb' index='1' model='ich9-uhci1'/>
> ......
> 
> saved domain xml , then dumpxml to check.
> 
> # virsh dumpxml r72 | grep usb -A 3
>     <controller type='usb' index='0' model='ich9-ehci1'>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x0a'
> function='0x7'/>
>     </controller>
>     <controller type='usb' index='1' model='ich9-uhci1'>
>       <master startport='0'/>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x0b'
> function='0x0' multifunction='on'/>
>     </controller>
> 
> try to start it.
> # virsh start r72
> error: Failed to start domain r72
> error: internal error: process exited while connecting to monitor:
> libust[21159/21159]: Warning: HOME environment variable not set. Disabling
> LTTng-UST per-user tracing. (in setup_local_apps() at lttng-ust-comm.c:305)
> 2015-09-01T02:09:19.740992Z qemu-kvm: -device
> ich9-usb-uhci1,masterbus=usb1.0,firstport=0,bus=pci.0,multifunction=on,
> addr=0xb: USB bus 'usb1.0' not found
> 2015-09-01T02:09:19.741030Z qemu-kvm: -device
> ich9-usb-uhci1,masterbus=usb1.0,firstport=0,bus=pci.0,multifunction=on,
> addr=0xb: Device 'ich9-usb-uhci1' could not be initialized
> 
> 
> 3.using piix4-uhci /piix4 + ich9-uhci1 with diff index.
> <controller type='usb' index='0' model='piix3-uhci'/>
> <controller type='usb' index='1' model='ich9-uhci3'/>
> 
> can define / edit ; fail to create / start , error as step2.
> 
> 3.using ehci + ich9-uhci1 with diff index.
> <controller type='usb' index='0' model='ehci'/>
> <controller type='usb' index='1' model='ich9-uhci1'/>
> 
> can define / edit ; fail to create / start , error as step2.
> 
> 4.using nec-xhci + ich9-uhci1 with diff index.
> <controller type='usb' index='0' model='nec-xhci'/>
> <controller type='usb' index='1' model='ich9-uhci1'/>
> 
> can define / edit ; fail to create / start , error as step2.
> 
> Hi, Michal
> 
> Now, the error message looks like these :
> 1.if I only use one usb controller of ich9-uhci[1-3] in domain xml , it
> always gives an error message : 
> 
> error: No master USB controller specified.
> 
> 2.if I use other USB controllers together but the controller index is
> different.
> It will be OK when define /edit. and will give error when I try to start
> guest:
> 
> 2015-09-01T02:09:19.740992Z qemu-kvm: -device
> ich9-usb-uhci1,masterbus=usb1.0,firstport=0,bus=pci.0,multifunction=on,
> addr=0xb: USB bus 'usb1.0' not found
> 2015-09-01T02:09:19.741030Z qemu-kvm: -device
> ich9-usb-uhci1,masterbus=usb1.0,firstport=0,bus=pci.0,multifunction=on,
> addr=0xb: Device 'ich9-usb-uhci1' could not be initialized
> 
> I was wondering if this is an expected result.

I think it is, because in qemu ehci and uhci are companion controllers. Therefore you need to add an ehci1 controller with index=1 to be able to boot.

Michal

Comment 16 Pei Zhang 2015-09-02 06:54:41 UTC
Thanks for your info.
According to comment 12 and comment 14 ,
ich9-uhci[1-3] as a companion controllers cannot only use one of them. it has clear error message now.

move this bug to verified.

Comment 18 errata-xmlrpc 2015-11-19 05:36:10 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.

https://rhn.redhat.com/errata/RHBA-2015-2202.html


Note You need to log in before you can comment on or make changes to this bug.