Re: [Question] Is it must for vfio-mdev parent driver to implement a pci-compliant configuration r/w interface

From: Alex Williamson
Date: Tue Jan 02 2024 - 14:28:37 EST


On Tue, 26 Dec 2023 10:30:04 +0800
Wu Zongyong <wuzongyong@xxxxxxxxxxxxxxxxx> wrote:

> Hi,
>
> For vfio, I know there are two method to get region size:
> 1. VFIO_DEVICE_GET_REGION_INFO ioctl
> 2. write a value of all 1's to the bar register of vfio-device fd
> and then read the value back which is described in pci spec
>
> Now I am curious about is it a must for a vfio-mdev parent driver to
> implement the method 2? Or it is just a optional interface.

If there's not a working, compliant config space, the device shouldn't
claim to implement a vfio-pci interface. There's vfio-platform
available for non-PCI devices. While the BAR size may be found via
either REGION_INFO or config space itself, the BAR address space is
only found via config space, ie. memory or IO, 32 or 64-bit,
prefetchable or not. Thanks,

Alex