Skip to content

Commit 14dd2a1

Browse files
wildea01gregkh
authored andcommitted
iommu/arm-smmu: Ensure that page-table updates are visible before TLBI
commit 7d321bd upstream. The IO-pgtable code relies on the driver TLB invalidation callbacks to ensure that all page-table updates are visible to the IOMMU page-table walker. In the case that the page-table walker is cache-coherent, we cannot rely on an implicit DSB from the DMA-mapping code, so we must ensure that we execute a DSB in our tlb_add_flush() callback prior to triggering the invalidation. Cc: <[email protected]> Cc: Robin Murphy <[email protected]> Fixes: 2df7a25 ("iommu/arm-smmu: Clean up DMA API usage") Signed-off-by: Will Deacon <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 3239667 commit 14dd2a1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/iommu/arm-smmu.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,9 @@ static void arm_smmu_tlb_inv_range_nosync(unsigned long iova, size_t size,
469469
bool stage1 = cfg->cbar != CBAR_TYPE_S2_TRANS;
470470
void __iomem *reg = ARM_SMMU_CB(smmu_domain->smmu, cfg->cbndx);
471471

472+
if (smmu_domain->smmu->features & ARM_SMMU_FEAT_COHERENT_WALK)
473+
wmb();
474+
472475
if (stage1) {
473476
reg += leaf ? ARM_SMMU_CB_S1_TLBIVAL : ARM_SMMU_CB_S1_TLBIVA;
474477

@@ -510,6 +513,9 @@ static void arm_smmu_tlb_inv_vmid_nosync(unsigned long iova, size_t size,
510513
struct arm_smmu_domain *smmu_domain = cookie;
511514
void __iomem *base = ARM_SMMU_GR0(smmu_domain->smmu);
512515

516+
if (smmu_domain->smmu->features & ARM_SMMU_FEAT_COHERENT_WALK)
517+
wmb();
518+
513519
writel_relaxed(smmu_domain->cfg.vmid, base + ARM_SMMU_GR0_TLBIVMID);
514520
}
515521

0 commit comments

Comments
 (0)