Sent: Friday, June 14, 2024 at 9:33 AM
From: "Michal Prívozník" <mprivozn(a)redhat.com>
To: "daggs" <daggs(a)gmx.com>
Cc: users(a)lists.libvirt.org
Subject: Re: vfio usage in a vm
On 6/13/24 18:18, daggs wrote:
> Greetings Michal,
>
> I think I might be doing something wrong, all the devices are defined a such:
> <interface type='network'>
> <mac address='52:54:xx:xx:xx:xx'/>
> <source network='mynet'/>
> <model type='virtio'/>
> <address type='pci' domain='0x0000' bus='0x10'
slot='0x0x' function='0x0'/>
> </interface>
>
> and I still cannot get vfio to attached to them.
> they are autobinded to virtio_pci so I had to unbind them first
> when I reload the vfio module, I get the same errors below
>
Ah, so I've misunderstood what you meant. Virtio and VFIO are two
different approaches. While the former is for emulated devices, the
latter is for PCI assignment (aka "PCI passthrough"). Your L1 guest is
correctly binding the vNIC to virtio.
> I'm trying to attach it inside a running guest, in short, I want to be able to
pass a vNIC to a nested guest for development reasons
This could be possible, but you'll need to give your L1 guest vIOMMU:
<iommu model='intel'>
<driver intremap='on'/>
</iommu>
https://libvirt.org/formatdomain.html#iommu-devices
Then, to assign this L1 virtio vNIC to the L2 guest you can either do
<hostdev/> or <interface type='hostdev'/>:
https://libvirt.org/formatdomain.html#pci-passthrough
thanks, after enabling the iommu in the guest, vfio-pci is attached to the nics.
thanks for all the help
Dagg