Skip to content

Commit 9b05685

Browse files
nicolincwilldeacon
authored andcommitted
iommu/arm-smmu-v3: Explicitly set smmu_domain->stage for SVA
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>
1 parent 6fabce5 commit 9b05685

3 files changed

Lines changed: 5 additions & 0 deletions

File tree

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ struct iommu_domain *arm_smmu_sva_domain_alloc(struct device *dev,
346346
* ARM_SMMU_FEAT_RANGE_INV is present
347347
*/
348348
smmu_domain->domain.pgsize_bitmap = PAGE_SIZE;
349+
smmu_domain->stage = ARM_SMMU_DOMAIN_SVA;
349350
smmu_domain->smmu = smmu;
350351

351352
ret = xa_alloc(&arm_smmu_asid_xa, &asid, smmu_domain,

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3132,6 +3132,9 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev,
31323132
arm_smmu_install_ste_for_dev(master, &target);
31333133
arm_smmu_clear_cd(master, IOMMU_NO_PASID);
31343134
break;
3135+
default:
3136+
WARN_ON(true);
3137+
break;
31353138
}
31363139

31373140
arm_smmu_attach_commit(&state);

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,7 @@ struct arm_smmu_master {
856856
enum arm_smmu_domain_stage {
857857
ARM_SMMU_DOMAIN_S1 = 0,
858858
ARM_SMMU_DOMAIN_S2,
859+
ARM_SMMU_DOMAIN_SVA,
859860
};
860861

861862
struct arm_smmu_domain {

0 commit comments

Comments
 (0)