Re: [PATCH 07/11] vfio: selftests: Allow drivers to specify required region size

Manuel Ebner
2026-05-02T08:33:54Z

Hi,
On Thu, 2026-04-30 at 21:08 -0300, Jason Gunthorpe wrote:
> Add a region_size field to struct vfio_pci_driver_ops so drivers can
> declare how much DMA-mapped region they need. The mlx5 driver will
> need ~18MB for firmware pages. Existing drivers leave region_size as
> 0 and get the current default of SZ_2M.
>
> Assisted-by: Claude:claude-opus-4.6
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
>  .../selftests/vfio/lib/include/libvfio/vfio_pci_driver.h       | 3 +++
>  tools/testing/selftests/vfio/vfio_pci_driver_test.c            | 3 ++-
>  2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git
> a/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_driver.h
> b/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_driver.h
> index e5ada209b1d102..fa172635632453 100644
> --- a/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_driver.h
> +++ b/tools/testing/selftests/vfio/lib/include/libvfio/vfio_pci_driver.h
> @@ -9,6 +9,9 @@ struct vfio_pci_device;
>  struct vfio_pci_driver_ops {
>   const char *name;
>
> + /* Minimum driver region size, 0 = default SZ_2M */
> + u64 region_size;

i guess i do not understand this comment, but that's no surprise
because i'm new to the kernel.
would one of my suggestions be better?

+ /* Minimum driver region size == 0 -> default = SZ_2M */

or

+ /* Minimum driver region size, default SZ_2M = 0 */

> [...]

Manuel