linux-stable/drivers/iommu/iommufd
Nicolin Chen 54b47585db iommufd: Create access in vfio_iommufd_emulated_bind()
There are needs to created iommufd_access prior to have an IOAS and set
IOAS later. Like the vfio device cdev needs to have an iommufd object
to represent the bond (iommufd_access) and IOAS replacement.

Moves the iommufd_access_create() call into vfio_iommufd_emulated_bind(),
making it symmetric with the __vfio_iommufd_access_destroy() call in the
vfio_iommufd_emulated_unbind(). This means an access is created/destroyed
by the bind()/unbind(), and the vfio_iommufd_emulated_attach_ioas() only
updates the access->ioas pointer.

Since vfio_iommufd_emulated_bind() does not provide ioas_id, drop it from
the argument list of iommufd_access_create(). Instead, add a new access
API iommufd_access_attach() to set the access->ioas pointer. Also, set
vdev->iommufd_attached accordingly, similar to the physical pathway.

Link: https://lore.kernel.org/r/20230327093351.44505-3-yi.l.liu@intel.com
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Tested-by: Terrence Xu <terrence.xu@intel.com>
Tested-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
2023-03-31 13:43:31 -03:00
..
device.c iommufd: Create access in vfio_iommufd_emulated_bind() 2023-03-31 13:43:31 -03:00
double_span.h
hw_pagetable.c
io_pagetable.c
io_pagetable.h
ioas.c iommu/iommufd: Pass iommufd_ctx pointer in iommufd_get_ioas() 2023-03-29 16:52:41 -03:00
iommufd_private.h iommu/iommufd: Pass iommufd_ctx pointer in iommufd_get_ioas() 2023-03-29 16:52:41 -03:00
iommufd_test.h
Kconfig vfio: Support VFIO_NOIOMMU with iommufd 2023-02-03 15:45:23 -04:00
main.c iommufd: Add three missing structures in ucmd_buffer 2023-01-23 14:29:04 -04:00
Makefile
pages.c iommufd: Use GFP_KERNEL_ACCOUNT for iommu_map() 2023-01-25 11:52:04 +01:00
selftest.c iommufd: Create access in vfio_iommufd_emulated_bind() 2023-03-31 13:43:31 -03:00
vfio_compat.c iommu/iommufd: Pass iommufd_ctx pointer in iommufd_get_ioas() 2023-03-29 16:52:41 -03:00