Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vfio/virtio: Convert to the get_region_info op

Remove virtiovf_vfio_pci_core_ioctl() and change the signature of
virtiovf_pci_ioctl_get_region_info().

Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Pranjal Shrivastava <praan@google.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/3-v2-2a9e24d62f1b+e10a-vfio_get_region_info_op_jgg@nvidia.com
Signed-off-by: Alex Williamson <alex@shazbot.org>

authored by

Jason Gunthorpe and committed by
Alex Williamson
c044eefa e238f147

+7 -20
+1 -3
drivers/vfio/pci/virtio/common.h
··· 109 109 110 110 #ifdef CONFIG_VIRTIO_VFIO_PCI_ADMIN_LEGACY 111 111 int virtiovf_open_legacy_io(struct virtiovf_pci_core_device *virtvdev); 112 - long virtiovf_vfio_pci_core_ioctl(struct vfio_device *core_vdev, 113 - unsigned int cmd, unsigned long arg); 114 112 int virtiovf_pci_ioctl_get_region_info(struct vfio_device *core_vdev, 115 - unsigned int cmd, unsigned long arg); 113 + struct vfio_region_info __user *arg); 116 114 ssize_t virtiovf_pci_core_write(struct vfio_device *core_vdev, 117 115 const char __user *buf, size_t count, 118 116 loff_t *ppos);
+4 -16
drivers/vfio/pci/virtio/legacy_io.c
··· 281 281 } 282 282 283 283 int virtiovf_pci_ioctl_get_region_info(struct vfio_device *core_vdev, 284 - unsigned int cmd, unsigned long arg) 284 + struct vfio_region_info __user *arg) 285 285 { 286 286 struct virtiovf_pci_core_device *virtvdev = container_of( 287 287 core_vdev, struct virtiovf_pci_core_device, core_device.vdev); 288 288 unsigned long minsz = offsetofend(struct vfio_region_info, offset); 289 - void __user *uarg = (void __user *)arg; 290 289 struct vfio_region_info info = {}; 291 290 292 - if (copy_from_user(&info, uarg, minsz)) 291 + if (copy_from_user(&info, arg, minsz)) 293 292 return -EFAULT; 294 293 295 294 if (info.argsz < minsz) ··· 300 301 info.size = virtvdev->bar0_virtual_buf_size; 301 302 info.flags = VFIO_REGION_INFO_FLAG_READ | 302 303 VFIO_REGION_INFO_FLAG_WRITE; 303 - return copy_to_user(uarg, &info, minsz) ? -EFAULT : 0; 304 + return copy_to_user(arg, &info, minsz) ? -EFAULT : 0; 304 305 default: 305 - return vfio_pci_core_ioctl(core_vdev, cmd, arg); 306 - } 307 - } 308 - 309 - long virtiovf_vfio_pci_core_ioctl(struct vfio_device *core_vdev, unsigned int cmd, 310 - unsigned long arg) 311 - { 312 - switch (cmd) { 313 - case VFIO_DEVICE_GET_REGION_INFO: 314 - return virtiovf_pci_ioctl_get_region_info(core_vdev, cmd, arg); 315 - default: 316 - return vfio_pci_core_ioctl(core_vdev, cmd, arg); 306 + return vfio_pci_ioctl_get_region_info(core_vdev, arg); 317 307 } 318 308 } 319 309
+2 -1
drivers/vfio/pci/virtio/main.c
··· 108 108 .release = virtiovf_pci_core_release_dev, 109 109 .open_device = virtiovf_pci_open_device, 110 110 .close_device = virtiovf_pci_close_device, 111 - .ioctl = virtiovf_vfio_pci_core_ioctl, 111 + .ioctl = vfio_pci_core_ioctl, 112 + .get_region_info = virtiovf_pci_ioctl_get_region_info, 112 113 .device_feature = vfio_pci_core_ioctl_feature, 113 114 .read = virtiovf_pci_core_read, 114 115 .write = virtiovf_pci_core_write,