From be81ead7363dc3b208ac07daec83697cf1b7e8ea Mon Sep 17 00:00:00 2001 From: "Isaac J. Manjarres" Date: Wed, 4 Nov 2020 22:03:48 -0800 Subject: [PATCH] Revert "iommu/arm-smmu: Leave power resources enabled across unmap and sync ops" This reverts commit fc6d479bac4c756359388647d45f39f08d0c8534. The functionality offered by this change was not implemented correctly, so revert it in favor of a different way of addressing the issue that was supposed to be fixed. Change-Id: Id061372026dea2960758c4dad0a5e37c2604576e Signed-off-by: Isaac J. Manjarres --- arch/arm/configs/vendor/sdxlemur.config | 1 - arch/arm64/configs/vendor/holi_QGKI.config | 1 - arch/arm64/configs/vendor/lahaina_QGKI.config | 1 - drivers/iommu/Kconfig | 9 ------- drivers/iommu/arm-smmu.c | 24 ------------------- 5 files changed, 36 deletions(-) diff --git a/arch/arm/configs/vendor/sdxlemur.config b/arch/arm/configs/vendor/sdxlemur.config index 50b3261c9613..b2681de9bddd 100644 --- a/arch/arm/configs/vendor/sdxlemur.config +++ b/arch/arm/configs/vendor/sdxlemur.config @@ -22,7 +22,6 @@ CONFIG_IOMMU_IO_PGTABLE_FAST=y CONFIG_QCOM_IOMMU_IO_PGTABLE_QUIRKS=y CONFIG_IOMMU_LIMIT_IOVA_ALIGNMENT=y CONFIG_ARM_SMMU_SKIP_MAP_POWER_ON=y -CONFIG_ARM_SMMU_POWER_OFF_AFTER_UNMAP=y CONFIG_QTI_IOMMU_SUPPORT=y CONFIG_QCOM_SCM=y CONFIG_QCOM_SECURE_BUFFER=y diff --git a/arch/arm64/configs/vendor/holi_QGKI.config b/arch/arm64/configs/vendor/holi_QGKI.config index 4a0572eea2e5..9ebe6e28e4b5 100644 --- a/arch/arm64/configs/vendor/holi_QGKI.config +++ b/arch/arm64/configs/vendor/holi_QGKI.config @@ -5,7 +5,6 @@ CONFIG_QCOM_LAZY_MAPPING=y CONFIG_DEBUG_FS=y CONFIG_IOMMU_DYNAMIC_DOMAINS=y CONFIG_ARM_SMMU_SKIP_MAP_POWER_ON=y -CONFIG_ARM_SMMU_POWER_OFF_AFTER_UNMAP=y CONFIG_QCOM_SECURE_BUFFER=y # CONFIG_ZONE_DMA32 is not set CONFIG_EDAC_KRYO_ARM64=y diff --git a/arch/arm64/configs/vendor/lahaina_QGKI.config b/arch/arm64/configs/vendor/lahaina_QGKI.config index 380ff0cb4d41..2d0ac316d41d 100644 --- a/arch/arm64/configs/vendor/lahaina_QGKI.config +++ b/arch/arm64/configs/vendor/lahaina_QGKI.config @@ -13,7 +13,6 @@ CONFIG_ION_MSM_HEAPS=y CONFIG_IOMMU_IO_PGTABLE_FAST=y CONFIG_IOMMU_DYNAMIC_DOMAINS=y CONFIG_ARM_SMMU_SKIP_MAP_POWER_ON=y -CONFIG_ARM_SMMU_POWER_OFF_AFTER_UNMAP=y # CONFIG_IOMMU_IO_PGTABLE_FAST_SELFTEST is not set # CONFIG_IOMMU_IO_PGTABLE_FAST_PROVE_TLB is not set # CONFIG_SOFTLOCKUP_DETECTOR is not set diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index 09b9a9907a33..c89039fad7ff 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -548,15 +548,6 @@ config ARM_SMMU_SKIP_MAP_POWER_ON If unsure, say N here. -config ARM_SMMU_POWER_OFF_AFTER_UNMAP - bool "Remove power votes after unmapping memory" - depends on ARM_SMMU && QGKI - help - Support for ensuring that votes for power resources are removed - after memory is unmapped. This should be enabled when it is guaranteed - that there are no outstanding TLB invalidations after the memory - has been unmapped from the IOMMU page tables. - config ARM_SMMU_V3 tristate "ARM Ltd. System MMU Version 3 (SMMUv3) Support" depends on ARM64 diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index b5d675defa86..6d1a12297aad 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -3257,25 +3257,9 @@ static size_t arm_smmu_unmap(struct iommu_domain *domain, unsigned long iova, spin_lock_irqsave(&smmu_domain->cb_lock, flags); ret = ops->unmap(ops, iova, size, gather); spin_unlock_irqrestore(&smmu_domain->cb_lock, flags); - /* - * The votes for power resources can only be removed if there are no - * outstanding TLB invalidation operations. This is true when the - * downstream io-pgtable-arm optimizations are in use, as the code that - * unmaps the memory from the IOMMU page tables ensures that all TLB - * operations are complete before returning. - * - * However, the upstream io-pgtable-arm implementation allows for a TLB - * invalidation to be in progress when control is returned back here, - * and the votes for the power resources will be removed, which has been - * observed to cause problems where unmapping buffers takes a long time. - * For those scenarios, leave the votes for power resources in place, - * and rely on the subsequent sync operation to remove the votes. - */ -#ifdef CONFIG_ARM_SMMU_POWER_OFF_AFTER_UNMAP arm_smmu_rpm_put(smmu); arm_smmu_domain_power_off(domain, smmu_domain->smmu); -#endif /* * While splitting up block mappings, we might allocate page table * memory during unmap, so the vmids needs to be assigned to the @@ -3313,20 +3297,12 @@ static void arm_smmu_iotlb_sync(struct iommu_domain *domain, struct arm_smmu_device *smmu = smmu_domain->smmu; if (smmu_domain->flush_ops) { - /* - * Voting for power resources when - * CONFIG_ARM_SMMU_POWER_OFF_AFTER_UNMAP is enabled, is required - * as the unmap call has removed the votes for the power - * resources. - */ -#ifdef CONFIG_ARM_SMMU_POWER_OFF_AFTER_UNMAP arm_smmu_rpm_get(smmu); if (arm_smmu_domain_power_on(domain, smmu)) { WARN_ON(1); arm_smmu_rpm_put(smmu); return; } -#endif smmu_domain->flush_ops->tlb_sync(smmu_domain); arm_smmu_domain_power_off(domain, smmu); arm_smmu_rpm_put(smmu);