Bug 1003983

Summary: q35 chipset support should mimic real hardware better
Product: Red Hat Enterprise Linux 7 Reporter: Gerd Hoffmann <kraxel>
Component: libvirtAssignee: Laine Stump <laine>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: acathrow, ajia, bili, chhu, dyuan, honzhang, jdenemar, juzhang, xuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.1.1-8.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 11:58:44 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:

Description Gerd Hoffmann 2013-09-03 16:09:59 UTC
Stuff I've ran into so far:

 * The pci bridge (dmi-to-pci-bridge) is at 00:1e.0.
   libvirt picks another slot when auto-adding the device while
   creating the machine.  It is possible to move it though.

 * The ehci+uhci controllers are in slot 00:1d (ehci1 + uhci1,2,3)
   and in 00:1a (ehci2 + uhci4,5,6).
   libvirt doesn't allow me to add the devices to bus 0.

 * The hda audio controller is at 00:1b.0.
   libvirt doesn't allow me to add the device to bus 0.
   qemu also provides a ich9-intel-hda device (identical to
   intel-hda except that it has ich9 pci ids).  Adding support
   for this device would be nice.

See also http://git.qemu.org/?p=qemu.git;a=blob;f=docs/q35-chipset.cfg;hb=HEAD

Comment 2 Laine Stump 2013-09-25 13:09:28 UTC
Patches to address the 3 issues you list above have been posted to libvir-list for review:

  https://www.redhat.com/archives/libvir-list/2013-September/msg01458.html

Comment 3 Laine Stump 2013-09-25 14:43:11 UTC
I just pushed the following 6 commits upstream:

commit fbd9be484c3b1891412e9409d0133a07bbc3fc2b
Date:   Tue Sep 24 06:49:26 2013 -0400

    qemu: eliminate redundant if clauses in qemuCollectPCIAddress

commit 07af519298996f4341f62542c31c1c01969eeceb
Date:   Tue Sep 24 09:16:25 2013 -0400

    qemu: allow some PCI devices to be attached to PCIe slots

commit 8e0dab3a8e2e4b0c580739587fa4a474c7a4afc8
Date:   Tue Sep 24 09:38:32 2013 -0400

    qemu: replace multiple strcmps with a switch on an enum

commit b83d26f6c434f80c71a2a7a0823b1ec16b798ca3
Date:   Tue Sep 24 10:17:38 2013 -0400

    qemu: support ich9-intel-hda audio device

commit c484fe16cb58174b9ea1c532eeea70be5893ca3c
Date:   Wed Sep 25 06:59:46 2013 -0400

    qemu: turn if into switch in qemuDomainValidateDevicePCISlotsQ35
    
commit 386ebb47a5d707829edf0dccf4d80056ca199e63
Date:   Wed Sep 25 08:02:19 2013 -0400

    qemu: prefer to put a Q35 machine's dmi-to-pci-bridge at 00:1E.0

Comment 6 EricLee 2013-10-09 08:29:41 UTC
Verifying this bug with libvirt-1.1.1-8.el7:

Steps:
For the first problem:
 * The pci bridge (dmi-to-pci-bridge) is at 00:1e.0.
   libvirt picks another slot when auto-adding the device while
   creating the machine.  It is possible to move it though.
 
1. Add 'dmi-to-pci-bridge' to a q35 guest, and do not specify the address for it:
 # virsh edit test
 "
    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
    </controller>
 "
 save.
 
 # virsh dumpxml test
 .....
     <controller type='pci' index='1' model='dmi-to-pci-bridge'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
    </controller>
 .....
 libvirt will add address: 00:1e.0 to it automatically.
 
2. Change the address for 'dmi-to-pci-bridge' to 00:02.0
 # virsh edit test
 "
    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </controller>
 "
 save.
 
 # virsh dumpxml test
 ....
    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </controller>
 ....
 it is not changed to 00:1e.0, and start guest will work.
 
For second problem:
 * The ehci+uhci controllers are in slot 00:1d (ehci1 + uhci1,2,3)
   and in 00:1a (ehci2 + uhci4,5,6).
   libvirt doesn't allow me to add the devices to bus 0.
   
1. Add 'ehci' + 'ich9-uhci1' to guest and do not add addresses to them:
 # virsh edit test
 "
    <controller type='usb' index='0' model='ehci'>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
    </controller>
 "
 save
 
 # virsh dumpxml test
 ....
    <controller type='usb' index='0' model='ehci'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0' multifunction='on'/>
    </controller>
 ....
 libvirt add addresses to them and attach to PCI automatically.

2. Modify addresses for 'ehci' and 'ich9-uhci1' :
 # virsh edit test
    <controller type='usb' index='0' model='ehci'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0' multifunction='on'/>
    </controller>
 save
 
 # virsh dumpxml test
 will see it works, libvirt support to specify the bus to 0, and can be started normally.
 
3. Repeat above steps for "ehci + ich9-uhci1, ich9-uhci2, ich9-uhci3, vt82c686b-uhci" and "ich9-ehci1 + ich9-uhci1, ich9-uhci2, ich9-uhci3, vt82c686b-uhci" all works well.
 
For the third problem:
 * The hda audio controller is at 00:1b.0.
   libvirt doesn't allow me to add the device to bus 0.
   qemu also provides a ich9-intel-hda device (identical to
   intel-hda except that it has ich9 pci ids).  Adding support
   for this device would be nice.
 
1. Add 'ich9-intel-hda' to guest:
 # virsh edit test
 "
     <sound model='ich9'>
    </sound>
 "
 save.
 
 # virsh dumpxml test
 ....
     <sound model='ich9'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
    </sound>
 ....
 libvirt will add address and attach to PCI automatically.
 
 # ps aux | grep qemu
 ... -device ich9-intel-hda,id=sound0,bus=pci.2,addr=0x2 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 ....
 
2. Modify the address of ich9 device:
 # virsh edit test
    <sound model='ich9'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </sound>
 save.
 
 # virsh dumpxml test
 will see it works, libvirt support to specify the bus to 0, and can be started normally.
 
 # ps aux | grep qemu
 ... -device ich9-intel-hda,id=sound0,bus=pcie.0,addr=0x7 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 ...

So setting VERIFIED.

Comment 7 Ludek Smid 2014-06-13 11:58:44 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.