Thread (95 messages) 95 messages, 8 authors, 2024-10-17

Re: [PATCH v2 8/8] iommu/arm-smmu-v3: Support IOMMU_DOMAIN_NESTED

From: Nicolin Chen <hidden>
Date: 2024-08-28 19:28:38
Also in: kvm, linux-acpi, linux-iommu, linux-patches

On Wed, Aug 28, 2024 at 04:01:00PM -0300, Jason Gunthorpe wrote:
quoted
quoted
+
+	if (!(parent->type & __IOMMU_DOMAIN_PAGING))
+		return ERR_PTR(-EINVAL);
+
+	smmu_parent = to_smmu_domain(parent);
+	if (smmu_parent->stage != ARM_SMMU_DOMAIN_S2 ||
Maybe "!smmu_parent->nest_parent" instead.
Hmm, yes.. Actually we can delete it, and the paging test above.

The core code checks it.
Yea, we can rely on the core.
quoted hunk ↗ jump to hunk
Though I think we missed owner validation there??
@@ -225,7 +225,8 @@ iommufd_hwpt_nested_alloc(struct iommufd_ctx *ictx,
        if ((flags & ~IOMMU_HWPT_FAULT_ID_VALID) ||
            !user_data->len || !ops->domain_alloc_user)
                return ERR_PTR(-EOPNOTSUPP);
-       if (parent->auto_domain || !parent->nest_parent)
+       if (parent->auto_domain || !parent->nest_parent ||
+           parent->common.domain->owner != ops)
                return ERR_PTR(-EINVAL);
Right??
Yea, this ensures the same driver.
quoted
[---]
quoted
+	    smmu_parent->smmu != master->smmu)
+		return ERR_PTR(-EINVAL);
Then, we only need this one.

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