Skip to contentSkip to conversation

Cleanup IOMMU passthrough setting (and disable IOMMU Passthrough when SME is active)

PATCH Applied Joerg Roedel 3 participants 15 messages Aug 19, 2019 – Aug 23, 2019

Subsystems (3)
lore
Share & tools
lore

Joerg Roedel

author maintainer
#0 lore raw

v3 cover Cleanup IOMMU passthrough setting (and disable IOMMU Passthrough when SME is active)

From: Joerg Roedel <[email protected]>

Hi,

This patch-set started out small to overwrite the default passthrough setting (through CONFIG_IOMMU_DEFAULT_PASSTHROUGH=y) when SME is active.

But on the way to that Tom reminded me that the current ways to configure passthrough/no-passthrough modes for IOMMU on x86 is a mess. So I added a few more patches to clean that up a bit, getting rid of the iommu_pass_through variable on the way.This information is now kept only in iommu code, with helpers to change that setting from architecture code.

And of course this patch-set still disables IOMMU Passthrough mode when SME is active even when CONFIG_IOMMU_DEFAULT_PASSTHROUGH=y is set.

The reason for that change is that SME with passthrough mode turned out to be fragile with devices requiring SWIOTLB, mainly because SWIOTLB has a maximum allocation size of 256kb and a limit overall size of the bounce buffer.

Therefore having IOMMU in translation mode by default is better when SME is active on a system.

Please review.

Thanks,

Joerg

Changes since v2:

- Added 'bool cmd_line' parameter to iommu_set_default_*() functions, so that we correctly recognize iommu=pt/nopt command line parameters

Changes since v1:

- Cleaned up the kernel command line parameters to configure passthrough/translated mode, getting rid of the global iommu_pass_through variable

Joerg Roedel (11):
iommu: Remember when default domain type was set on kernel command line
iommu: Add helpers to set/get default domain type
iommu: Use Functions to set default domain type in iommu_set_def_domain_type() iommu/amd: Request passthrough mode from IOMMU core
iommu/vt-d: Request passthrough mode from IOMMU core
x86/dma: Get rid of iommu_pass_through
ia64: Get rid of iommu_pass_through
iommu: Print default domain type on boot
iommu: Set default domain type at runtime
iommu: Disable passthrough mode when SME is active
Documentation: Update Documentation for iommu.passthrough

 Documentation/admin-guide/kernel-parameters.txt |  2 +-
 arch/ia64/include/asm/iommu.h                   |  2 -
 arch/ia64/kernel/pci-dma.c                      |  2 -
 arch/x86/include/asm/iommu.h                    |  1 -
 arch/x86/kernel/pci-dma.c                       | 20 +-----
 drivers/iommu/amd_iommu.c                       |  6 +-
 drivers/iommu/intel-iommu.c                     |  2 +-
 drivers/iommu/iommu.c                           | 93 +++++++++++++++++++++++--
 include/linux/iommu.h                           | 16 +++++
 9 files changed, 110 insertions(+), 34 deletions(-)
Signature · 1 line
2.16.4
author maintainer
#1 lore raw

PATCH v3 1/11 iommu: Remember when default domain type was set on kernel command line

From: Joerg Roedel <[email protected]>

Introduce an extensible concept to remember when certain configuration settings for the IOMMU code have been set on the kernel command line.

This will be used later to prevent overwriting these settings with other defaults.

---
 drivers/iommu/iommu.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/iommu/iommu.c +15 -0
index 0c674d80c37f..3361ca5ef769 100644
@@ -32,6 +32,7 @@ static unsigned int iommu_def_domain_type = IOMMU_DOMAIN_IDENTITY;
 static unsigned int iommu_def_domain_type = IOMMU_DOMAIN_DMA;
 #endif
 static bool iommu_dma_strict __read_mostly = true;
