On 05/19/2016 02:46 PM, Shivaprasad bhat wrote:
Ah right, I forgot about that. But that is something we already don't deal with (currently you can assign a single device from an iommu group with many devices, but managed='yes' won't work for it. That would require some other sort of managed mode, like "managed='group'" or something, but more elaborate managed modes have already been NACKed on the list (I posted an RFC patch for "managed='detach'" at the request of someone else - it would detach the device from the host driver before assignment, but not reattach it afterwards. This was deemed inappropriate and unnecessary.)
You may wonder why we don't want to automatically detach all the other devices without any clue to do so in the config - it's because you can't expect the user to know which devices are in the same iommu group as the one you want to assign, and you don't want to just automatically/silent detach one that is essential for continued operation of the host.
So we really should only detach those devices that are going to be assigned to the guest.
I couldn't parse your question, but I wasn't talking about SRIOV in particular, just saying that the way multifunction device assignment is done in qemu is to assign all the non-0 functions, then assign function 0. But that was just an incidental part of the conversation. The important part is that you first detach from the host all devices to be assigned, then you assign them all.