Skip to contentSkip to conversation

iommu: arm-smmu: Set SMTNMB_TLBEN in ACR to enable caching of bypass entries

PATCH New Nipun Gupta 2 participants 3 messages Nov 3, 2016 – Nov 4, 2016 IOMMU

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 iommu: arm-smmu: Set SMTNMB_TLBEN in ACR to enable caching of bypass entries

In reply to Nipun Gupta
Quoted 9 lines

-----Original Message-----
From: Nipun Gupta [mailto:nipun.gupta at nxp.com]
Sent: Thursday, November 03, 2016 7:27 PM
To: robin.murphy at arm.com; will.deacon at arm.com; linux-arm-kernel at lists.infradead.org; iommu at lists.linux- foundation.org
Cc: Stuart Yoder <[email protected]>; Nipun Gupta <[email protected]>
Subject: [PATCH] iommu: arm-smmu: Set SMTNMB_TLBEN in ACR to enable caching of bypass entries

When you respin a patch, put the version number in the patch subject:

[PATCH v2] iommu: arm-smmu: Set SMTNMB_TLBEN in ACR to enable caching of bypass entries

Stuart

#0 lore raw

PATCH 1/1 iommu: arm-smmu: Set SMTNMB_TLBEN in ACR to enable caching of bypass entries

The SMTNMB_TLBEN in the Auxiliary Configuration Register (ACR) provides an option to enable the updation of TLB in case of bypass transactions due to no stream match in the stream match table. This reduces the latencies of the subsequent transactions with the same stream-id which bypasses the SMMU. This provides a significant performance benefit for certain networking workloads.

With this change substantial performance improvement of ~9% is observed with DPDK l3fwd application (http://dpdk.org/doc/guides/sample_app_ug/l3_forward.html)
on NXP's LS2088a platform.

---
Changes for v2:
- Incorporated Robin's comments on v1 related to
Setting SMTNMB_TLBEN in ACR only for MMU-500 as ACR is implementation dependent Code comments and Naming convention

 drivers/iommu/arm-smmu.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)
drivers/iommu/arm-smmu.c +16 -9
index ce2a9d4..05901be 100644
@@ -247,6 +247,7 @@ enum arm_smmu_s2cr_privcfg {
 #define ARM_MMU500_ACTLR_CPRE		(1 << 1)
 
 #define ARM_MMU500_ACR_CACHE_LOCK	(1 << 26)
+#define ARM_MMU500_ACR_SMTNMB_TLBEN	(1 << 8)
 
 #define CB_PAR_F			(1 << 0)
 
@@ -1569,16 +1570,22 @@ static void arm_smmu_device_reset(struct arm_smmu_device *smmu)
 	for (i = 0; i < smmu->num_mapping_groups; ++i)
 		arm_smmu_write_sme(smmu, i);
 
-	/*
-	 * Before clearing ARM_MMU500_ACTLR_CPRE, need to
-	 * clear CACHE_LOCK bit of ACR first. And, CACHE_LOCK
-	 * bit is only present in MMU-500r2 onwards.
-	 */
-	reg = readl_relaxed(gr0_base + ARM_SMMU_GR0_ID7);
-	major = (reg >> ID7_MAJOR_SHIFT) & ID7_MAJOR_MASK;
-	if ((smmu->model == ARM_MMU500) && (major >= 2)) {
+	if (smmu->model == ARM_MMU500) {
+		/*
+		 * Before clearing ARM_MMU500_ACTLR_CPRE, need to
+		 * clear CACHE_LOCK bit of ACR first. And, CACHE_LOCK
+		 * bit is only present in MMU-500r2 onwards.
+		 */
+		reg = readl_relaxed(gr0_base + ARM_SMMU_GR0_ID7);
+		major = (reg >> ID7_MAJOR_SHIFT) & ID7_MAJOR_MASK;
 		reg = readl_relaxed(gr0_base + ARM_SMMU_GR0_sACR);
-		reg &= ~ARM_MMU500_ACR_CACHE_LOCK;
+		if (major >= 2)
+			reg &= ~ARM_MMU500_ACR_CACHE_LOCK;
+		/*
+		 * Allow unmatched Stream IDs to allocate bypass
+		 * TLB entries for reduced latency.
+		 */
+		reg |= ARM_MMU500_ACR_SMTNMB_TLBEN;
 		writel_relaxed(reg, gr0_base + ARM_SMMU_GR0_sACR);
 	}
 
Signature · 1 line
1.9.1
#2 lore raw

PATCH 1/1 iommu: arm-smmu: Set SMTNMB_TLBEN in ACR to enable caching of bypass entries

In reply to Stuart Yoder
Quoted 25 lines

-----Original Message-----
From: Stuart Yoder
Sent: Friday, November 04, 2016 2:27
To: Nipun Gupta <[email protected]>; robin.murphy at arm.com; will.deacon at arm.com; linux-arm-kernel at lists.infradead.org; iommu at lists.linux-foundation.org
Cc: Nipun Gupta <[email protected]>
Subject: RE: [PATCH] iommu: arm-smmu: Set SMTNMB_TLBEN in ACR to enable caching of bypass entries

Quoted 10 lines

-----Original Message-----
From: Nipun Gupta [mailto:nipun.gupta at nxp.com]
Sent: Thursday, November 03, 2016 7:27 PM
To: robin.murphy at arm.com; will.deacon at arm.com; linux-arm-kernel at lists.infradead.org; iommu at lists.linux- foundation.org
Cc: Stuart Yoder <[email protected]>; Nipun Gupta <[email protected]>
Subject: [PATCH] iommu: arm-smmu: Set SMTNMB_TLBEN in ACR to enable caching of bypass entries

Quoted 4 lines

When you respin a patch, put the version number in the patch subject:

[PATCH v2] iommu: arm-smmu: Set SMTNMB_TLBEN in ACR to enable caching
of bypass entries

I added that first, but in the last moment used git format-patch after minor updates and somehow missed it in the final patch :/. Re-spinning v3 with correct version number.

Thanks,
Nipun

Quoted 2 lines

Stuart