diff options
author | Yi Liu <yi.l.liu@intel.com> | 2023-03-27 11:33:49 +0200 |
---|---|---|
committer | Jason Gunthorpe <jgg@nvidia.com> | 2023-03-31 18:43:32 +0200 |
commit | 632fda7f912c845f98ff20e69c600160a189d803 (patch) | |
tree | de736dc5e678e4e9a01229d121738095f4691ec5 /drivers/iommu/iommufd/device.c | |
parent | vfio-iommufd: No need to record iommufd_ctx in vfio_device (diff) | |
download | linux-632fda7f912c845f98ff20e69c600160a189d803.tar.xz linux-632fda7f912c845f98ff20e69c600160a189d803.zip |
vfio-iommufd: Make vfio_iommufd_emulated_bind() return iommufd_access ID
vfio device cdev needs to return iommufd_access ID to userspace if
bind_iommufd succeeds.
Link: https://lore.kernel.org/r/20230327093351.44505-5-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: Yi Liu <yi.l.liu@intel.com>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/iommu/iommufd/device.c')
-rw-r--r-- | drivers/iommu/iommufd/device.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c index ff6fca0ea269..4b565a5b51da 100644 --- a/drivers/iommu/iommufd/device.c +++ b/drivers/iommu/iommufd/device.c @@ -425,6 +425,7 @@ void iommufd_access_destroy_object(struct iommufd_object *obj) * @ictx: iommufd file descriptor * @ops: Driver's ops to associate with the access * @data: Opaque data to pass into ops functions + * @id: Output ID number to return to userspace for this access * * An iommufd_access allows a driver to read/write to the IOAS without using * DMA. The underlying CPU memory can be accessed using the @@ -434,7 +435,7 @@ void iommufd_access_destroy_object(struct iommufd_object *obj) */ struct iommufd_access * iommufd_access_create(struct iommufd_ctx *ictx, - const struct iommufd_access_ops *ops, void *data) + const struct iommufd_access_ops *ops, void *data, u32 *id) { struct iommufd_access *access; @@ -459,6 +460,7 @@ iommufd_access_create(struct iommufd_ctx *ictx, access->ictx = ictx; iommufd_ctx_get(ictx); iommufd_object_finalize(ictx, &access->obj); + *id = access->obj.id; return access; } EXPORT_SYMBOL_NS_GPL(iommufd_access_create, IOMMUFD); |