+static u32 iommu_cmd_line __read_mostly;
 
 struct iommu_group {
 	struct kobject kobj;
@@ -68,6 +69,18 @@ static const char * const iommu_group_resv_type_string[] = {
 	[IOMMU_RESV_SW_MSI]			= "msi",
 };
 
+#define IOMMU_CMD_LINE_DMA_API		BIT(0)
+
+static void iommu_set_cmd_line_dma_api(void)
+{
+	iommu_cmd_line |= IOMMU_CMD_LINE_DMA_API;
+}
+
+static bool __maybe_unused iommu_cmd_line_dma_api(void)
+{
+	return !!(iommu_cmd_line & IOMMU_CMD_LINE_DMA_API);
+}
+
 #define IOMMU_GROUP_ATTR(_name, _mode, _show, _store)		\
 struct iommu_group_attribute iommu_group_attr_##_name =		\
 	__ATTR(_name, _mode, _show, _store)
@@ -165,6 +178,8 @@ static int __init iommu_set_def_domain_type(char *str)
 	if (ret)
 		return ret;
 
+	iommu_set_cmd_line_dma_api();
+
 	iommu_def_domain_type = pt ? IOMMU_DOMAIN_IDENTITY : IOMMU_DOMAIN_DMA;
 	return 0;
 }
Signature · 1 line
2.16.4
author maintainer
#2 lore raw

PATCH v3 2/11 iommu: Add helpers to set/get default domain type

In reply to Joerg Roedel

From: Joerg Roedel <[email protected]>

Add a couple of functions to allow changing the default domain type from architecture code and a function for iommu drivers to request whether the default domain is passthrough.

---
 drivers/iommu/iommu.c | 22 ++++++++++++++++++++++
 include/linux/iommu.h | 16 ++++++++++++++++
 2 files changed, 38 insertions(+)
drivers/iommu/iommu.c +22 -0
index 3361ca5ef769..84acd47936ac 100644
@@ -2211,6 +2211,28 @@ int iommu_request_dma_domain_for_dev(struct device *dev)
 	return request_default_domain_for_dev(dev, IOMMU_DOMAIN_DMA);
 }
 
+void iommu_set_default_passthrough(bool cmd_line)
+{
+	if (cmd_line)
+		iommu_set_cmd_line_dma_api();
+
+	iommu_def_domain_type = IOMMU_DOMAIN_IDENTITY;
+}
+
+void iommu_set_default_translated(bool cmd_line)
+{
+	if (cmd_line)
+		iommu_set_cmd_line_dma_api();
+
+	iommu_def_domain_type = IOMMU_DOMAIN_DMA;
+}
+
+bool iommu_default_passthrough(void)
+{
+	return iommu_def_domain_type = IOMMU_DOMAIN_IDENTITY;
+}
+EXPORT_SYMBOL_GPL(iommu_default_passthrough);
+
 const struct iommu_ops *iommu_ops_from_fwnode(struct fwnode_handle *fwnode)
 {
 	const struct iommu_ops *ops = NULL;
include/linux/iommu.h +16 -0
index fdc355ccc570..4955498204a9 100644
@@ -413,6 +413,9 @@ extern void iommu_get_resv_regions(struct device *dev, struct list_head *list);
 extern void iommu_put_resv_regions(struct device *dev, struct list_head *list);
 extern int iommu_request_dm_for_dev(struct device *dev);
 extern int iommu_request_dma_domain_for_dev(struct device *dev);
+extern void iommu_set_default_passthrough(bool cmd_line);
+extern void iommu_set_default_translated(bool cmd_line);
+extern bool iommu_default_passthrough(void);
 extern struct iommu_resv_region *
 iommu_alloc_resv_region(phys_addr_t start, size_t length, int prot,
 			enum iommu_resv_type type);
@@ -694,6 +697,19 @@ static inline int iommu_request_dma_domain_for_dev(struct device *dev)
 	return -ENODEV;
 }
 
