On Mon, Oct 21, 2024 at 07:11:47PM +1100, Alexey Kardashevskiy wrote:
/*
* A real physical IOMMU instance would unlikely get unplugged, so the
* life cycle of this iommu_dev is guaranteed to stay alive, mostly. A
* pluggable IOMMU instance (if exists) is responsible for refcounting
* on its own.
"Assume IOMMUs are unpluggable (the most likely case)" would do imho, all these "unlikely" and "mostly" and "if exists" confuse.
Done.
----------------------------------------------------------------- @@ -63,13 +63,7 @@ int iommufd_viommu_alloc_ioctl(struct iommufd_ucmd *ucmd) viommu->type = cmd->type; viommu->ictx = ucmd->ictx; viommu->hwpt = hwpt_paging; - - /* - * A real physical IOMMU instance would unlikely get unplugged, so the - * life cycle of this iommu_dev is guaranteed to stay alive, mostly. A - * pluggable IOMMU instance (if exists) is responsible for refcounting - * on its own. - */ + /* Assume physical IOMMUs are unpluggable (the most likely case) */ viommu->iommu_dev = __iommu_get_iommu_dev(idev->dev);
refcount_inc(&viommu->hwpt->common.obj.users); -----------------------------------------------------------------
Thanks Nicolin