Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b1fd3bae authored by Mitchel Humpherys's avatar Mitchel Humpherys Committed by Matt Wagantall
Browse files

iommu/arm-smmu: do TLBSYNC after TLBIALL in ATOS



We need to make sure the TLBIALL is actually done before proceeding with
the ATOS since the ATOS won't succeed if the TLB hasn't been
invalidated.  Add a TLBSYNC to ensure that it finishes.

Change-Id: I55836039d7ded5ba8889bc81ee474624e98ef491
Signed-off-by: default avatarMitchel Humpherys <mitchelh@codeaurora.org>
parent 20f21cba
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -809,6 +809,19 @@ static void arm_smmu_tlb_sync_cb(struct arm_smmu_device *smmu,
		dev_err(smmu->dev, "TLBSYNC timeout!\n");
}

static void arm_smmu_tlb_sync_cb_atomic(struct arm_smmu_device *smmu,
					int cbndx)
{
	void __iomem *base = ARM_SMMU_CB_BASE(smmu) + ARM_SMMU_CB(smmu, cbndx);
	u32 val;

	writel_relaxed(0, base + ARM_SMMU_CB_TLBSYNC);
	if (readl_poll_timeout_atomic(base + ARM_SMMU_CB_TLBSTATUS, val,
					!(val & TLBSTATUS_SACTIVE),
					20, TLB_LOOP_TIMEOUT))
		dev_err(smmu->dev, "TLBSYNC timeout!\n");
}

static void arm_smmu_tlb_inv_context(struct arm_smmu_domain *smmu_domain)
{
	struct arm_smmu_cfg *cfg = &smmu_domain->cfg;
@@ -1922,6 +1935,7 @@ static phys_addr_t arm_smmu_iova_to_phys_hard(struct iommu_domain *domain,
		if (arm_smmu_halt(smmu))
			goto err_unlock;
		writel_relaxed(0, cb_base + ARM_SMMU_CB_S1_TLBIALL);
		arm_smmu_tlb_sync_cb_atomic(smmu, cfg->cbndx);
	}

	if (smmu->version == 1) {