[libvirt-users] How to assign to PCI slot 0

Michal Privoznik mprivozn at redhat.com
Thu Oct 26 07:40:38 UTC 2017


On 10/24/2017 05:01 PM, Fortman, Andrew wrote:
> Hi,
> 
> I'm new to this group so bear with me.
> 
> So I need to passthrough a pci device on a particular bus and slot to get Linux to recognize it correctly.
> 
> I need pci bus 6, slot 0.

There are HOST PCI addresses and GUEST PCI addresses. For instance,

  <hostdev mode='subsystem' type='pci' managed='yes'>
    <source>
      <address domain='0x0000' bus='0x06' slot='0x12' function='0x5'/>
    </source>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x03'
function='0x0'/>
  </hostdev>

This will assign (PCI passthrough is bad term BTW) PCI device which is
found on the HOST on address 06:12.5 to the GUEST where it will be at
00:03.0. Or do you need the device to appear at specific address in the
GUEST?

> 
> However whenever I try to use this slot inside of virsh edit it complains:
> 
> error: XML error: Invalid PCI address 0000:06:00.0. slot must be >= 1
> Failed. Try again? [y,n,i,f,?]:

This suggests that you have a controller that creates bus 6 but already
has something plugged on slot 1 so it is not available.

> 
> Is there a way to work around this ? Like can I disable the strict XML checking or even run the qemu commands manually?

No, we don't support disabling XML checking. If we did the code would
explode because of all the special casing. Also, if you didn't get the
error from libvirt, you'd get it from qemu. It doesn't matter.

As for manual qemu commands - sure 'virsh qemu-monitor-command'

Michal




More information about the libvirt-users mailing list