iommufd: Add kAPI toward external drivers for physical devices
authorJason Gunthorpe <jgg@nvidia.com>
Tue, 29 Nov 2022 20:29:36 +0000 (16:29 -0400)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 1 Dec 2022 00:16:49 +0000 (20:16 -0400)
commite8d57210035b6377d424ba964961892d01127cf6
tree08586306dfbb986205ba5097ba3c02fd95650d16
parentea4acfac57b9dee57a7d5840359a41cc3251de92
iommufd: Add kAPI toward external drivers for physical devices

Add the four functions external drivers need to connect physical DMA to
the IOMMUFD:

iommufd_device_bind() / iommufd_device_unbind()
  Register the device with iommufd and establish security isolation.

iommufd_device_attach() / iommufd_device_detach()
  Connect a bound device to a page table

Binding a device creates a device object ID in the uAPI, however the
generic API does not yet provide any IOCTLs to manipulate them.

Link: https://lore.kernel.org/r/13-v6-a196d26f289e+11787-iommufd_jgg@nvidia.com
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Tested-by: Nicolin Chen <nicolinc@nvidia.com>
Tested-by: Yi Liu <yi.l.liu@intel.com>
Tested-by: Lixiao Yang <lixiao.yang@intel.com>
Tested-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/iommu/iommufd/Makefile
drivers/iommu/iommufd/device.c [new file with mode: 0644]
drivers/iommu/iommufd/iommufd_private.h
drivers/iommu/iommufd/main.c
include/linux/iommufd.h