Thread (34 messages) 34 messages, 3 authors, 2025-02-25

Re: [PATCH v7 12/14] iommu/arm-smmu-v3: Introduce struct arm_smmu_vmaster

From: Jason Gunthorpe <jgg@nvidia.com>
Date: 2025-02-25 16:02:31
Also in: linux-doc, linux-iommu, linux-kselftest, linux-patches, lkml

On Mon, Feb 24, 2025 at 03:45:33PM -0800, Nicolin Chen wrote:
quoted hunk ↗ jump to hunk
--- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c
+++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c
@@ -95,8 +95,6 @@ int arm_smmu_attach_prepare_vmaster(struct arm_smmu_attach_state *state,
 
 	iommu_group_mutex_assert(state->master->dev);
 
-	if (domain->type != IOMMU_DOMAIN_NESTED)
-		return 0;
 	nested_domain = to_smmu_nested_domain(domain);
 
 	/* Skip invalid vSTE */
@@ -122,19 +120,9 @@ void arm_smmu_attach_commit_vmaster(struct arm_smmu_attach_state *state)
 {
 	struct arm_smmu_master *master = state->master;
 
-	mutex_lock(&master->smmu->streams_mutex);
-	if (state->vmaster != master->vmaster) {
-		kfree(master->vmaster);
-		master->vmaster = state->vmaster;
-	}
-	mutex_unlock(&master->smmu->streams_mutex);
-}
-
-void arm_smmu_master_clear_vmaster(struct arm_smmu_master *master)
-{
 	mutex_lock(&master->smmu->streams_mutex);
 	kfree(master->vmaster);
-	master->vmaster = NULL;
+	master->vmaster = state->vmaster;
 	mutex_unlock(&master->smmu->streams_mutex);
 }
I'd leave the clear_vmaster just for clarity. Commit should not be
unpaired with prepare in the other functions.

It looks fine with this on top too

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

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