From fcb38d703b4027800326eb1b96c11dd2a5ed5c37 Mon Sep 17 00:00:00 2001 From: Zhang Zekun Date: Mon, 20 Nov 2023 21:06:47 +0800 Subject: [PATCH] iommu/arm-smmu-v3: Add config isolations for BTM hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8I0NL ------------------------------- Add config isolation for SMMU BTM (Broadcast TLB Maintenance), because VMIDS are all shared and will be invalid all together, which might cause performance issues. Besides, If the hardware fail to invalid TLB, it can cause unexpected errors, you need to do some tests to make sure BTM work as expect. Signed-off-by: Zhang Zekun --- drivers/iommu/Kconfig | 10 ++++++++++ drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 ++ 2 files changed, 12 insertions(+) diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index b630e58c49b6..f768fbc60dd3 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -438,6 +438,16 @@ config SMMU_BYPASS_DEV This feature will be replaced by ACPI IORT RMR node, which will be upstreamed in mainline. +config SMMU_BTM_SUPPORT + bool "SMMU BTM (Broadcast TLB Maintenance) support" + depends on ARM_SMMU_V3 + help + ARM SMMU BTM feature can support for receiving broadcast TLBI + operations issued by Arm PEs in the system, which can help to + speed up the tlb invalidation speed in SVA scenarios. + + This feature need support for BTM features, if not sure, say NO. + endif # IOMMU_SUPPORT config IOVA_MAX_GLOBAL_MAGS diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c index d93ce123df49..09777b05b089 100644 --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c @@ -4954,8 +4954,10 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu) * broadcasted TLB invalidations that target EL2-E2H world. Don't enable * BTM in that case. */ +#ifdef CONFIG_SMMU_BTM_SUPPORT if (reg & IDR0_BTM && (!vhe || reg & IDR0_HYP)) smmu->features |= ARM_SMMU_FEAT_BTM; +#endif /* * The coherency feature as set by FW is used in preference to the ID -- Gitee