@@ -79,16 +79,57 @@ config IOMMU_DEBUGFS
7979 debug/iommu directory, and then populate a subdirectory with
8080 entries as required.
8181
82- config IOMMU_DEFAULT_PASSTHROUGH
83- bool "IOMMU passthrough by default "
82+ choice
83+ prompt "IOMMU default domain type "
8484 depends on IOMMU_API
85+ default IOMMU_DEFAULT_DMA_LAZY if AMD_IOMMU || INTEL_IOMMU
86+ default IOMMU_DEFAULT_DMA_STRICT
8587 help
86- Enable passthrough by default, removing the need to pass in
87- iommu.passthrough=on or iommu=pt through command line. If this
88- is enabled, you can still disable with iommu.passthrough=off
89- or iommu=nopt depending on the architecture.
88+ Choose the type of IOMMU domain used to manage DMA API usage by
89+ device drivers. The options here typically represent different
90+ levels of tradeoff between robustness/security and performance,
91+ depending on the IOMMU driver. Not all IOMMUs support all options.
92+ This choice can be overridden at boot via the command line, and for
93+ some devices also at runtime via sysfs.
9094
91- If unsure, say N here.
95+ If unsure, keep the default.
96+
97+ config IOMMU_DEFAULT_DMA_STRICT
98+ bool "Translated - Strict"
99+ help
100+ Trusted devices use translation to restrict their access to only
101+ DMA-mapped pages, with strict TLB invalidation on unmap. Equivalent
102+ to passing "iommu.passthrough=0 iommu.strict=1" on the command line.
103+
104+ Untrusted devices always use this mode, with an additional layer of
105+ bounce-buffering such that they cannot gain access to any unrelated
106+ data within a mapped page.
107+
108+ config IOMMU_DEFAULT_DMA_LAZY
109+ bool "Translated - Lazy"
110+ help
111+ Trusted devices use translation to restrict their access to only
112+ DMA-mapped pages, but with "lazy" batched TLB invalidation. This
113+ mode allows higher performance with some IOMMUs due to reduced TLB
114+ flushing, but at the cost of reduced isolation since devices may be
115+ able to access memory for some time after it has been unmapped.
116+ Equivalent to passing "iommu.passthrough=0 iommu.strict=0" on the
117+ command line.
118+
119+ If this mode is not supported by the IOMMU driver, the effective
120+ runtime default will fall back to IOMMU_DEFAULT_DMA_STRICT.
121+
122+ config IOMMU_DEFAULT_PASSTHROUGH
123+ bool "Passthrough"
124+ help
125+ Trusted devices are identity-mapped, giving them unrestricted access
126+ to memory with minimal performance overhead. Equivalent to passing
127+ "iommu.passthrough=1" (historically "iommu=pt") on the command line.
128+
129+ If this mode is not supported by the IOMMU driver, the effective
130+ runtime default will fall back to IOMMU_DEFAULT_DMA_STRICT.
131+
132+ endchoice
92133
93134config OF_IOMMU
94135 def_bool y
@@ -249,6 +290,20 @@ config SPAPR_TCE_IOMMU
249290 Enables bits of IOMMU API required by VFIO. The iommu_ops
250291 is not implemented as it is not necessary for VFIO.
251292
293+ config APPLE_DART
294+ tristate "Apple DART IOMMU Support"
295+ depends on ARCH_APPLE || (COMPILE_TEST && !GENERIC_ATOMIC64)
296+ select IOMMU_API
297+ select IOMMU_IO_PGTABLE_LPAE
298+ default ARCH_APPLE
299+ help
300+ Support for Apple DART (Device Address Resolution Table) IOMMUs
301+ found in Apple ARM SoCs like the M1.
302+ This IOMMU is required for most peripherals using DMA to access
303+ the main memory.
304+
305+ Say Y here if you are using an Apple SoC.
306+
252307# ARM IOMMU support
253308config ARM_SMMU
254309 tristate "ARM Ltd. System MMU (SMMU) Support"
0 commit comments