> From: Jason Gunthorpe <[email protected]> > Sent: Friday, October 24, 2025 7:09 AM > > 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 > > Jason Gunthorpe (22): > vfio: Provide a get_region_info op > vfio/hisi: Convert to the get_region_info op > vfio/virtio: Convert to the get_region_info op > vfio/nvgrace: Convert to the get_region_info op > vfio/pci: Fill in the missing get_region_info ops > vfio/mtty: Provide a get_region_info op > vfio/mdpy: Provide a get_region_info op > vfio/mbochs: Provide a get_region_info op > vfio/platform: Provide a get_region_info op > vfio/fsl: Provide a get_region_info op > vfio/cdx: Provide a get_region_info op > vfio/ccw: Provide a get_region_info op > vfio/gvt: Provide a get_region_info op > vfio: Require drivers to implement get_region_info > vfio: Add get_region_info_caps op > vfio/mbochs: Convert mbochs to use vfio_info_add_capability() > vfio/gvt: Convert to get_region_info_caps > vfio/ccw: Convert to get_region_info_caps > vfio/pci: Convert all PCI drivers to get_region_info_caps > vfio/platform: Convert to get_region_info_caps > vfio: Move the remaining drivers to get_region_info_caps > vfio: Remove the get_region_info op >
for the entire series: Reviewed-by: Kevin Tian <[email protected]>
