vfio: Remove the get_region_info op

No driver uses it now, all are using get_region_info_caps().

Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/22-v2-2a9e24d62f1b+e10a-vfio_get_region_info_op_jgg@nvidia.com
Signed-off-by: Alex Williamson <alex@shazbot.org>
This commit is contained in:
Jason Gunthorpe 2025-11-07 13:41:38 -04:00 committed by Alex Williamson
parent dc10734610
commit 56c069307d
2 changed files with 21 additions and 29 deletions

View File

@ -1267,12 +1267,14 @@ static long vfio_get_region_info(struct vfio_device *device,
struct vfio_info_cap caps = {};
int ret;
if (unlikely(!device->ops->get_region_info_caps))
return -EINVAL;
if (copy_from_user(&info, arg, minsz))
return -EFAULT;
if (info.argsz < minsz)
return -EINVAL;
if (device->ops->get_region_info_caps) {
ret = device->ops->get_region_info_caps(device, &info, &caps);
if (ret)
goto out_free;
@ -1284,8 +1286,7 @@ static long vfio_get_region_info(struct vfio_device *device,
info.cap_offset = 0;
} else {
vfio_info_cap_shift(&caps, sizeof(info));
if (copy_to_user(arg + 1, caps.buf,
caps.size)) {
if (copy_to_user(arg + 1, caps.buf, caps.size)) {
ret = -EFAULT;
goto out_free;
}
@ -1293,17 +1294,10 @@ static long vfio_get_region_info(struct vfio_device *device,
}
}
if (copy_to_user(arg, &info, minsz)) {
if (copy_to_user(arg, &info, minsz)){
ret = -EFAULT;
goto out_free;
}
} else if (device->ops->get_region_info) {
ret = device->ops->get_region_info(device, arg);
if (ret)
return ret;
} else {
return -EINVAL;
}
out_free:
kfree(caps.buf);

View File

@ -133,8 +133,6 @@ struct vfio_device_ops {
size_t count, loff_t *size);
long (*ioctl)(struct vfio_device *vdev, unsigned int cmd,
unsigned long arg);
int (*get_region_info)(struct vfio_device *vdev,
struct vfio_region_info __user *arg);
int (*get_region_info_caps)(struct vfio_device *vdev,
struct vfio_region_info *info,
struct vfio_info_cap *caps);