From: Zhen Lei <[email protected]>

The default DMA mode is 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 <[email protected]>
Signed-off-by: John Garry <[email protected]>
---
 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 03c88cee806f..50c1477a6c2e 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -94,7 +94,7 @@ choice
        prompt "IOMMU default DMA mode"
        depends on IOMMU_API
 
-       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

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to