2023-12-26 02:30:24

by Wu Zongyong

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

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.

Thanks,
Wu Zongyong




2024-01-02 19:28:39

by Alex Williamson

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

On Tue, 26 Dec 2023 10:30:04 +0800
Wu Zongyong <[email protected]> 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