xref: /openbmc/linux/drivers/iommu/Kconfig (revision e3211e41)
1# SPDX-License-Identifier: GPL-2.0-only
2# The IOVA library may also be used by non-IOMMU_API users
3config IOMMU_IOVA
4	tristate
5
6# The IOASID library may also be used by non-IOMMU_API users
7config IOASID
8	tristate
9
10# IOMMU_API always gets selected by whoever wants it.
11config IOMMU_API
12	bool
13
14menuconfig 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
24if IOMMU_SUPPORT
25
26menu "Generic IOMMU Pagetable Support"
27
28# Selected by the actual pagetable implementations
29config IOMMU_IO_PGTABLE
30	bool
31
32config 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
42config 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
51config 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
61config 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
70endmenu
71
72config 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
82config 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
93config OF_IOMMU
94	def_bool y
95	depends on OF && IOMMU_API
96
97# IOMMU-agnostic DMA-mapping layer
98config 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
107config IOMMU_SVA_LIB
108	bool
109	select IOASID
110
111config 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
124config 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
137source "drivers/iommu/amd/Kconfig"
138source "drivers/iommu/intel/Kconfig"
139
140config 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
150config 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
158config 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
167config 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
179config 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
188config 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
199config 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
209config 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
223config 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
232config 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
244config 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
253config ARM_SMMU
254	tristate "ARM Ltd. System MMU (SMMU) Support"
255	depends on ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64)
256	select IOMMU_API
257	select IOMMU_IO_PGTABLE_LPAE
258	select ARM_DMA_USE_IOMMU if ARM
259	help
260	  Support for implementations of the ARM System MMU architecture
261	  versions 1 and 2.
262
263	  Say Y here if your SoC includes an IOMMU device implementing
264	  the ARM SMMU architecture.
265
266config ARM_SMMU_LEGACY_DT_BINDINGS
267	bool "Support the legacy \"mmu-masters\" devicetree bindings"
268	depends on ARM_SMMU=y && OF
269	help
270	  Support for the badly designed and deprecated "mmu-masters"
271	  devicetree bindings. This allows some DMA masters to attach
272	  to the SMMU but does not provide any support via the DMA API.
273	  If you're lucky, you might be able to get VFIO up and running.
274
275	  If you say Y here then you'll make me very sad. Instead, say N
276	  and move your firmware to the utopian future that was 2016.
277
278config ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT
279	bool "Default to disabling bypass on ARM SMMU v1 and v2"
280	depends on ARM_SMMU
281	default y
282	help
283	  Say Y here to (by default) disable bypass streams such that
284	  incoming transactions from devices that are not attached to
285	  an iommu domain will report an abort back to the device and
286	  will not be allowed to pass through the SMMU.
287
288	  Any old kernels that existed before this KConfig was
289	  introduced would default to _allowing_ bypass (AKA the
290	  equivalent of NO for this config).  However the default for
291	  this option is YES because the old behavior is insecure.
292
293	  There are few reasons to allow unmatched stream bypass, and
294	  even fewer good ones.  If saying YES here breaks your board
295	  you should work on fixing your board.  This KConfig option
296	  is expected to be removed in the future and we'll simply
297	  hardcode the bypass disable in the code.
298
299	  NOTE: the kernel command line parameter
300	  'arm-smmu.disable_bypass' will continue to override this
301	  config.
302
303config ARM_SMMU_V3
304	tristate "ARM Ltd. System MMU Version 3 (SMMUv3) Support"
305	depends on ARM64
306	select IOMMU_API
307	select IOMMU_IO_PGTABLE_LPAE
308	select GENERIC_MSI_IRQ_DOMAIN
309	help
310	  Support for implementations of the ARM System MMU architecture
311	  version 3 providing translation support to a PCIe root complex.
312
313	  Say Y here if your system includes an IOMMU device implementing
314	  the ARM SMMUv3 architecture.
315
316config ARM_SMMU_V3_SVA
317	bool "Shared Virtual Addressing support for the ARM SMMUv3"
318	depends on ARM_SMMU_V3
319	select IOMMU_SVA_LIB
320	select MMU_NOTIFIER
321	help
322	  Support for sharing process address spaces with devices using the
323	  SMMUv3.
324
325	  Say Y here if your system supports SVA extensions such as PCIe PASID
326	  and PRI.
327
328config S390_IOMMU
329	def_bool y if S390 && PCI
330	depends on S390 && PCI
331	select IOMMU_API
332	help
333	  Support for the IOMMU API for s390 PCI devices.
334
335config S390_CCW_IOMMU
336	bool "S390 CCW IOMMU Support"
337	depends on S390 && CCW || COMPILE_TEST
338	select IOMMU_API
339	help
340	  Enables bits of IOMMU API required by VFIO. The iommu_ops
341	  is not implemented as it is not necessary for VFIO.
342
343config S390_AP_IOMMU
344	bool "S390 AP IOMMU Support"
345	depends on S390 && ZCRYPT || COMPILE_TEST
346	select IOMMU_API
347	help
348	  Enables bits of IOMMU API required by VFIO. The iommu_ops
349	  is not implemented as it is not necessary for VFIO.
350
351config MTK_IOMMU
352	tristate "MediaTek IOMMU Support"
353	depends on ARCH_MEDIATEK || COMPILE_TEST
354	select ARM_DMA_USE_IOMMU
355	select IOMMU_API
356	select IOMMU_IO_PGTABLE_ARMV7S
357	select MEMORY
358	select MTK_SMI
359	help
360	  Support for the M4U on certain Mediatek SOCs. M4U is MultiMedia
361	  Memory Management Unit. This option enables remapping of DMA memory
362	  accesses for the multimedia subsystem.
363
364	  If unsure, say N here.
365
366config MTK_IOMMU_V1
367	tristate "MediaTek IOMMU Version 1 (M4U gen1) Support"
368	depends on ARM
369	depends on ARCH_MEDIATEK || COMPILE_TEST
370	select ARM_DMA_USE_IOMMU
371	select IOMMU_API
372	select MEMORY
373	select MTK_SMI
374	help
375	  Support for the M4U on certain Mediatek SoCs. M4U generation 1 HW is
376	  Multimedia Memory Managememt Unit. This option enables remapping of
377	  DMA memory accesses for the multimedia subsystem.
378
379	  if unsure, say N here.
380
381config QCOM_IOMMU
382	# Note: iommu drivers cannot (yet?) be built as modules
383	bool "Qualcomm IOMMU Support"
384	depends on ARCH_QCOM || (COMPILE_TEST && !GENERIC_ATOMIC64)
385	select IOMMU_API
386	select IOMMU_IO_PGTABLE_LPAE
387	select ARM_DMA_USE_IOMMU
388	help
389	  Support for IOMMU on certain Qualcomm SoCs.
390
391config HYPERV_IOMMU
392	bool "Hyper-V x2APIC IRQ Handling"
393	depends on HYPERV && X86
394	select IOMMU_API
395	default HYPERV
396	help
397	  Stub IOMMU driver to handle IRQs as to allow Hyper-V Linux
398	  guests to run with x2APIC mode enabled.
399
400config VIRTIO_IOMMU
401	tristate "Virtio IOMMU driver"
402	depends on VIRTIO
403	depends on ARM64
404	select IOMMU_API
405	select INTERVAL_TREE
406	help
407	  Para-virtualised IOMMU driver with virtio.
408
409	  Say Y here if you intend to run this kernel as a guest.
410
411config SPRD_IOMMU
412	tristate "Unisoc IOMMU Support"
413	depends on ARCH_SPRD || COMPILE_TEST
414	select IOMMU_API
415	help
416	  Support for IOMMU on Unisoc's SoCs, this IOMMU can be used by
417	  Unisoc's multimedia devices, such as display, Image codec(jpeg)
418	  and a few signal processors, including VSP(video), GSP(graphic),
419	  ISP(image), and CPP(camera pixel processor), etc.
420
421	  Say Y here if you want to use the multimedia devices listed above.
422
423endif # IOMMU_SUPPORT
424