diff options
author | Jason Gunthorpe <jgg@nvidia.com> | 2022-02-24 16:20:17 +0200 |
---|---|---|
committer | Leon Romanovsky <leonro@nvidia.com> | 2022-03-03 12:54:43 +0200 |
commit | 445ad495f0ff71553693e6a2a9d7a3bc6917ca36 (patch) | |
tree | b6151cc06f329ac74348e2b11d78fa00d7da5248 /include/linux/vfio_pci_core.h | |
parent | 40f958ea5700f479f06ec5b0a549b2442d8a7d53 (diff) | |
download | linux-stable-445ad495f0ff71553693e6a2a9d7a3bc6917ca36.tar.gz linux-stable-445ad495f0ff71553693e6a2a9d7a3bc6917ca36.tar.bz2 linux-stable-445ad495f0ff71553693e6a2a9d7a3bc6917ca36.zip |
vfio: Have the core code decode the VFIO_DEVICE_FEATURE ioctl
Invoke a new device op 'device_feature' to handle just the data array
portion of the command. This lifts the ioctl validation to the core code
and makes it simpler for either the core code, or layered drivers, to
implement their own feature values.
Provide vfio_check_feature() to consolidate checking the flags/etc against
what the driver supports.
Link: https://lore.kernel.org/all/20220224142024.147653-9-yishaih@nvidia.com
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Tested-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Diffstat (limited to 'include/linux/vfio_pci_core.h')
-rw-r--r-- | include/linux/vfio_pci_core.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/vfio_pci_core.h b/include/linux/vfio_pci_core.h index ef9a44b6cf5d..beba0b2ed87d 100644 --- a/include/linux/vfio_pci_core.h +++ b/include/linux/vfio_pci_core.h @@ -220,6 +220,8 @@ int vfio_pci_core_sriov_configure(struct pci_dev *pdev, int nr_virtfn); extern const struct pci_error_handlers vfio_pci_core_err_handlers; long vfio_pci_core_ioctl(struct vfio_device *core_vdev, unsigned int cmd, unsigned long arg); +int vfio_pci_core_ioctl_feature(struct vfio_device *device, u32 flags, + void __user *arg, size_t argsz); ssize_t vfio_pci_core_read(struct vfio_device *core_vdev, char __user *buf, size_t count, loff_t *ppos); ssize_t vfio_pci_core_write(struct vfio_device *core_vdev, const char __user *buf, |