vfio: Have the core code decode the VFIO_DEVICE_FEATURE ioctl
authorJason Gunthorpe <jgg@nvidia.com>
Thu, 24 Feb 2022 14:20:17 +0000 (16:20 +0200)
committerLeon Romanovsky <leonro@nvidia.com>
Thu, 3 Mar 2022 10:54:43 +0000 (12:54 +0200)
commit445ad495f0ff71553693e6a2a9d7a3bc6917ca36
treeb6151cc06f329ac74348e2b11d78fa00d7da5248
parent40f958ea5700f479f06ec5b0a549b2442d8a7d53
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>
drivers/vfio/pci/vfio_pci.c
drivers/vfio/pci/vfio_pci_core.c
drivers/vfio/vfio.c
include/linux/vfio.h
include/linux/vfio_pci_core.h