]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iommu/arm-smmu-v3: Explicitly set smmu_domain->stage for SVA
authorNicolin Chen <nicolinc@nvidia.com>
Tue, 17 Mar 2026 07:59:17 +0000 (00:59 -0700)
committerWill Deacon <will@kernel.org>
Thu, 19 Mar 2026 15:08:21 +0000 (15:08 +0000)
Both the ARM_SMMU_DOMAIN_S1 case and the SVA case use ASID, requiring ASID
based invalidation commands to flush the TLB.

Define an ARM_SMMU_DOMAIN_SVA to make the SVA case clear to share the same
path with the ARM_SMMU_DOMAIN_S1 case, which will be a part of the routine
to build a new per-domain invalidation array.

There is no function change.

Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Acked-by: Balbir Singh <balbirs@nvidia.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Pranjal Shrivastava <praan@google.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Will Deacon <will@kernel.org>
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h

index 59a480974d80f035d6f5440b121a9951813bd65e..6097f1f540d877f9cec01b1d1a18f436612f2874 100644 (file)
@@ -346,6 +346,7 @@ struct iommu_domain *arm_smmu_sva_domain_alloc(struct device *dev,
         * ARM_SMMU_FEAT_RANGE_INV is present
         */
        smmu_domain->domain.pgsize_bitmap = PAGE_SIZE;
+       smmu_domain->stage = ARM_SMMU_DOMAIN_SVA;
        smmu_domain->smmu = smmu;
 
        ret = xa_alloc(&arm_smmu_asid_xa, &asid, smmu_domain,
index 606abe051e68b4aa0473d17482d7e63884f261a0..117979c96b762680f7e8b87ae920990b7131b041 100644 (file)
@@ -3132,6 +3132,9 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev,
                arm_smmu_install_ste_for_dev(master, &target);
                arm_smmu_clear_cd(master, IOMMU_NO_PASID);
                break;
+       default:
+               WARN_ON(true);
+               break;
        }
 
        arm_smmu_attach_commit(&state);
index 3c6d65d36164f67d6212066fde8abd0918690259..24894b16300457f01baf40dbf0fba8631faf7c71 100644 (file)
@@ -856,6 +856,7 @@ struct arm_smmu_master {
 enum arm_smmu_domain_stage {
        ARM_SMMU_DOMAIN_S1 = 0,
        ARM_SMMU_DOMAIN_S2,
+       ARM_SMMU_DOMAIN_SVA,
 };
 
 struct arm_smmu_domain {