
On Wed, 31 May 2023 17:46:50 -0300 Jason Gunthorpe <jgg@nvidia.com> wrote:
On Wed, May 31, 2023 at 02:40:01PM -0600, Alex Williamson wrote:
Also note that we're saying "vfio" not "vfio-pci". Only the mdev interface has the device_api attribute to indicate the exported vfio device interface. The "vfio_pci:" match in modalias indicates a vfio PCI driver, not necessarily a driver that provides a vfio-pci API.
modalias was designed so you take the /sys/.../modalias file, prepend vfio_ then do a standard modalias search on that string. The matching module should be loaded and the module name bound to the device as the driver name.
There should be no bus type dependencies in any of this in management code.
For example, modalias of a random wifi adapter: pci:v00008086d00002723sv00008086sd00000084bc02sc80i00 The bus name is prepended because the encoding is bus specific. Yes, code doesn't really need to interpret that, it simply adds "vfio_" to the beginning of the string and finds the matching driver with the fewest number of wildcards in modules.alias. We are not code, we have a vfio_pci driver, a vfio-pci device API, and a vfio_pci: modalias prefix, it's easy to get them confused and infer information that isn't intended. All I'm trying (poorly) to clarify is that a vfio_pci: modalias prefix only indicates a vfio driver for a PCI device. It does not guarantee the vfio device API exposed to userspace is vfio-pci. Therefore management tools should be cautious to make assumptions about the type of device the VM will see even though we've got vfio-pci written all over the place. Thanks, Alex