[Intel-gfx] [PATCH v5 00/19] Add vfio_device cdev for iommufd support

Jason Gunthorpe jgg at nvidia.com
Mon Feb 27 19:21:19 UTC 2023


On Mon, Feb 27, 2023 at 03:11:16AM -0800, Yi Liu wrote:
> Existing VFIO provides group-centric user APIs for userspace. Userspace
> opens the /dev/vfio/$group_id first before getting device fd and hence
> getting access to device. This is not the desired model for iommufd. Per
> the conclusion of community discussion[1], iommufd provides device-centric
> kAPIs and requires its consumer (like VFIO) to be device-centric user
> APIs. Such user APIs are used to associate device with iommufd and also
> the I/O address spaces managed by the iommufd.
> 
> This series first introduces a per device file structure to be prepared
> for further enhancement and refactors the kvm-vfio code to be prepared
> for accepting device file from userspace. Then refactors the vfio to be
> able to handle iommufd binding. This refactor includes the mechanism of
> blocking device access before iommufd bind, making the device_open exclusive.
> between the group path and the cdev path. Eventually, adds the cdev support
> for vfio device, and makes group infrastructure optional as it is not needed
> when vfio device cdev is compiled.
> 
> This is also a prerequisite for iommu nesting for vfio device[2].
> 
> The complete code can be found in below branch, simple test done with the
> legacy group path and the cdev path. Draft QEMU branch can be found at[3]
> 
> https://github.com/yiliu1765/iommufd/tree/vfio_device_cdev_v5
> (config CONFIG_IOMMUFD=y CONFIG_VFIO_DEVICE_CDEV=y)
> 
> base-commit: 63777bd2daa3625da6eada88bd9081f047664dad

This needs to be rebased onto a clean v6.3-rc1 when it comes out

Jason


More information about the Intel-gfx mailing list