Pull VFIO updates from Alex Williamson: - Fix imbalance where the no-iommu/cdev device path skips too much on open, failing to increment a reference, but still decrements the reference on close. Add bounds checking to prevent such underflows (Jacob Pan) - Fill missing detach_ioas op for pds_vfio_pci, fixing probe failure when used with IOMMUFD (Brett Creeley) - Split SR-IOV VFs to separate dev_set, avoiding unnecessary serialization between VFs that appear on the same bus (Alex Williamson) - Fix a theoretical integer overflow is the mlx5-vfio-pci variant driver (Artem Sadovnikov) - Implement missing VF token checking support via vfio cdev/IOMMUFD interface (Jason Gunthorpe) - Update QAT vfio-pci variant driver to claim latest VF devices (Małgorzata Mielnik) - Add a cond_resched() call to avoid holding the CPU too long during DMA mapping operations (Keith Busch) * tag 'vfio-v6.17-rc1-v2' of https://github.com/awilliam/linux-vfio: vfio/type1: conditional rescheduling while pinning vfio/qat: add support for intel QAT 6xxx virtual functions vfio/qat: Remove myself from VFIO QAT PCI driver maintainers vfio/pci: Do vf_token checks for VFIO_DEVICE_BIND_IOMMUFD vfio/mlx5: fix possible overflow in tracking max message size vfio/pci: Separate SR-IOV VF dev_set vfio/pds: Fix missing detach_ioas op vfio: Prevent open_count decrement to negative vfio: Fix unbalanced vfio_df_close call in no-iommu mode
Showing the changes to include/uapi/linux (1 of 18 files). Show all
Unified · Split
| @@ -905,10 +905,12 @@ struct vfio_device_feature { · 904 unmodified lines | ||
| 905 | 905 | * VFIO_DEVICE_BIND_IOMMUFD - _IOR(VFIO_TYPE, VFIO_BASE + 18, |
| 906 | 906 | * struct vfio_device_bind_iommufd) |
| 907 | 907 | * @argsz: User filled size of this data. |
| 908 | − * @flags: Must be 0. | |
| 908 | + * @flags: Must be 0 or a bit flags of VFIO_DEVICE_BIND_* | |
| 909 | 909 | * @iommufd: iommufd to bind. |
| 910 | 910 | * @out_devid: The device id generated by this bind. devid is a handle for |
| 911 | 911 | * this device/iommufd bond and can be used in IOMMUFD commands. |
| 912 | + * @token_uuid_ptr: Valid if VFIO_DEVICE_BIND_FLAG_TOKEN. Points to a 16 byte | |
| 913 | + * UUID in the same format as VFIO_DEVICE_FEATURE_PCI_VF_TOKEN. | |
| 912 | 914 | * |
| 913 | 915 | * Bind a vfio_device to the specified iommufd. |
| 914 | 916 | * |
| @@ -917,13 +919,21 @@ struct vfio_device_feature { · 2 unmodified lines | ||
| 917 | 919 | * |
| 918 | 920 | * Unbind is automatically conducted when device fd is closed. |
| 919 | 921 | * |
| 922 | + * A token is sometimes required to open the device, unless this is known to be | |
| 923 | + * needed VFIO_DEVICE_BIND_FLAG_TOKEN should not be set and token_uuid_ptr is | |
| 924 | + * ignored. The only case today is a PF/VF relationship where the VF bind must | |
| 925 | + * be provided the same token as VFIO_DEVICE_FEATURE_PCI_VF_TOKEN provided to | |
| 926 | + * the PF. | |
| 927 | + * | |
| 920 | 928 | * Return: 0 on success, -errno on failure. |
| 921 | 929 | */ |
| 922 | 930 | struct vfio_device_bind_iommufd { |
| 923 | 931 | __u32 argsz; |
| 924 | 932 | __u32 flags; |
| 933 | +#define VFIO_DEVICE_BIND_FLAG_TOKEN (1 << 0) | |
| 925 | 934 | __s32 iommufd; |
| 926 | 935 | __u32 out_devid; |
| 936 | + __aligned_u64 token_uuid_ptr; | |
| 927 | 937 | }; |
| 928 | 938 | |
| 929 | 939 | #define VFIO_DEVICE_BIND_IOMMUFD _IO(VFIO_TYPE, VFIO_BASE + 18) |