[PATCH v9 05/13] iommufd/viommu: Keep a reference to the KVM file
Baolu Lu
baolu.lu at linux.intel.com
Thu Nov 19 00:20:27 PST 2026
On 11/16/2026 4:19 PM, Aneesh Kumar K.V (Arm) wrote:
> From: Nicolin Chen<nicolinc at nvidia.com>
>
> The TSM vDevice operations need access to the KVM associated with the
> device's vIOMMU. Save the device's KVM file in the iommufd_viommu when the
> vIOMMU is allocated, and take a file reference so it remains valid for the
> lifetime of the vIOMMU.
>
> Release the reference when the vIOMMU is destroyed.
>
> Reject vdevice allocation when the device's KVM association differs from
> the vIOMMU's, including when only one has a KVM association. Allow
> allocation when both associations are NULL.
>
> Based on an original patch by
> Shameer Kolothum<shameerali.kolothum.thodi at huawei.com>
>
> Reviewed-by: Kevin Tian<kevin.tian at intel.com>
> Reviewed-by: Jacob Pan<jacob.pan at linux.microsoft.com>
> [nicolinc: hold kvm's users_count]
> 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:iommu at lists.linux.dev
> Reviewed-by: Jason Gunthorpe<jgg at nvidia.com>
> Signed-off-by: Aneesh Kumar K.V (Arm)<aneesh.kumar at kernel.org>
> ---
> drivers/iommu/iommufd/viommu.c | 10 ++++++++++
> include/linux/iommufd.h | 1 +
> 2 files changed, 11 insertions(+)
Reviewed-by: Lu Baolu <baolu.lu at linux.intel.com>
More information about the linux-arm-kernel
mailing list