+static inline void iommu_set_default_passthrough(bool cmd_line)
+{
+}
+
+static inline void iommu_set_default_translated(bool cmd_line)
+{
+}
+
+static inline bool iommu_default_passthrough(void)
+{
+	return true;
+}
+
 static inline int iommu_attach_group(struct iommu_domain *domain,
 				     struct iommu_group *group)
 {
Signature · 1 line
2.16.4
author maintainer
#3 lore raw

PATCH v3 3/11 iommu: Use Functions to set default domain type in iommu_set_def_domain_type()

In reply to Joerg Roedel

From: Joerg Roedel <[email protected]>

There are functions now to set the default domain type which take care of updating other necessary state. Don't open-code it in iommu_set_def_domain_type() and use those functions instead.

---
 drivers/iommu/iommu.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/iommu/iommu.c +4 -2
index 84acd47936ac..3ee50bb22ca2 100644
@@ -178,9 +178,11 @@ static int __init iommu_set_def_domain_type(char *str)
 	if (ret)
 		return ret;
 
-	iommu_set_cmd_line_dma_api();
+	if (pt)
+		iommu_set_default_passthrough(true);
+	else
+		iommu_set_default_translated(true);
 
-	iommu_def_domain_type = pt ? IOMMU_DOMAIN_IDENTITY : IOMMU_DOMAIN_DMA;
 	return 0;
 }
 early_param("iommu.passthrough", iommu_set_def_domain_type);
Signature · 1 line
2.16.4
author maintainer
#4 lore raw

PATCH v3 4/11 iommu/amd: Request passthrough mode from IOMMU core

In reply to Joerg Roedel

From: Joerg Roedel <[email protected]>

Get rid of the iommu_pass_through variable and request passthrough mode via the new iommu core function.

---
 drivers/iommu/amd_iommu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iommu/amd_iommu.c +3 -3
index b607a92791d3..7434b34d7a94 100644
@@ -436,7 +436,7 @@ static int iommu_init_device(struct device *dev)
 	 * invalid address), we ignore the capability for the device so
 	 * it'll be forced to go into translation mode.
 	 */
