lkml.org 
[lkml]   [2021]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v11 3/3] iommu/amd: Add support for IOMMU default DMA mode build options
Date
From: Zhen Lei <thunder.leizhen@huawei.com>

The default DMA mode lazy, but allow this to be set to strict mode at
build time. It may still be overridden by the relevant boot option.

Also make IOMMU_DEFAULT_LAZY default for when AMD_IOMMU config is set.

[jpg: Rebase for relocated file]
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
---
drivers/iommu/Kconfig | 2 +-
drivers/iommu/amd/init.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index b68ec7ed23c0..6d99150050b9 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -95,7 +95,7 @@ choice
depends on IOMMU_API
depends on X86 || IA64 || X86_64 || ARM || ARM64

- default IOMMU_DEFAULT_LAZY if INTEL_IOMMU
+ default IOMMU_DEFAULT_LAZY if (AMD_IOMMU || INTEL_IOMMU)
default IOMMU_DEFAULT_STRICT
help
This option allows an IOMMU DMA mode to be chosen at build time, to
diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index d006724f4dc2..af662fc37cbe 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -160,7 +160,8 @@ u16 amd_iommu_last_bdf; /* largest PCI device id we have
to handle */
LIST_HEAD(amd_iommu_unity_map); /* a list of required unity mappings
we find in ACPI */
-bool amd_iommu_unmap_flush; /* if true, flush on every unmap */
+/* if true, flush on every unmap */
+bool amd_iommu_unmap_flush = IS_ENABLED(CONFIG_IOMMU_DEFAULT_STRICT);

LIST_HEAD(amd_iommu_list); /* list of all AMD IOMMUs in the
system */
--
2.26.2
\
 
 \ /
  Last update: 2021-06-08 15:24    [W:0.080 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site