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/ccw: Provide a get_region_info op

Move it out of vfio_ccw_mdev_ioctl() and re-indent it.

Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Link: https://lore.kernel.org/r/12-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
61b3f7b5 b9827eff

+26 -18
+26 -18
drivers/s390/cio/vfio_ccw_ops.c
··· 504 504 private->region = NULL; 505 505 } 506 506 507 + static int 508 + vfio_ccw_mdev_ioctl_get_region_info(struct vfio_device *vdev, 509 + struct vfio_region_info __user *arg) 510 + { 511 + struct vfio_ccw_private *private = 512 + container_of(vdev, struct vfio_ccw_private, vdev); 513 + struct vfio_region_info info; 514 + unsigned long minsz; 515 + int ret; 516 + 517 + minsz = offsetofend(struct vfio_region_info, offset); 518 + 519 + if (copy_from_user(&info, arg, minsz)) 520 + return -EFAULT; 521 + 522 + if (info.argsz < minsz) 523 + return -EINVAL; 524 + 525 + ret = vfio_ccw_mdev_get_region_info(private, &info, arg); 526 + if (ret) 527 + return ret; 528 + 529 + return copy_to_user(arg, &info, minsz) ? -EFAULT : 0; 530 + } 531 + 507 532 static ssize_t vfio_ccw_mdev_ioctl(struct vfio_device *vdev, 508 533 unsigned int cmd, 509 534 unsigned long arg) ··· 552 527 return -EINVAL; 553 528 554 529 ret = vfio_ccw_mdev_get_device_info(private, &info); 555 - if (ret) 556 - return ret; 557 - 558 - return copy_to_user((void __user *)arg, &info, minsz) ? -EFAULT : 0; 559 - } 560 - case VFIO_DEVICE_GET_REGION_INFO: 561 - { 562 - struct vfio_region_info info; 563 - 564 - minsz = offsetofend(struct vfio_region_info, offset); 565 - 566 - if (copy_from_user(&info, (void __user *)arg, minsz)) 567 - return -EFAULT; 568 - 569 - if (info.argsz < minsz) 570 - return -EINVAL; 571 - 572 - ret = vfio_ccw_mdev_get_region_info(private, &info, arg); 573 530 if (ret) 574 531 return ret; 575 532 ··· 634 627 .read = vfio_ccw_mdev_read, 635 628 .write = vfio_ccw_mdev_write, 636 629 .ioctl = vfio_ccw_mdev_ioctl, 630 + .get_region_info = vfio_ccw_mdev_ioctl_get_region_info, 637 631 .request = vfio_ccw_mdev_request, 638 632 .dma_unmap = vfio_ccw_dma_unmap, 639 633 .bind_iommufd = vfio_iommufd_emulated_bind,