[libvirt-users] Using hostdev to plug a PCI-E host device into Q35 pcie-root port

Thomas Kuther tom at kuther.net
Tue Nov 19 19:51:32 UTC 2013


Am 19.11.2013 14:51, schrieb Thomas Kuther:
> Am 19.11.2013 11:36, schrieb Laine Stump:
>> On 11/15/2013 03:35 PM, Thomas Kuther wrote:
>>> Hello,
>>>
>>> I'm trying to migrate a working qemu command line configuration to
>>> libvirt.
>>> The part I'm currently failing on is:
>>>
>>> $ qemu-system-x86_64 -M Q35 ... -device vfio-pci,host=05:00.0,bus=pcie.0
>>>
>>> The right way to translate this into libvirt XML seems to be using
>>> <hostdev>, but I seem to be unable to plug it into the pcie-root port
>>>
>>> This is how the interesting part looks like when I let "virsh edit"
>>> generate an <address>
>>>
>>>     <controller type='pci' index='0' model='pcie-root'/>
>>>     <controller type='pci' index='1' model='dmi-to-pci-bridge'>
>>>       <address type='pci' domain='0x0000' bus='0x00' slot='0x02'
>>> function='0x0'/>
>>>     </controller>
>>>     <controller type='pci' index='2' model='pci-bridge'>
>>>       <address type='pci' domain='0x0000' bus='0x01' slot='0x01'
>>> function='0x0'/>
>>>     </controller>
>>>     [...]
>>>     <hostdev mode='subsystem' type='pci' managed='yes'>
>>>       <driver name='vfio'/>
>>>       <source>
>>>         <address domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
>>>       </source>
>>>       <address type='pci' domain='0x0000' bus='0x02' slot='0x06'
>>> function='0x0'/>
>>>     </hostdev>
>>>     [...]
>>>
>>> To my understanding, this will plug the host device into the
>>> pci-bridge controller.
>>> The guest OS doesn't boot with this and resets right after bios.
>>
>> Ugh. That's very unfortunate. This is the first report I've heard of
>> something failing in such a bad way due to being plugged into a
>> pci-bridge slot; up until now I'd only heard that there is some extra
>> PCIe functionality that would be missing if a device was plugged into a
>> PCI slot vs. PCIe.
>>
>> Can I ask what type of device this is?
>>
> 
> It's a Marvell 88SE9172 SATA controller, here is the lspci -vvv
> 
[...]
> 
> The second one I'm trying to pass through is a Renesas uPD720201 USB 3.0
> Host Controller, but first I wanted to get the SATA controller working
> in libvirt. I will try to leave out the SATA controller and see what
> happens with only the USB3 controller.
> 
> 

I tried to pass through only the USB 3 controller. The guest boots, but
the controller isn't really working (means: no mouse and keyboard)
Also tried again with above SATA controller just to verify, same result:
the guest resets right after bios, causing a bios-reset-bios-reset loop.

If it matters, the hosts runs vanilla 3.12 + libvirt-1.1.4 + qemu-1.6.1


>> I'm wondering as I type if possibly we could relax the enforcement of
>> the "PCI only" rule such that we allow explicitly placing any device on
>> any type of bus, but only auto-assign to a plain PCI slot. That may be a
>> reasonable compromise until qemu has the required new device/controller
>> introspection info available.
>>
> 
> I like the idea.
> 

I _really_ like the idea meanwhile :)


~Thomas





More information about the libvirt-users mailing list