mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iommu: enable bypass transaction caching for ARM SMMU 500
@ 2017-10-11 22:08 Feng Kan
  2017-10-12 12:39 ` Robin Murphy
  0 siblings, 1 reply; 2+ messages in thread
From: Feng Kan @ 2017-10-11 22:08 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, robin.murphy, will.deacon,
	rrichter, herton
  Cc: Feng Kan

The ARM SMMU identity mapping performance was poor compared with the
DMA mode. It was found that enable caching would restore the performance
back to normal. The S2CRB_TLBEN bit in the ACR register would allow for
caching of the stream to context register bypass transaction information.

Signed-off-by: Feng Kan <fkan@apm.com>
---
 drivers/iommu/arm-smmu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index 3bdb799..b5676a8 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -59,6 +59,7 @@
 #define ARM_MMU500_ACTLR_CPRE		(1 << 1)
 
 #define ARM_MMU500_ACR_CACHE_LOCK	(1 << 26)
+#define ARM_MMU500_ACR_S2CRB_TLBEN	(1 << 10)
 #define ARM_MMU500_ACR_SMTNMB_TLBEN	(1 << 8)
 
 #define TLB_LOOP_TIMEOUT		1000000	/* 1s! */
@@ -1606,7 +1607,7 @@ static void arm_smmu_device_reset(struct arm_smmu_device *smmu)
 		 * Allow unmatched Stream IDs to allocate bypass
 		 * TLB entries for reduced latency.
 		 */
-		reg |= ARM_MMU500_ACR_SMTNMB_TLBEN;
+		reg |= ARM_MMU500_ACR_SMTNMB_TLBEN | ARM_MMU500_ACR_S2CRB_TLBEN;
 		writel_relaxed(reg, gr0_base + ARM_SMMU_GR0_sACR);
 	}
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] iommu: enable bypass transaction caching for ARM SMMU 500
  2017-10-11 22:08 [PATCH] iommu: enable bypass transaction caching for ARM SMMU 500 Feng Kan
@ 2017-10-12 12:39 ` Robin Murphy
  0 siblings, 0 replies; 2+ messages in thread
From: Robin Murphy @ 2017-10-12 12:39 UTC (permalink / raw)
  To: Feng Kan, linux-kernel, linux-arm-kernel, will.deacon, rrichter, herton

On 11/10/17 23:08, Feng Kan wrote:
> The ARM SMMU identity mapping performance was poor compared with the
> DMA mode. It was found that enable caching would restore the performance
> back to normal. The S2CRB_TLBEN bit in the ACR register would allow for
> caching of the stream to context register bypass transaction information.

I know the hardware design and reasoning behind this feature, but I'm
still a little surprised that bypass can show a measurably higher
overhead than the full DMA mapping path in practice. MMU-500 is great :D

> Signed-off-by: Feng Kan <fkan@apm.com>
> ---
>  drivers/iommu/arm-smmu.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> index 3bdb799..b5676a8 100644
> --- a/drivers/iommu/arm-smmu.c
> +++ b/drivers/iommu/arm-smmu.c
> @@ -59,6 +59,7 @@
>  #define ARM_MMU500_ACTLR_CPRE		(1 << 1)
>  
>  #define ARM_MMU500_ACR_CACHE_LOCK	(1 << 26)
> +#define ARM_MMU500_ACR_S2CRB_TLBEN	(1 << 10)
>  #define ARM_MMU500_ACR_SMTNMB_TLBEN	(1 << 8)
>  
>  #define TLB_LOOP_TIMEOUT		1000000	/* 1s! */
> @@ -1606,7 +1607,7 @@ static void arm_smmu_device_reset(struct arm_smmu_device *smmu)
>  		 * Allow unmatched Stream IDs to allocate bypass
>  		 * TLB entries for reduced latency.
>  		 */
> -		reg |= ARM_MMU500_ACR_SMTNMB_TLBEN;
> +		reg |= ARM_MMU500_ACR_SMTNMB_TLBEN | ARM_MMU500_ACR_S2CRB_TLBEN;
>  		writel_relaxed(reg, gr0_base + ARM_SMMU_GR0_sACR);
>  	}
>  

Looks correct to me, and TLB usage by bypass domains should still be
equivalent to that of translation domains, so I don't think we should
see any deleterious effects overall:

Reviewed-by: Robin Murphy <robin.murphy@arm.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-12 12:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-11 22:08 [PATCH] iommu: enable bypass transaction caching for ARM SMMU 500 Feng Kan
2017-10-12 12:39 ` Robin Murphy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®