[PATCH v8 05/15] iommufd/device: Associate KVM file pointer with iommufd_device

Tian, Kevin kevin.tian at intel.com
Thu Nov 5 23:09:54 PST 2026


> From: Aneesh Kumar K.V (Arm) <aneesh.kumar at kernel.org>
> Sent: Thursday, November 5, 2026 12:16 AM
> 
> From: Shameer Kolothum <shameerali.kolothum.thodi at huawei.com>
> 
> TSM vDevice support needs access to the KVM associated with a VFIO device
> after the device has been bound to iommufd.
> 
> Extend iommufd_device_bind() to accept the device's KVM file and store it
> in the iommufd_device. The KVM file reference is owned by VFIO and is
> already held for the duration of the device open path.
> 
> Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi at huawei.com>
> Reviewed-by: Jason Gunthorpe <jgg at nvidia.com>
> [nicolinc: fix build error in iommufd_test_mock_domain()]
> Signed-off-by: Nicolin Chen <nicolinc at nvidia.com>
> [aneesh.kumar: Switch to use kvm_file]
> Cc: Jason Gunthorpe <jgg at ziepe.ca>
> Cc: Kevin Tian <kevin.tian at intel.com>
> Cc: Joerg Roedel <joro at 8bytes.org>
> Cc: Will Deacon <will at kernel.org>
> Cc: Robin Murphy <robin.murphy at arm.com>
> Cc: Alex Williamson <alex at shazbot.org>
> Cc: kvm at vger.kernel.org
> Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar at kernel.org>

Reviewed-by: Kevin Tian <kevin.tian at intel.com>

a nit:

> @@ -509,6 +509,8 @@ struct iommufd_device {
>  	struct list_head group_item;
>  	/* always the physical device */
>  	struct device *dev;
> +	/* ..and the VM file if available */
> +	struct file *kvm_file;

though the comment will be immediately replaced in next patch, let's
remove the pointless "..and" here.



More information about the linux-arm-kernel mailing list