vfio: Add VFIO_DEVICE_[AT|DE]TACH_IOMMUFD_PT
authorYi Liu <yi.l.liu@intel.com>
Tue, 18 Jul 2023 13:55:48 +0000 (06:55 -0700)
committerAlex Williamson <alex.williamson@redhat.com>
Tue, 25 Jul 2023 16:20:37 +0000 (10:20 -0600)
commitb290a05fd858281fcac6fe94ec76a46d5396b9e5
treec871953fc1920bb0ec9b2979d0a53541470fca5f
parent5fcc26969a164e6a3154bb68badd6712716eb954
vfio: Add VFIO_DEVICE_[AT|DE]TACH_IOMMUFD_PT

This adds ioctl for userspace to attach device cdev fd to and detach
from IOAS/hw_pagetable managed by iommufd.

    VFIO_DEVICE_ATTACH_IOMMUFD_PT: attach vfio device to IOAS or hw_pagetable
   managed by iommufd. Attach can be undo
   by VFIO_DEVICE_DETACH_IOMMUFD_PT or device
   fd close.
    VFIO_DEVICE_DETACH_IOMMUFD_PT: detach vfio device from the current attached
   IOAS or hw_pagetable managed by iommufd.

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Tested-by: Nicolin Chen <nicolinc@nvidia.com>
Tested-by: Matthew Rosato <mjrosato@linux.ibm.com>
Tested-by: Yanting Jiang <yanting.jiang@intel.com>
Tested-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Tested-by: Terrence Xu <terrence.xu@intel.com>
Tested-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Link: https://lore.kernel.org/r/20230718135551.6592-24-yi.l.liu@intel.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/device_cdev.c
drivers/vfio/vfio.h
drivers/vfio/vfio_main.c
include/uapi/linux/vfio.h