-	if ((iommu_pass_through || !amd_iommu_force_isolation) &&
+	if ((iommu_default_passthrough() || !amd_iommu_force_isolation) &&
 	    dev_is_pci(dev) && pci_iommuv2_capable(to_pci_dev(dev))) {
 		struct amd_iommu *iommu;
 
@@ -2226,7 +2226,7 @@ static int amd_iommu_add_device(struct device *dev)
 
 	BUG_ON(!dev_data);
 
-	if (iommu_pass_through || dev_data->iommu_v2)
+	if (dev_data->iommu_v2)
 		iommu_request_dm_for_dev(dev);
 
 	/* Domains are initialized for this device - have a look what we ended up with */
@@ -2805,7 +2805,7 @@ int __init amd_iommu_init_api(void)
 
 int __init amd_iommu_init_dma_ops(void)
 {
-	swiotlb        = (iommu_pass_through || sme_me_mask) ? 1 : 0;
+	swiotlb        = (iommu_default_passthrough() || sme_me_mask) ? 1 : 0;
 	iommu_detected = 1;
 
 	if (amd_iommu_unmap_flush)
Signature · 1 line
2.16.4
author maintainer
#5 lore raw

PATCH v3 5/11 iommu/vt-d: Request passthrough mode from IOMMU core

In reply to Joerg Roedel

From: Joerg Roedel <[email protected]>

Get rid of the iommu_pass_through variable and request passthrough mode via the new iommu core function.

---
 drivers/iommu/intel-iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel-iommu.c +1 -1
index 12d094d08c0a..a66c2a1bbbe3 100644
@@ -3267,7 +3267,7 @@ static int __init init_dmars(void)
 		iommu->flush.flush_iotlb(iommu, 0, 0, 0, DMA_TLB_GLOBAL_FLUSH);
 	}
 
-	if (iommu_pass_through)
+	if (iommu_default_passthrough())
 		iommu_identity_mapping |= IDENTMAP_ALL;
 
 #ifdef CONFIG_INTEL_IOMMU_BROKEN_GFX_WA
Signature · 1 line
2.16.4
author maintainer
#6 lore raw

PATCH v3 6/11 x86/dma: Get rid of iommu_pass_through

In reply to Joerg Roedel

From: Joerg Roedel <[email protected]>

This variable has no users anymore. Remove it and tell the IOMMU code via its new functions about requested DMA modes.

---
 arch/x86/include/asm/iommu.h |  1 -
 arch/x86/kernel/pci-dma.c    | 20 +++-----------------
 2 files changed, 3 insertions(+), 18 deletions(-)
arch/x86/include/asm/iommu.h +0 -1
index baedab8ac538..b91623d521d9 100644
@@ -4,7 +4,6 @@
 
 extern int force_iommu, no_iommu;
 extern int iommu_detected;
-extern int iommu_pass_through;
 
 /* 10 seconds */
 #define DMAR_OPERATION_TIMEOUT ((cycles_t) tsc_khz*10*1000)
arch/x86/kernel/pci-dma.c +3 -17
index f62b498b18fb..fa4352dce491 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/dma-direct.h>
 #include <linux/dma-debug.h>
+#include <linux/iommu.h>
 #include <linux/dmar.h>
 #include <linux/export.h>
 #include <linux/memblock.h>
@@ -34,21 +35,6 @@ int no_iommu __read_mostly;
 /* Set this to 1 if there is a HW IOMMU in the system */
 int iommu_detected __read_mostly = 0;
 
-/*
- * This variable becomes 1 if iommu=pt is passed on the kernel command line.
- * If this variable is 1, IOMMU implementations do no DMA translation for
- * devices and allow every device to access to whole physical memory. This is
- * useful if a user wants to use an IOMMU only for KVM device assignment to
- * guests and not for driver dma translation.
- * It is also possible to disable by default in kernel config, and enable with
- * iommu=nopt at boot time.
- */
-#ifdef CONFIG_IOMMU_DEFAULT_PASSTHROUGH
-int iommu_pass_through __read_mostly = 1;
-#else
-int iommu_pass_through __read_mostly;
-#endif
-
 extern struct iommu_table_entry __iommu_table[], __iommu_table_end[];
 
 void __init pci_iommu_alloc(void)
@@ -120,9 +106,9 @@ static __init int iommu_setup(char *p)
 			swiotlb = 1;
 #endif
 		if (!strncmp(p, "pt", 2))
-			iommu_pass_through = 1;
+			iommu_set_default_passthrough(true);
 		if (!strncmp(p, "nopt", 4))
-			iommu_pass_through = 0;
+			iommu_set_default_translated(true);
 
 		gart_parse_options(p);
 
Signature · 1 line
2.16.4
maintainer Reviewed-by on v3 6/11
#7 lore raw

Re: [PATCH 06/11] x86/dma: Get rid of iommu_pass_through

Quoted 60 lines · Joerg Roedel

From: Joerg Roedel <[email protected]>

This variable has no users anymore. Remove it and tell the IOMMU code via its new functions about requested DMA modes.

---
 arch/x86/include/asm/iommu.h |  1 -
 arch/x86/kernel/pci-dma.c    | 20 +++-----------------
 2 files changed, 3 insertions(+), 18 deletions(-)
arch/x86/include/asm/iommu.h +0 -1
index baedab8ac538..b91623d521d9 100644
@@ -4,7 +4,6 @@
 
 extern int force_iommu, no_iommu;
 extern int iommu_detected;
-extern int iommu_pass_through;
 
 /* 10 seconds */
 #define DMAR_OPERATION_TIMEOUT ((cycles_t) tsc_khz*10*1000)
arch/x86/kernel/pci-dma.c +1 -15
index f62b498b18fb..fa4352dce491 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/dma-direct.h>
 #include <linux/dma-debug.h>
+#include <linux/iommu.h>
 #include <linux/dmar.h>
 #include <linux/export.h>
 #include <linux/memblock.h>
@@ -34,21 +35,6 @@ int no_iommu __read_mostly;
 /* Set this to 1 if there is a HW IOMMU in the system */
 int iommu_detected __read_mostly = 0;
 
-/*
- * This variable becomes 1 if iommu=pt is passed on the kernel command line.
- * If this variable is 1, IOMMU implementations do no DMA translation for
- * devices and allow every device to access to whole physical memory. This is
- * useful if a user wants to use an IOMMU only for KVM device assignment to
- * guests and not for driver dma translation.
- * It is also possible to disable by default in kernel config, and enable with
- * iommu=nopt at boot time.
- */
-#ifdef CONFIG_IOMMU_DEFAULT_PASSTHROUGH
-int iommu_pass_through __read_mostly = 1;
-#else
-int iommu_pass_through __read_mostly;
-#endif
-
 extern struct iommu_table_entry __iommu_table[], __iommu_table_end[];
 
 void __init pci_iommu_alloc(void)
@@ -120,9 +106,9 @@ static __init int iommu_setup(char *p)
 			swiotlb = 1;

arch/x86/kernel/pci-dma.c static __init int iommu_setup(char *p) · line 114

Quoted 10 lines
arch/x86/kernel/pci-dma.c +2 -2
 #endif
 		if (!strncmp(p, "pt", 2))
-			iommu_pass_through = 1;
+			iommu_set_default_passthrough(true);
 		if (!strncmp(p, "nopt", 4))
-			iommu_pass_through = 0;
+			iommu_set_default_translated(true);
 
 		gart_parse_options(p);
 
Signature · 4 lines
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.
author maintainer
#8 lore raw

PATCH v3 7/11 ia64: Get rid of iommu_pass_through

In reply to Joerg Roedel

From: Joerg Roedel <[email protected]>

This variable has no users anymore so it can be removed.

---
 arch/ia64/include/asm/iommu.h | 2 --
 arch/ia64/kernel/pci-dma.c    | 2 --
 2 files changed, 4 deletions(-)
arch/ia64/include/asm/iommu.h +0 -2
index 7429a72f3f92..92aceef63710 100644
@@ -8,10 +8,8 @@
 extern void no_iommu_init(void);
 #ifdef	CONFIG_INTEL_IOMMU
 extern int force_iommu, no_iommu;
-extern int iommu_pass_through;
 extern int iommu_detected;
 #else
-#define iommu_pass_through	(0)
 #define no_iommu		(1)
 #define iommu_detected		(0)
 #endif
arch/ia64/kernel/pci-dma.c +0 -2
index fe988c49f01c..f5d49cd3fbb0 100644
@@ -22,8 +22,6 @@ int force_iommu __read_mostly = 1;
 int force_iommu __read_mostly;
 #endif
 
-int iommu_pass_through;
-
 static int __init pci_iommu_init(void)
 {
 	if (iommu_detected)
Signature · 1 line
2.16.4
author maintainer
#9 lore raw

PATCH v3 8/11 iommu: Print default domain type on boot

In reply to Joerg Roedel

From: Joerg Roedel <[email protected]>

Introduce a subsys_initcall for IOMMU code and use it to print the default domain type at boot.

---
 drivers/iommu/iommu.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)
drivers/iommu/iommu.c +29 -1
index 3ee50bb22ca2..0ddd0bd1ff75 100644
@@ -93,12 +93,40 @@ struct iommu_group_attribute iommu_group_attr_##_name =		\
 static LIST_HEAD(iommu_device_list);
 static DEFINE_SPINLOCK(iommu_device_lock);
 
+/*
+ * Use a function instead of an array here because the domain-type is a
+ * bit-field, so an array would waste memory.
+ */
+static const char *iommu_domain_type_str(unsigned int t)
+{
+	switch (t) {
+	case IOMMU_DOMAIN_BLOCKED:
+		return "Blocked";
+	case IOMMU_DOMAIN_IDENTITY:
+		return "Passthrough";
+	case IOMMU_DOMAIN_UNMANAGED:
+		return "Unmanaged";
+	case IOMMU_DOMAIN_DMA:
+		return "Translated";
+	default:
+		return "Unknown";
+	}
+}
+
+static int __init iommu_subsys_init(void)
+{
+	pr_info("Default domain type: %s\n",
+		iommu_domain_type_str(iommu_def_domain_type));
+
+	return 0;
+}
+subsys_initcall(iommu_subsys_init);
+
 int iommu_device_register(struct iommu_device *iommu)
 {
 	spin_lock(&iommu_device_lock);
 	list_add_tail(&iommu->list, &iommu_device_list);
 	spin_unlock(&iommu_device_lock);
-
 	return 0;
 }
 
Signature · 1 line
2.16.4
author maintainer
#10 lore raw

PATCH v3 9/11 iommu: Set default domain type at runtime

In reply to Joerg Roedel

From: Joerg Roedel <[email protected]>

Set the default domain-type at runtime, not at compile-time. This keeps default domain type setting in one place when we have to change it at runtime.

---
 drivers/iommu/iommu.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)
drivers/iommu/iommu.c +15 -8
index 0ddd0bd1ff75..01759d4ac70b 100644
@@ -26,11 +26,8 @@
 
 static struct kset *iommu_group_kset;
 static DEFINE_IDA(iommu_group_ida);
-#ifdef CONFIG_IOMMU_DEFAULT_PASSTHROUGH
-static unsigned int iommu_def_domain_type = IOMMU_DOMAIN_IDENTITY;
-#else
-static unsigned int iommu_def_domain_type = IOMMU_DOMAIN_DMA;
-#endif
+
+static unsigned int iommu_def_domain_type __read_mostly;
 static bool iommu_dma_strict __read_mostly = true;
 static u32 iommu_cmd_line __read_mostly;
 
@@ -76,7 +73,7 @@ static void iommu_set_cmd_line_dma_api(void)
 	iommu_cmd_line |= IOMMU_CMD_LINE_DMA_API;
 }
 
