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