From bf4e1bea47b194c66482567fc9c52ffe48de03e0 Mon Sep 17 00:00:00 2001 From: "Isaac J. Manjarres" Date: Wed, 19 Aug 2020 14:09:24 -0700 Subject: [PATCH] iommu/arm-smmu: Ensure power resources are enabled during tlb maintenance arm_smmu_iotlb_sync can be called outside of arm_smmu_unmap, meaning that the power resources required to access the SMMU register space may be disabled. Thus, call arm_smmu_power_[on/off] when invoking arm_smmu_iotlb_sync and arm_smmu_flush_iotlb_all. Change-Id: I9f6ec0db9b0e25a5c4bf2b0adb3fb950e6843a86 Signed-off-by: Isaac J. Manjarres --- drivers/iommu/arm-smmu.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 9e09bbe00f18..22c92fd1944a 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -3232,7 +3232,13 @@ static void arm_smmu_flush_iotlb_all(struct iommu_domain *domain) if (smmu_domain->flush_ops) { arm_smmu_rpm_get(smmu); + if (arm_smmu_domain_power_on(domain, smmu)) { + WARN_ON(1); + arm_smmu_rpm_put(smmu); + return; + } smmu_domain->flush_ops->tlb.tlb_ops.tlb_flush_all(smmu_domain); + arm_smmu_domain_power_off(domain, smmu); arm_smmu_rpm_put(smmu); } } @@ -3245,7 +3251,13 @@ static void arm_smmu_iotlb_sync(struct iommu_domain *domain, if (smmu_domain->flush_ops) { arm_smmu_rpm_get(smmu); + if (arm_smmu_domain_power_on(domain, smmu)) { + WARN_ON(1); + arm_smmu_rpm_put(smmu); + return; + } smmu_domain->flush_ops->tlb_sync(smmu_domain); + arm_smmu_domain_power_off(domain, smmu); arm_smmu_rpm_put(smmu); } }