mirror of https://github.com/torvalds/linux.git
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>
This commit is contained in:
parent
e238f147d5
commit
c044eefa47
|
|
@ -109,10 +109,8 @@ void virtiovf_migration_reset_done(struct pci_dev *pdev);
|
|||
|
||||
#ifdef CONFIG_VIRTIO_VFIO_PCI_ADMIN_LEGACY
|
||||
int virtiovf_open_legacy_io(struct virtiovf_pci_core_device *virtvdev);
|
||||
long virtiovf_vfio_pci_core_ioctl(struct vfio_device *core_vdev,
|
||||
unsigned int cmd, unsigned long arg);
|
||||
int virtiovf_pci_ioctl_get_region_info(struct vfio_device *core_vdev,
|
||||
unsigned int cmd, unsigned long arg);
|
||||
struct vfio_region_info __user *arg);
|
||||
ssize_t virtiovf_pci_core_write(struct vfio_device *core_vdev,
|
||||
const char __user *buf, size_t count,
|
||||
loff_t *ppos);
|
||||
|
|
|
|||
|
|
@ -281,15 +281,14 @@ ssize_t virtiovf_pci_core_write(struct vfio_device *core_vdev, const char __user
|
|||
}
|
||||
|
||||
int virtiovf_pci_ioctl_get_region_info(struct vfio_device *core_vdev,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
struct vfio_region_info __user *arg)
|
||||
{
|
||||
struct virtiovf_pci_core_device *virtvdev = container_of(
|
||||
core_vdev, struct virtiovf_pci_core_device, core_device.vdev);
|
||||
unsigned long minsz = offsetofend(struct vfio_region_info, offset);
|
||||
void __user *uarg = (void __user *)arg;
|
||||
struct vfio_region_info info = {};
|
||||
|
||||
if (copy_from_user(&info, uarg, minsz))
|
||||
if (copy_from_user(&info, arg, minsz))
|
||||
return -EFAULT;
|
||||
|
||||
if (info.argsz < minsz)
|
||||
|
|
@ -301,20 +300,9 @@ int virtiovf_pci_ioctl_get_region_info(struct vfio_device *core_vdev,
|
|||
info.size = virtvdev->bar0_virtual_buf_size;
|
||||
info.flags = VFIO_REGION_INFO_FLAG_READ |
|
||||
VFIO_REGION_INFO_FLAG_WRITE;
|
||||
return copy_to_user(uarg, &info, minsz) ? -EFAULT : 0;
|
||||
return copy_to_user(arg, &info, minsz) ? -EFAULT : 0;
|
||||
default:
|
||||
return vfio_pci_core_ioctl(core_vdev, cmd, arg);
|
||||
}
|
||||
}
|
||||
|
||||
long virtiovf_vfio_pci_core_ioctl(struct vfio_device *core_vdev, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
switch (cmd) {
|
||||
case VFIO_DEVICE_GET_REGION_INFO:
|
||||
return virtiovf_pci_ioctl_get_region_info(core_vdev, cmd, arg);
|
||||
default:
|
||||
return vfio_pci_core_ioctl(core_vdev, cmd, arg);
|
||||
return vfio_pci_ioctl_get_region_info(core_vdev, arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,8 @@ static const struct vfio_device_ops virtiovf_vfio_pci_tran_lm_ops = {
|
|||
.release = virtiovf_pci_core_release_dev,
|
||||
.open_device = virtiovf_pci_open_device,
|
||||
.close_device = virtiovf_pci_close_device,
|
||||
.ioctl = virtiovf_vfio_pci_core_ioctl,
|
||||
.ioctl = vfio_pci_core_ioctl,
|
||||
.get_region_info = virtiovf_pci_ioctl_get_region_info,
|
||||
.device_feature = vfio_pci_core_ioctl_feature,
|
||||
.read = virtiovf_pci_core_read,
|
||||
.write = virtiovf_pci_core_write,
|
||||
|
|
|
|||
Loading…
Reference in New Issue