Thread (43 messages) 43 messages, 4 authors, 2025-11-07

Re: [PATCH v1 02/20] iommu: Introduce a test_dev domain op and an internal helper

From: Nicolin Chen <hidden>
Date: 2025-10-20 18:52:30
Also in: asahi, linux-arm-kernel, linux-arm-msm, linux-iommu, linux-mediatek, linux-patches, linux-riscv, linux-rockchip, linux-s390, linux-sunxi, linux-tegra, lkml

On Mon, Oct 20, 2025 at 01:27:36PM -0300, Jason Gunthorpe wrote:
On Sun, Oct 12, 2025 at 05:04:59PM -0700, Nicolin Chen wrote:
quoted
And keep them within the group->mutex, so drivers can simply move all the
sanity and compatibility tests from their attach_dev callbacks to the new
test_dev callbacks without concerning about a race condition.
I'm not sure about this.. For the problem we are trying to solve this
would be racy as the test would be done and the group mutex
unlocked. Then later it will be re-tested and attached.
Oh right, we'll have to retest in iommu_dev_reset_done(). I missed
that.
quoted
@@ -751,6 +760,8 @@ struct iommu_ops {
  * @free: Release the domain after use.
  */
 struct iommu_domain_ops {
+	int (*test_dev)(struct iommu_domain *domain, struct device *dev,
+			ioasid_t pasid, struct iommu_domain *old);
Because of the starting remark I'm skeptical that old should be
included here.
Hmm, the followings functions sanitizes "old":
 - qcom_iommu_identity_attach() drivers/iommu/arm/arm-smmu/qcom_iommu.c
 - iommu_sva_set_dev_pasid() in drivers/iommu/amd/pasid.c

Thanks
Nicolin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help