Merge tag 'iommu-updates-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / drivers / iommu / Kconfig
index f61516c..8ad8618 100644 (file)
@@ -79,16 +79,57 @@ config IOMMU_DEBUGFS
          debug/iommu directory, and then populate a subdirectory with
          entries as required.
 
-config IOMMU_DEFAULT_PASSTHROUGH
-       bool "IOMMU passthrough by default"
+choice
+       prompt "IOMMU default domain type"
        depends on IOMMU_API
+       default IOMMU_DEFAULT_DMA_LAZY if AMD_IOMMU || INTEL_IOMMU
+       default IOMMU_DEFAULT_DMA_STRICT
        help
-         Enable passthrough by default, removing the need to pass in
-         iommu.passthrough=on or iommu=pt through command line. If this
-         is enabled, you can still disable with iommu.passthrough=off
-         or iommu=nopt depending on the architecture.
+         Choose the type of IOMMU domain used to manage DMA API usage by
+         device drivers. The options here typically represent different
+         levels of tradeoff between robustness/security and performance,
+         depending on the IOMMU driver. Not all IOMMUs support all options.
+         This choice can be overridden at boot via the command line, and for
+         some devices also at runtime via sysfs.
 
-         If unsure, say N here.
+         If unsure, keep the default.
+
+config IOMMU_DEFAULT_DMA_STRICT
+       bool "Translated - Strict"
+       help
+         Trusted devices use translation to restrict their access to only
+         DMA-mapped pages, with strict TLB invalidation on unmap. Equivalent
+         to passing "iommu.passthrough=0 iommu.strict=1" on the command line.
+
+         Untrusted devices always use this mode, with an additional layer of
+         bounce-buffering such that they cannot gain access to any unrelated
+         data within a mapped page.
+
+config IOMMU_DEFAULT_DMA_LAZY
+       bool "Translated - Lazy"
+       help
+         Trusted devices use translation to restrict their access to only
+         DMA-mapped pages, but with "lazy" batched TLB invalidation. This
+         mode allows higher performance with some IOMMUs due to reduced TLB
+         flushing, but at the cost of reduced isolation since devices may be
+         able to access memory for some time after it has been unmapped.
+         Equivalent to passing "iommu.passthrough=0 iommu.strict=0" on the
+         command line.
+
+         If this mode is not supported by the IOMMU driver, the effective
+         runtime default will fall back to IOMMU_DEFAULT_DMA_STRICT.
+
+config IOMMU_DEFAULT_PASSTHROUGH
+       bool "Passthrough"
+       help
+         Trusted devices are identity-mapped, giving them unrestricted access
+         to memory with minimal performance overhead. Equivalent to passing
+         "iommu.passthrough=1" (historically "iommu=pt") on the command line.
+
+         If this mode is not supported by the IOMMU driver, the effective
+         runtime default will fall back to IOMMU_DEFAULT_DMA_STRICT.
+
+endchoice
 
 config OF_IOMMU
        def_bool y
@@ -249,6 +290,20 @@ config SPAPR_TCE_IOMMU
          Enables bits of IOMMU API required by VFIO. The iommu_ops
          is not implemented as it is not necessary for VFIO.
 
+config APPLE_DART
+       tristate "Apple DART IOMMU Support"
+       depends on ARCH_APPLE || (COMPILE_TEST && !GENERIC_ATOMIC64)
+       select IOMMU_API
+       select IOMMU_IO_PGTABLE_LPAE
+       default ARCH_APPLE
+       help
+         Support for Apple DART (Device Address Resolution Table) IOMMUs
+         found in Apple ARM SoCs like the M1.
+         This IOMMU is required for most peripherals using DMA to access
+         the main memory.
+
+         Say Y here if you are using an Apple SoC.
+
 # ARM IOMMU support
 config ARM_SMMU
        tristate "ARM Ltd. System MMU (SMMU) Support"