Re: [PATCH] PCI: pci-stub: accept exceptions to the ID- and class-based matching

From: Laszlo Ersek
Date: Tue Oct 25 2016 - 15:41:06 EST


On 10/25/16 21:24, Laszlo Ersek wrote:
> On 10/25/16 20:42, Alex Williamson wrote:

>> FWIW, I think the reason
>> this hasn't been done to date is that PCI bus addresses (except for
>> root bus devices) are not stable. Depending on the system, the address
>> of a given device may change, not only based on the slot where the
>> device is installed, but whether other devices in other slots are
>> populated.
>
> I agree.
>
> However, while the addresses are not stable in the face of hardware
> changes, I think the addresses don't change haphazardly (that is,
> without hardware changes).
>
> So, if you plug in another card, your current pci-stub.except=...
> parameter might become invalid; but that's not very different from the
> case when you plug in the second instance of a preexistent card right
> now -- then the pci-stub.ids=... filter won't match uniquely anymore,
> and assignment vs. host-side use might not work as intented.

Sorry about the self-followup; I just wanted to add -- although it might
not carry a lot of weight for the host kernel -- that the libvirt domain
XML hard-codes the host-side PCI BDF anyway, for assigned devices:

http://libvirt.org/formatdomain.html#elementsHostDev

"""
<devices>
<hostdev mode='subsystem' type='pci' managed='yes'>
<source>
<address domain='0x0000' bus='0x06' slot='0x02' function='0x0'/>
</source>
...
</hostdev>
</devices>

...

source
The source element describes the device as seen from the host using
the following mechanism to describe:

...

pci
PCI devices can only be described by their address.
"""

Thanks
Laszlo