On Fri,  7 Nov 2025 13:41:16 -0400
Jason Gunthorpe <[email protected]> wrote:

> There is alot of duplicated code in the drivers for processing
> VFIO_DEVICE_GET_REGION_INFO. Introduce a new op get_region_info_caps()
> which provides a struct vfio_info_cap and handles the cap chain logic
> to write the caps back to userspace and remove all of this duplication
> from drivers.
> 
> This is done in two steps, the first is a largely mechanical introduction
> of the get_region_info(). These patches are best viewed with the diff
> option to ignore whitespace (-b) as most of the lines are re-indending
> things.
> 
> Then drivers are updated to remove the duplicate cap related code. Some
> drivers are converted to use vfio_info_add_capability() instead of open
> coding a version of it.
> 
> This is on github: 
> https://github.com/jgunthorpe/linux/commits/vfio_get_region_info_op
> 
> v2:
>  - Rename
>     hisi_acc_vfio_get_region -> hisi_acc_vfio_ioctl_get_region
>     vfio_fsl_mc_get_region_info -> vfio_fsl_mc_ioctl_get_region_info
>     intel_vgpu_get_region_info -> intel_vgpu_ioctl_get_region_info
>     mbochs_get_region_info -> mbochs_ioctl_get_region_info
>     intel_vgpu_get_region_info -> intel_vgpu_ioctl_get_region_info
>     vfio_ccw_mdev_get_region_info -> vfio_ccw_mdev_ioctl_get_region_info
>     hisi_acc_vfio_get_region -> hisi_acc_vfio_ioctl_get_region
>     vfio_fsl_mc_get_region_info -> vfio_fsl_mc_ioctl_get_region_info
>  - Consistently free caps.buf in vfio_get_region_info()
> v1: 
> https://patch.msgid.link/r/[email protected]

Applied to vfio next branch for v6.19.  Thanks,

Alex

Reply via email to