-static bool __maybe_unused iommu_cmd_line_dma_api(void)
+static bool iommu_cmd_line_dma_api(void)
 {
 	return !!(iommu_cmd_line & IOMMU_CMD_LINE_DMA_API);
 }
@@ -115,8 +112,18 @@ static const char *iommu_domain_type_str(unsigned int t)
 
 static int __init iommu_subsys_init(void)
 {
-	pr_info("Default domain type: %s\n",
-		iommu_domain_type_str(iommu_def_domain_type));
+	bool cmd_line = iommu_cmd_line_dma_api();
+
+	if (!cmd_line) {
+		if (IS_ENABLED(CONFIG_IOMMU_DEFAULT_PASSTHROUGH))
+			iommu_set_default_passthrough(false);
+		else
+			iommu_set_default_translated(false);
+	}
+
+	pr_info("Default domain type: %s %s\n",
+		iommu_domain_type_str(iommu_def_domain_type),
+		cmd_line ? "(set via kernel command line)" : "");
 
 	return 0;
 }
Signature · 1 line
2.16.4
author maintainer
#11 lore raw

PATCH v3 10/11 iommu: Disable passthrough mode when SME is active

In reply to Joerg Roedel

From: Joerg Roedel <[email protected]>

Using Passthrough mode when SME is active causes certain devices to use the SWIOTLB bounce buffer. The bounce buffer code has an upper limit of 256kb for the size of DMA allocations, which is too small for certain devices and causes them to fail.

