@@ -79,55 +79,55 @@ config IOMMU_DEBUGFS
79
79
debug/iommu directory, and then populate a subdirectory with
80
80
entries as required.
81
81
82
- config IOMMU_DEFAULT_PASSTHROUGH
83
- bool "IOMMU passthrough by default "
82
+ choice
83
+ prompt "IOMMU default domain type "
84
84
depends on IOMMU_API
85
+ default IOMMU_DEFAULT_DMA_LAZY if AMD_IOMMU || INTEL_IOMMU
86
+ default IOMMU_DEFAULT_DMA_STRICT
85
87
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.
90
94
91
- If unsure, say N here .
95
+ If unsure, keep the default .
92
96
93
- choice
94
- prompt "IOMMU default DMA IOTLB invalidation mode"
95
- depends on IOMMU_DMA
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.
96
103
97
- default IOMMU_DEFAULT_LAZY if (AMD_IOMMU || INTEL_IOMMU)
98
- default IOMMU_DEFAULT_STRICT
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"
99
110
help
100
- This option allows an IOMMU DMA IOTLB invalidation mode to be
101
- chosen at build time, to override the default mode of each ARCH,
102
- removing the need to pass in kernel parameters through command line.
103
- It is still possible to provide common boot params to override this
104
- config.
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.
105
118
106
- If unsure, keep the default.
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.
107
128
108
- config IOMMU_DEFAULT_STRICT
109
- bool "strict"
110
- help
111
- For every IOMMU DMA unmap operation, the flush operation of IOTLB and
112
- the free operation of IOVA are guaranteed to be done in the unmap
113
- function.
114
-
115
- config IOMMU_DEFAULT_LAZY
116
- bool "lazy"
117
- help
118
- Support lazy mode, where for every IOMMU DMA unmap operation, the
119
- flush operation of IOTLB and the free operation of IOVA are deferred.
120
- They are only guaranteed to be done before the related IOVA will be
121
- reused.
122
-
123
- The isolation provided in this mode is not as secure as STRICT mode,
124
- such that a vulnerable time window may be created between the DMA
125
- unmap and the mappings cached in the IOMMU IOTLB or device TLB
126
- finally being invalidated, where the device could still access the
127
- memory which has already been unmapped by the device driver.
128
- However this mode may provide better performance in high throughput
129
- scenarios, and is still considerably more secure than passthrough
130
- mode or no IOMMU.
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
131
132
132
endchoice
133
133
0 commit comments