[PATCH v2 0/3] Fix hotplug of unassigned hostdevs
Daniel Henrique Barboza
danielhb413 at gmail.com
Thu Jan 27 14:16:46 UTC 2022
On 1/27/22 11:05, Michal Prívozník wrote:
> On 1/27/22 14:57, Daniel Henrique Barboza wrote:
>> On 1/26/22 06:29, Michal Privoznik wrote:
>>> v2 of:
>>> Patches 1/3 and 2/3 were ACKed but I'm sending them for completeness.
>> Back when I've added this UNASSIGNED address type I was also pursuing a
>> PCI multifunction
>> hotplug/unplug feature in Libvirt and, apparently, I didn't mind testing
>> of non-multifunction unassigned hostdevs like the bug mentioned in patch
>> 1 did.
>> Thanks for fixing this up.
> yeah, this is more of a workaround than a real fix, because IIUC
> unassigned PCI address makes sense for devices within one IOMMU group. I
> mean, you want to passthrough one specific PCI device but because it's
> in IOMMU group with another one, both have to be detached from the host.
Yes. The context where I added this UNASSIGNED address type was to allow a whole PCI
multifunction card to be managed by Libvirt, which would detach all the functions from
the IOMMU grupo of the host and, at the same time, filter which functions would be visible
to the guest.
I didn't foresee this usage back then.
> Well, and for that we would need the hotplug/hotunplug API understand
> that and attach/detach two or more devices at once. With my patches you
> can still hotplug/hotunplug just a single device, but hey, at least we
> don't error out!
You could also just forbid hotplug of UNASSIGNED non-multifunction hostdevs.
I can't think of an actual use of detaching a single hostdev from the host and doing nothing
with it. If the idea is to refrain the host from using the hostdev the user can just
Matter of fact, I'd say that the 'UNASSIGNED' address type makes little sense for
non-multifuction devices altogether.
More information about the libvir-list