Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad...
[linux-2.6-microblaze.git] / drivers / iommu / Kconfig
1 # SPDX-License-Identifier: GPL-2.0-only
2 # The IOVA library may also be used by non-IOMMU_API users
3 config IOMMU_IOVA
4         tristate
5
6 # The IOASID library may also be used by non-IOMMU_API users
7 config IOASID
8         tristate
9
10 # IOMMU_API always gets selected by whoever wants it.
11 config IOMMU_API
12         bool
13
14 menuconfig IOMMU_SUPPORT
15         bool "IOMMU Hardware Support"
16         depends on MMU
17         default y
18         help
19           Say Y here if you want to compile device drivers for IO Memory
20           Management Units into the kernel. These devices usually allow to
21           remap DMA requests and/or remap interrupts from other devices on the
22           system.
23
24 if IOMMU_SUPPORT
25
26 menu "Generic IOMMU Pagetable Support"
27
28 # Selected by the actual pagetable implementations
29 config IOMMU_IO_PGTABLE
30         bool
31
32 config IOMMU_IO_PGTABLE_LPAE
33         bool "ARMv7/v8 Long Descriptor Format"
34         select IOMMU_IO_PGTABLE
35         depends on ARM || ARM64 || (COMPILE_TEST && !GENERIC_ATOMIC64)
36         help
37           Enable support for the ARM long descriptor pagetable format.
38           This allocator supports 4K/2M/1G, 16K/32M and 64K/512M page
39           sizes at both stage-1 and stage-2, as well as address spaces
40           up to 48-bits in size.
41
42 config IOMMU_IO_PGTABLE_LPAE_SELFTEST
43         bool "LPAE selftests"
44         depends on IOMMU_IO_PGTABLE_LPAE
45         help
46           Enable self-tests for LPAE page table allocator. This performs
47           a series of page-table consistency checks during boot.
48
49           If unsure, say N here.
50
51 config IOMMU_IO_PGTABLE_ARMV7S
52         bool "ARMv7/v8 Short Descriptor Format"
53         select IOMMU_IO_PGTABLE
54         depends on ARM || ARM64 || COMPILE_TEST
55         help
56           Enable support for the ARM Short-descriptor pagetable format.
57           This supports 32-bit virtual and physical addresses mapped using
58           2-level tables with 4KB pages/1MB sections, and contiguous entries
59           for 64KB pages/16MB supersections if indicated by the IOMMU driver.
60
61 config IOMMU_IO_PGTABLE_ARMV7S_SELFTEST
62         bool "ARMv7s selftests"
63         depends on IOMMU_IO_PGTABLE_ARMV7S
64         help
65           Enable self-tests for ARMv7s page table allocator. This performs
66           a series of page-table consistency checks during boot.
67
68           If unsure, say N here.
69
70 endmenu
71
72 config IOMMU_DEBUGFS
73         bool "Export IOMMU internals in DebugFS"
74         depends on DEBUG_FS
75         help
76           Allows exposure of IOMMU device internals. This option enables
77           the use of debugfs by IOMMU drivers as required. Devices can,
78           at initialization time, cause the IOMMU code to create a top-level
79           debug/iommu directory, and then populate a subdirectory with
80           entries as required.
81
82 config IOMMU_DEFAULT_PASSTHROUGH
83         bool "IOMMU passthrough by default"
84         depends on IOMMU_API
85         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.
90
91           If unsure, say N here.
92
93 config OF_IOMMU
94         def_bool y
95         depends on OF && IOMMU_API
96
97 # IOMMU-agnostic DMA-mapping layer
98 config IOMMU_DMA
99         bool
100         select DMA_OPS
101         select IOMMU_API
102         select IOMMU_IOVA
103         select IRQ_MSI_IOMMU
104         select NEED_SG_DMA_LENGTH
105
106 # Shared Virtual Addressing library
107 config IOMMU_SVA_LIB
108         bool
109         select IOASID
110
111 config FSL_PAMU
112         bool "Freescale IOMMU support"
113         depends on PCI
114         depends on PHYS_64BIT
115         depends on PPC_E500MC || (COMPILE_TEST && PPC)
116         select IOMMU_API
117         select GENERIC_ALLOCATOR
118         help
119           Freescale PAMU support. PAMU is the IOMMU present on Freescale QorIQ platforms.
120           PAMU can authorize memory access, remap the memory address, and remap I/O
121           transaction types.
122
123 # MSM IOMMU support
124 config MSM_IOMMU
125         bool "MSM IOMMU Support"
126         depends on ARM
127         depends on ARCH_MSM8X60 || ARCH_MSM8960 || COMPILE_TEST
128         select IOMMU_API
129         select IOMMU_IO_PGTABLE_ARMV7S
130         help
131           Support for the IOMMUs found on certain Qualcomm SOCs.
132           These IOMMUs allow virtualization of the address space used by most
133           cores within the multimedia subsystem.
134
135           If unsure, say N here.
136
137 source "drivers/iommu/amd/Kconfig"
138 source "drivers/iommu/intel/Kconfig"
139
140 config IRQ_REMAP
141         bool "Support for Interrupt Remapping"
142         depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI
143         select DMAR_TABLE
144         help
145           Supports Interrupt remapping for IO-APIC and MSI devices.
146           To use x2apic mode in the CPU's which support x2APIC enhancements or
147           to support platforms with CPU's having > 8 bit APIC ID, say Y.
148
149 # OMAP IOMMU support
150 config OMAP_IOMMU
151         bool "OMAP IOMMU Support"
152         depends on ARCH_OMAP2PLUS || COMPILE_TEST
153         select IOMMU_API
154         help
155           The OMAP3 media platform drivers depend on iommu support,
156           if you need them say Y here.
157
158 config OMAP_IOMMU_DEBUG
159         bool "Export OMAP IOMMU internals in DebugFS"
160         depends on OMAP_IOMMU && DEBUG_FS
161         help
162           Select this to see extensive information about
163           the internal state of OMAP IOMMU in debugfs.
164
165           Say N unless you know you need this.
166
167 config ROCKCHIP_IOMMU
168         bool "Rockchip IOMMU Support"
169         depends on ARCH_ROCKCHIP || COMPILE_TEST
170         select IOMMU_API
171         select ARM_DMA_USE_IOMMU
172         help
173           Support for IOMMUs found on Rockchip rk32xx SOCs.
174           These IOMMUs allow virtualization of the address space used by most
175           cores within the multimedia subsystem.
176           Say Y here if you are using a Rockchip SoC that includes an IOMMU
177           device.
178
179 config SUN50I_IOMMU
180         bool "Allwinner H6 IOMMU Support"
181         depends on HAS_DMA
182         depends on ARCH_SUNXI || COMPILE_TEST
183         select ARM_DMA_USE_IOMMU
184         select IOMMU_API
185         help
186           Support for the IOMMU introduced in the Allwinner H6 SoCs.
187
188 config TEGRA_IOMMU_GART
189         bool "Tegra GART IOMMU Support"
190         depends on ARCH_TEGRA_2x_SOC
191         depends on TEGRA_MC
192         select IOMMU_API
193         help
194           Enables support for remapping discontiguous physical memory
195           shared with the operating system into contiguous I/O virtual
196           space through the GART (Graphics Address Relocation Table)
197           hardware included on Tegra SoCs.
198
199 config TEGRA_IOMMU_SMMU
200         bool "NVIDIA Tegra SMMU Support"
201         depends on ARCH_TEGRA
202         depends on TEGRA_AHB
203         depends on TEGRA_MC
204         select IOMMU_API
205         help
206           This driver supports the IOMMU hardware (SMMU) found on NVIDIA Tegra
207           SoCs (Tegra30 up to Tegra210).
208
209 config EXYNOS_IOMMU
210         bool "Exynos IOMMU Support"
211         depends on ARCH_EXYNOS || COMPILE_TEST
212         depends on !CPU_BIG_ENDIAN # revisit driver if we can enable big-endian ptes
213         select IOMMU_API
214         select ARM_DMA_USE_IOMMU
215         help
216           Support for the IOMMU (System MMU) of Samsung Exynos application
217           processor family. This enables H/W multimedia accelerators to see
218           non-linear physical memory chunks as linear memory in their
219           address space.
220
221           If unsure, say N here.
222
223 config EXYNOS_IOMMU_DEBUG
224         bool "Debugging log for Exynos IOMMU"
225         depends on EXYNOS_IOMMU
226         help
227           Select this to see the detailed log message that shows what
228           happens in the IOMMU driver.
229
230           Say N unless you need kernel log message for IOMMU debugging.
231
232 config IPMMU_VMSA
233         bool "Renesas VMSA-compatible IPMMU"
234         depends on ARCH_RENESAS || (COMPILE_TEST && !GENERIC_ATOMIC64)
235         select IOMMU_API
236         select IOMMU_IO_PGTABLE_LPAE
237         select ARM_DMA_USE_IOMMU
238         help
239           Support for the Renesas VMSA-compatible IPMMU found in the R-Mobile
240           APE6, R-Car Gen{2,3} and RZ/G{1,2} SoCs.
241
242           If unsure, say N.
243
244 config SPAPR_TCE_IOMMU
245         bool "sPAPR TCE IOMMU Support"
246         depends on PPC_POWERNV || PPC_PSERIES
247         select IOMMU_API
248         help
249           Enables bits of IOMMU API required by VFIO. The iommu_ops
250           is not implemented as it is not necessary for VFIO.
251
252 # ARM IOMMU support
253 config ARM_SMMU
254         tristate "ARM Ltd. System MMU (SMMU) Support"
255         depends on ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64)
256         depends on QCOM_SCM || !QCOM_SCM #if QCOM_SCM=m this can't be =y
257         select IOMMU_API
258         select IOMMU_IO_PGTABLE_LPAE
259         select ARM_DMA_USE_IOMMU if ARM
260         help
261           Support for implementations of the ARM System MMU architecture
262           versions 1 and 2.
263
264           Say Y here if your SoC includes an IOMMU device implementing
265           the ARM SMMU architecture.
266
267 config ARM_SMMU_LEGACY_DT_BINDINGS
268         bool "Support the legacy \"mmu-masters\" devicetree bindings"
269         depends on ARM_SMMU=y && OF
270         help
271           Support for the badly designed and deprecated "mmu-masters"
272           devicetree bindings. This allows some DMA masters to attach
273           to the SMMU but does not provide any support via the DMA API.
274           If you're lucky, you might be able to get VFIO up and running.
275
276           If you say Y here then you'll make me very sad. Instead, say N
277           and move your firmware to the utopian future that was 2016.
278
279 config ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT
280         bool "Default to disabling bypass on ARM SMMU v1 and v2"
281         depends on ARM_SMMU
282         default y
283         help
284           Say Y here to (by default) disable bypass streams such that
285           incoming transactions from devices that are not attached to
286           an iommu domain will report an abort back to the device and
287           will not be allowed to pass through the SMMU.
288
289           Any old kernels that existed before this KConfig was
290           introduced would default to _allowing_ bypass (AKA the
291           equivalent of NO for this config).  However the default for
292           this option is YES because the old behavior is insecure.
293
294           There are few reasons to allow unmatched stream bypass, and
295           even fewer good ones.  If saying YES here breaks your board
296           you should work on fixing your board.  This KConfig option
297           is expected to be removed in the future and we'll simply
298           hardcode the bypass disable in the code.
299
300           NOTE: the kernel command line parameter
301           'arm-smmu.disable_bypass' will continue to override this
302           config.
303
304 config ARM_SMMU_V3
305         tristate "ARM Ltd. System MMU Version 3 (SMMUv3) Support"
306         depends on ARM64
307         select IOMMU_API
308         select IOMMU_IO_PGTABLE_LPAE
309         select GENERIC_MSI_IRQ_DOMAIN
310         help
311           Support for implementations of the ARM System MMU architecture
312           version 3 providing translation support to a PCIe root complex.
313
314           Say Y here if your system includes an IOMMU device implementing
315           the ARM SMMUv3 architecture.
316
317 config ARM_SMMU_V3_SVA
318         bool "Shared Virtual Addressing support for the ARM SMMUv3"
319         depends on ARM_SMMU_V3
320         select IOMMU_SVA_LIB
321         select MMU_NOTIFIER
322         help
323           Support for sharing process address spaces with devices using the
324           SMMUv3.
325
326           Say Y here if your system supports SVA extensions such as PCIe PASID
327           and PRI.
328
329 config S390_IOMMU
330         def_bool y if S390 && PCI
331         depends on S390 && PCI
332         select IOMMU_API
333         help
334           Support for the IOMMU API for s390 PCI devices.
335
336 config S390_CCW_IOMMU
337         bool "S390 CCW IOMMU Support"
338         depends on S390 && CCW || COMPILE_TEST
339         select IOMMU_API
340         help
341           Enables bits of IOMMU API required by VFIO. The iommu_ops
342           is not implemented as it is not necessary for VFIO.
343
344 config S390_AP_IOMMU
345         bool "S390 AP IOMMU Support"
346         depends on S390 && ZCRYPT || COMPILE_TEST
347         select IOMMU_API
348         help
349           Enables bits of IOMMU API required by VFIO. The iommu_ops
350           is not implemented as it is not necessary for VFIO.
351
352 config MTK_IOMMU
353         tristate "MediaTek IOMMU Support"
354         depends on ARCH_MEDIATEK || COMPILE_TEST
355         select ARM_DMA_USE_IOMMU
356         select IOMMU_API
357         select IOMMU_IO_PGTABLE_ARMV7S
358         select MEMORY
359         select MTK_SMI
360         help
361           Support for the M4U on certain Mediatek SOCs. M4U is MultiMedia
362           Memory Management Unit. This option enables remapping of DMA memory
363           accesses for the multimedia subsystem.
364
365           If unsure, say N here.
366
367 config MTK_IOMMU_V1
368         tristate "MediaTek IOMMU Version 1 (M4U gen1) Support"
369         depends on ARM
370         depends on ARCH_MEDIATEK || COMPILE_TEST
371         select ARM_DMA_USE_IOMMU
372         select IOMMU_API
373         select MEMORY
374         select MTK_SMI
375         help
376           Support for the M4U on certain Mediatek SoCs. M4U generation 1 HW is
377           Multimedia Memory Managememt Unit. This option enables remapping of
378           DMA memory accesses for the multimedia subsystem.
379
380           if unsure, say N here.
381
382 config QCOM_IOMMU
383         # Note: iommu drivers cannot (yet?) be built as modules
384         bool "Qualcomm IOMMU Support"
385         depends on ARCH_QCOM || (COMPILE_TEST && !GENERIC_ATOMIC64)
386         depends on QCOM_SCM=y
387         select IOMMU_API
388         select IOMMU_IO_PGTABLE_LPAE
389         select ARM_DMA_USE_IOMMU
390         help
391           Support for IOMMU on certain Qualcomm SoCs.
392
393 config HYPERV_IOMMU
394         bool "Hyper-V x2APIC IRQ Handling"
395         depends on HYPERV && X86
396         select IOMMU_API
397         default HYPERV
398         help
399           Stub IOMMU driver to handle IRQs as to allow Hyper-V Linux
400           guests to run with x2APIC mode enabled.
401
402 config VIRTIO_IOMMU
403         tristate "Virtio IOMMU driver"
404         depends on VIRTIO
405         depends on (ARM64 || X86)
406         select IOMMU_API
407         select IOMMU_DMA
408         select INTERVAL_TREE
409         select ACPI_VIOT if ACPI
410         help
411           Para-virtualised IOMMU driver with virtio.
412
413           Say Y here if you intend to run this kernel as a guest.
414
415 config SPRD_IOMMU
416         tristate "Unisoc IOMMU Support"
417         depends on ARCH_SPRD || COMPILE_TEST
418         select IOMMU_API
419         help
420           Support for IOMMU on Unisoc's SoCs, this IOMMU can be used by
421           Unisoc's multimedia devices, such as display, Image codec(jpeg)
422           and a few signal processors, including VSP(video), GSP(graphic),
423           ISP(image), and CPP(camera pixel processor), etc.
424
425           Say Y here if you want to use the multimedia devices listed above.
426
427 endif # IOMMU_SUPPORT