With this patch we enable IOMMU by default when SME is active in the system, making the default configuration work for more systems than it does now.

Users that don't want IOMMUs to be enabled still can disable them with kernel parameters.

---
 drivers/iommu/iommu.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/iommu/iommu.c +5 -0
index 01759d4ac70b..ec18c9630e93 100644
@@ -119,6 +119,11 @@ static int __init iommu_subsys_init(void)
 			iommu_set_default_passthrough(false);
 		else
 			iommu_set_default_translated(false);
+
+		if (iommu_default_passthrough() && sme_active()) {
+			pr_info("SME detected - Disabling default IOMMU Passthrough\n");
+			iommu_set_default_translated(false);
+		}
 	}
 
 	pr_info("Default domain type: %s %s\n",
Signature · 1 line
2.16.4
Reviewed-by Tested-by on v3 10/11
#12 lore raw

Re: [PATCH 10/11] iommu: Disable passthrough mode when SME is active

T24gOC8xOS8xOSA4OjIyIEFNLCBKb2VyZyBSb2VkZWwgd3JvdGU6DQo+IEZyb206IEpvZXJnIFJv ZWRlbCA8anJvZWRlbEBzdXNlLmRlPg0KPiANCj4gVXNpbmcgUGFzc3Rocm91Z2ggbW9kZSB3aGVu IFNNRSBpcyBhY3RpdmUgY2F1c2VzIGNlcnRhaW4NCj4gZGV2aWNlcyB0byB1c2UgdGhlIFNXSU9U TEIgYm91bmNlIGJ1ZmZlci4gVGhlIGJvdW5jZSBidWZmZXINCj4gY29kZSBoYXMgYW4gdXBwZXIg bGltaXQgb2YgMjU2a2IgZm9yIHRoZSBzaXplIG9mIERNQQ0KPiBhbGxvY2F0aW9ucywgd2hpY2gg aXMgdG9vIHNtYWxsIGZvciBjZXJ0YWluIGRldmljZXMgYW5kDQo+IGNhdXNlcyB0aGVtIHRvIGZh aWwuDQo+IA0KPiBXaXRoIHRoaXMgcGF0Y2ggd2UgZW5hYmxlIElPTU1VIGJ5IGRlZmF1bHQgd2hl biBTTUUgaXMNCj4gYWN0aXZlIGluIHRoZSBzeXN0ZW0sIG1ha2luZyB0aGUgZGVmYXVsdCBjb25m aWd1cmF0aW9uIHdvcmsNCj4gZm9yIG1vcmUgc3lzdGVtcyB0aGFuIGl0IGRvZXMgbm93Lg0KPiAN Cj4gVXNlcnMgdGhhdCBkb24ndCB3YW50IElPTU1VcyB0byBiZSBlbmFibGVkIHN0aWxsIGNhbiBk aXNhYmxlDQo+IHRoZW0gd2l0aCBrZXJuZWwgcGFyYW1ldGVycy4NCj4gDQo+IFNpZ25lZC1vZmYt Ynk6IEpvZXJnIFJvZWRlbCA8anJvZWRlbEBzdXNlLmRlPg0KDQpSZXZpZXdlZC1ieTogVG9tIExl bmRhY2t5IDx0aG9tYXMubGVuZGFja3lAYW1kLmNvbT4NClRlc3RlZC1ieTogVG9tIExlbmRhY2t5 IDx0aG9tYXMubGVuZGFja3lAYW1kLmNvbT4NCg0KPiAtLS0NCj4gIGRyaXZlcnMvaW9tbXUvaW9t bXUuYyB8IDUgKysrKysNCj4gIDEgZmlsZSBjaGFuZ2VkLCA1IGluc2VydGlvbnMoKykNCj4gDQo+ IGRpZmYgLS1naXQgYS9kcml2ZXJzL2lvbW11L2lvbW11LmMgYi9kcml2ZXJzL2lvbW11L2lvbW11 LmMNCj4gaW5kZXggMDE3NTlkNGFjNzBiLi5lYzE4Yzk2MzBlOTMgMTAwNjQ0DQo+IC0tLSBhL2Ry aXZlcnMvaW9tbXUvaW9tbXUuYw0KPiArKysgYi9kcml2ZXJzL2lvbW11L2lvbW11LmMNCj4gQEAg LTExOSw2ICsxMTksMTEgQEAgc3RhdGljIGludCBfX2luaXQgaW9tbXVfc3Vic3lzX2luaXQodm9p ZCkNCj4gIAkJCWlvbW11X3NldF9kZWZhdWx0X3Bhc3N0aHJvdWdoKGZhbHNlKTsNCj4gIAkJZWxz ZQ0KPiAgCQkJaW9tbXVfc2V0X2RlZmF1bHRfdHJhbnNsYXRlZChmYWxzZSk7DQo+ICsNCj4gKwkJ aWYgKGlvbW11X2RlZmF1bHRfcGFzc3Rocm91Z2goKSAmJiBzbWVfYWN0aXZlKCkpIHsNCj4gKwkJ CXByX2luZm8oIlNNRSBkZXRlY3RlZCAtIERpc2FibGluZyBkZWZhdWx0IElPTU1VIFBhc3N0aHJv dWdoXG4iKTsNCj4gKwkJCWlvbW11X3NldF9kZWZhdWx0X3RyYW5zbGF0ZWQoZmFsc2UpOw0KPiAr CQl9DQo+ICAJfQ0KPiAgDQo+ICAJcHJfaW5mbygiRGVmYXVsdCBkb21haW4gdHlwZTogJXMgJXNc biIsDQo+IA0K

author maintainer
#13 lore raw

PATCH v3 11/11 Documentation: Update Documentation for iommu.passthrough

In reply to Joerg Roedel

From: Joerg Roedel <[email protected]>

This kernel parameter now takes also effect on X86.

---
 Documentation/admin-guide/kernel-parameters.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/admin-guide/kernel-parameters.txt +1 -0
index 47d981a86e2f..2d5dfa46e88a 100644
@@ -1811,7 +1811,7 @@
 			  synchronously.
 
 	iommu.passthrough-			[ARM64] Configure DMA to bypass the IOMMU by default.
+			[ARM64, X86] Configure DMA to bypass the IOMMU by default.
 			Format: { "0" | "1" }
 			0 - Use IOMMU translation for DMA.
 			1 - Bypass the IOMMU for DMA.
Signature · 1 line
2.16.4
author maintainer Applied
#14 lore raw
In reply to Joerg Roedel
Quoted 13 lines · Joerg Roedel

Joerg Roedel (11):
iommu: Remember when default domain type was set on kernel command line
iommu: Add helpers to set/get default domain type
iommu: Use Functions to set default domain type in iommu_set_def_domain_type() iommu/amd: Request passthrough mode from IOMMU core
iommu/vt-d: Request passthrough mode from IOMMU core
x86/dma: Get rid of iommu_pass_through
ia64: Get rid of iommu_pass_through
iommu: Print default domain type on boot
iommu: Set default domain type at runtime
iommu: Disable passthrough mode when SME is active
Documentation: Update Documentation for iommu.passthrough

Quoted 10 lines
 Documentation/admin-guide/kernel-parameters.txt |  2 +-
 arch/ia64/include/asm/iommu.h                   |  2 -
 arch/ia64/kernel/pci-dma.c                      |  2 -
 arch/x86/include/asm/iommu.h                    |  1 -
 arch/x86/kernel/pci-dma.c                       | 20 +-----
 drivers/iommu/amd_iommu.c                       |  6 +-
 drivers/iommu/intel-iommu.c                     |  2 +-
 drivers/iommu/iommu.c                           | 93 +++++++++++++++++++++++--
 include/linux/iommu.h                           | 16 +++++
 9 files changed, 110 insertions(+), 34 deletions(-)

Applied.