Blob Blame History Raw
From 4742af12c6eca2715c96d4ba8064ff7f96db465b Mon Sep 17 00:00:00 2001
From: Robert Richter <rrichter@cavium.com>
Date: Thu, 4 May 2017 17:48:48 +0200
Subject: [PATCH] iommu, aarch64: Set bypass mode per default

Patch-mainline: Never, Features missing for proper fix
References: bsc#1039147

On 5/4/17 12:14 PM, Joerg Roedel wrote:
> Okay, so if this would be an upstream discussion I would just ask to fix
> the performance problems. But we are talking about SLE12-SP3 here, so
> I think we should made the bypass-mode the default for ARM-SMMU systems
> for the following reasons:
>
> 	1) The code suffers from the same scalability problems as the
> 	   AMD and Intel drivers did 2 years ago. For them it is fixed
> 	   now but we are not there for ARM yet.
>
> 	2) Since ARM systems usually have a pretty high core-count, the
> 	   scalability issues are even worse than on x86.
>
> 	3) The foundations to fix this are in the code, like the per-cpu
> 	   iova caches. But the ARM dma-implemention does not make use
> 	   of them yet, and other important things are still missing,
> 	   like lock-less page-table updates and defered iova-flushing.
>
> 	4) If we enable the SMMU in non-bypass mode we probably get a
> 	   serious competitive disadvantage against our competitors on
> 	   ARM platforms.

We see a performance degradation if smmu is enabled in non-bypass mode.
This is a problem in the kernel's implememntation. Until that is solved,
enable smmu in bypass mode per default.

We have tested that SMMU passthrough mode doesn't effect VFIO on both
CN88xx and CN99xx and haven't found any issues.

Signed-off-by: Robert Richter <rrichter@cavium.com>
Acked-by: Joerg Roedel <jroedel@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@suse.com>
---
 drivers/iommu/iommu.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 18f0dc788ef9..ea79efcee92a 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -37,7 +37,12 @@
 static struct kset *iommu_group_kset;
 static struct ida iommu_group_ida;
 static struct mutex iommu_group_mutex;
+
+#ifdef CONFIG_ARM64
+static unsigned int iommu_def_domain_type = IOMMU_DOMAIN_IDENTITY;
+#else
 static unsigned int iommu_def_domain_type = IOMMU_DOMAIN_DMA;
+#endif
 
 struct iommu_callback_data {
 	const struct iommu_ops *ops;
-- 
2.11.0