Hi Andrew,

> I think a key to the main problem is the same IOMMU group used for both PCI 
> functions.
> It tries to set IOMMU type using the same file descriptor twice. The second 
> set is dummy, since the same value is set, but still fails, I guess, because 
> it is already in use.
> See logs with debug enabled and few extra logs below:

Yes you're right. Specifically, eal_vfio.c:vfio_setup_device() at line  311 
(where we check for number of groups) - the code always assumes that one
active group means we've just initialized a new group, which may not 
necessarily be the case if there's more than one device per group.

Alejandro, please correct me if I'm wrong, but I think this raises another 
issue: vfio_release_device() seems to attempt to close group fd unconditionally,
which is probably a bad idea if there are more than one device per group.

Would you be so kind to come up with a patch to fix this oversight, or should I 
do it? :)

Thanks,
Anatoly

Reply via email to