xref: /openbmc/linux/drivers/iommu/Kconfig (revision b664e06d)
1# The IOVA library may also be used by non-IOMMU_API users
2config IOMMU_IOVA
3	tristate
4
5# IOMMU_API always gets selected by whoever wants it.
6config IOMMU_API
7	bool
8
9menuconfig IOMMU_SUPPORT
10	bool "IOMMU Hardware Support"
11	depends on MMU
12	default y
13	---help---
14	  Say Y here if you want to compile device drivers for IO Memory
15	  Management Units into the kernel. These devices usually allow to
16	  remap DMA requests and/or remap interrupts from other devices on the
17	  system.
18
19if IOMMU_SUPPORT
20
21menu "Generic IOMMU Pagetable Support"
22
23# Selected by the actual pagetable implementations
24config IOMMU_IO_PGTABLE
25	bool
26
27config IOMMU_IO_PGTABLE_LPAE
28	bool "ARMv7/v8 Long Descriptor Format"
29	select IOMMU_IO_PGTABLE
30	depends on ARM || ARM64 || (COMPILE_TEST && !GENERIC_ATOMIC64)
31	help
32	  Enable support for the ARM long descriptor pagetable format.
33	  This allocator supports 4K/2M/1G, 16K/32M and 64K/512M page
34	  sizes at both stage-1 and stage-2, as well as address spaces
35	  up to 48-bits in size.
36
37config IOMMU_IO_PGTABLE_LPAE_SELFTEST
38	bool "LPAE selftests"
39	depends on IOMMU_IO_PGTABLE_LPAE
40	help
41	  Enable self-tests for LPAE page table allocator. This performs
42	  a series of page-table consistency checks during boot.
43
44	  If unsure, say N here.
45
46config IOMMU_IO_PGTABLE_ARMV7S
47	bool "ARMv7/v8 Short Descriptor Format"
48	select IOMMU_IO_PGTABLE
49	depends on ARM || ARM64 || COMPILE_TEST
50	help
51	  Enable support for the ARM Short-descriptor pagetable format.
52	  This supports 32-bit virtual and physical addresses mapped using
53	  2-level tables with 4KB pages/1MB sections, and contiguous entries
54	  for 64KB pages/16MB supersections if indicated by the IOMMU driver.
55
56config IOMMU_IO_PGTABLE_ARMV7S_SELFTEST
57	bool "ARMv7s selftests"
58	depends on IOMMU_IO_PGTABLE_ARMV7S
59	help
60	  Enable self-tests for ARMv7s page table allocator. This performs
61	  a series of page-table consistency checks during boot.
62
63	  If unsure, say N here.
64
65endmenu
66
67config IOMMU_DEBUGFS
68	bool "Export IOMMU internals in DebugFS"
69	depends on DEBUG_FS
70	help
71	  Allows exposure of IOMMU device internals. This option enables
72	  the use of debugfs by IOMMU drivers as required. Devices can,
73	  at initialization time, cause the IOMMU code to create a top-level
74	  debug/iommu directory, and then populate a subdirectory with
75	  entries as required.
76
77config IOMMU_DEFAULT_PASSTHROUGH
78	bool "IOMMU passthrough by default"
79	depends on IOMMU_API
80        help
81	  Enable passthrough by default, removing the need to pass in
82	  iommu.passthrough=on or iommu=pt through command line. If this
83	  is enabled, you can still disable with iommu.passthrough=off
84	  or iommu=nopt depending on the architecture.
85
86	  If unsure, say N here.
87
88config OF_IOMMU
89       def_bool y
90       depends on OF && IOMMU_API
91
92# IOMMU-agnostic DMA-mapping layer
93config IOMMU_DMA
94	bool
95	select IOMMU_API
96	select IOMMU_IOVA
97	select IRQ_MSI_IOMMU
98	select NEED_SG_DMA_LENGTH
99
100config FSL_PAMU
101	bool "Freescale IOMMU support"
102	depends on PCI
103	depends on PHYS_64BIT
104	depends on PPC_E500MC || (COMPILE_TEST && PPC)
105	select IOMMU_API
106	select GENERIC_ALLOCATOR
107	help
108	  Freescale PAMU support. PAMU is the IOMMU present on Freescale QorIQ platforms.
109	  PAMU can authorize memory access, remap the memory address, and remap I/O
110	  transaction types.
111
112# MSM IOMMU support
113config MSM_IOMMU
114	bool "MSM IOMMU Support"
115	depends on ARM
116	depends on ARCH_MSM8X60 || ARCH_MSM8960 || COMPILE_TEST
117	select IOMMU_API
118	select IOMMU_IO_PGTABLE_ARMV7S
119	help
120	  Support for the IOMMUs found on certain Qualcomm SOCs.
121	  These IOMMUs allow virtualization of the address space used by most
122	  cores within the multimedia subsystem.
123
124	  If unsure, say N here.
125
126config IOMMU_PGTABLES_L2
127	def_bool y
128	depends on MSM_IOMMU && MMU && SMP && CPU_DCACHE_DISABLE=n
129
130# AMD IOMMU support
131config AMD_IOMMU
132	bool "AMD IOMMU support"
133	select SWIOTLB
134	select PCI_MSI
135	select PCI_ATS
136	select PCI_PRI
137	select PCI_PASID
138	select IOMMU_API
139	select IOMMU_IOVA
140	depends on X86_64 && PCI && ACPI
141	---help---
142	  With this option you can enable support for AMD IOMMU hardware in
143	  your system. An IOMMU is a hardware component which provides
144	  remapping of DMA memory accesses from devices. With an AMD IOMMU you
145	  can isolate the DMA memory of different devices and protect the
146	  system from misbehaving device drivers or hardware.
147
148	  You can find out if your system has an AMD IOMMU if you look into
149	  your BIOS for an option to enable it or if you have an IVRS ACPI
150	  table.
151
152config AMD_IOMMU_V2
153	tristate "AMD IOMMU Version 2 driver"
154	depends on AMD_IOMMU
155	select MMU_NOTIFIER
156	---help---
157	  This option enables support for the AMD IOMMUv2 features of the IOMMU
158	  hardware. Select this option if you want to use devices that support
159	  the PCI PRI and PASID interface.
160
161config AMD_IOMMU_DEBUGFS
162	bool "Enable AMD IOMMU internals in DebugFS"
163	depends on AMD_IOMMU && IOMMU_DEBUGFS
164	---help---
165	  !!!WARNING!!!  !!!WARNING!!!  !!!WARNING!!!  !!!WARNING!!!
166
167	  DO NOT ENABLE THIS OPTION UNLESS YOU REALLY, -REALLY- KNOW WHAT YOU ARE DOING!!!
168	  Exposes AMD IOMMU device internals in DebugFS.
169
170	  This option is -NOT- intended for production environments, and should
171	  not generally be enabled.
172
173# Intel IOMMU support
174config DMAR_TABLE
175	bool
176
177config INTEL_IOMMU
178	bool "Support for Intel IOMMU using DMA Remapping Devices"
179	depends on PCI_MSI && ACPI && (X86 || IA64_GENERIC)
180	select IOMMU_API
181	select IOMMU_IOVA
182	select NEED_DMA_MAP_STATE
183	select DMAR_TABLE
184	help
185	  DMA remapping (DMAR) devices support enables independent address
186	  translations for Direct Memory Access (DMA) from devices.
187	  These DMA remapping devices are reported via ACPI tables
188	  and include PCI device scope covered by these DMA
189	  remapping devices.
190
191config INTEL_IOMMU_DEBUGFS
192	bool "Export Intel IOMMU internals in Debugfs"
193	depends on INTEL_IOMMU && IOMMU_DEBUGFS
194	help
195	  !!!WARNING!!!
196
197	  DO NOT ENABLE THIS OPTION UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!!!
198
199	  Expose Intel IOMMU internals in Debugfs.
200
201	  This option is -NOT- intended for production environments, and should
202	  only be enabled for debugging Intel IOMMU.
203
204config INTEL_IOMMU_SVM
205	bool "Support for Shared Virtual Memory with Intel IOMMU"
206	depends on INTEL_IOMMU && X86
207	select PCI_PASID
208	select MMU_NOTIFIER
209	help
210	  Shared Virtual Memory (SVM) provides a facility for devices
211	  to access DMA resources through process address space by
212	  means of a Process Address Space ID (PASID).
213
214config INTEL_IOMMU_DEFAULT_ON
215	def_bool y
216	prompt "Enable Intel DMA Remapping Devices by default"
217	depends on INTEL_IOMMU
218	help
219	  Selecting this option will enable a DMAR device at boot time if
220	  one is found. If this option is not selected, DMAR support can
221	  be enabled by passing intel_iommu=on to the kernel.
222
223config INTEL_IOMMU_BROKEN_GFX_WA
224	bool "Workaround broken graphics drivers (going away soon)"
225	depends on INTEL_IOMMU && BROKEN && X86
226	---help---
227	  Current Graphics drivers tend to use physical address
228	  for DMA and avoid using DMA APIs. Setting this config
229	  option permits the IOMMU driver to set a unity map for
230	  all the OS-visible memory. Hence the driver can continue
231	  to use physical addresses for DMA, at least until this
232	  option is removed in the 2.6.32 kernel.
233
234config INTEL_IOMMU_FLOPPY_WA
235	def_bool y
236	depends on INTEL_IOMMU && X86
237	---help---
238	  Floppy disk drivers are known to bypass DMA API calls
239	  thereby failing to work when IOMMU is enabled. This
240	  workaround will setup a 1:1 mapping for the first
241	  16MiB to make floppy (an ISA device) work.
242
243config IRQ_REMAP
244	bool "Support for Interrupt Remapping"
245	depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI
246	select DMAR_TABLE
247	---help---
248	  Supports Interrupt remapping for IO-APIC and MSI devices.
249	  To use x2apic mode in the CPU's which support x2APIC enhancements or
250	  to support platforms with CPU's having > 8 bit APIC ID, say Y.
251
252# OMAP IOMMU support
253config OMAP_IOMMU
254	bool "OMAP IOMMU Support"
255	depends on ARM && MMU
256	depends on ARCH_OMAP2PLUS || COMPILE_TEST
257	select IOMMU_API
258	---help---
259	  The OMAP3 media platform drivers depend on iommu support,
260	  if you need them say Y here.
261
262config OMAP_IOMMU_DEBUG
263	bool "Export OMAP IOMMU internals in DebugFS"
264	depends on OMAP_IOMMU && DEBUG_FS
265	---help---
266	  Select this to see extensive information about
267	  the internal state of OMAP IOMMU in debugfs.
268
269	  Say N unless you know you need this.
270
271config ROCKCHIP_IOMMU
272	bool "Rockchip IOMMU Support"
273	depends on ARM || ARM64
274	depends on ARCH_ROCKCHIP || COMPILE_TEST
275	select IOMMU_API
276	select ARM_DMA_USE_IOMMU
277	help
278	  Support for IOMMUs found on Rockchip rk32xx SOCs.
279	  These IOMMUs allow virtualization of the address space used by most
280	  cores within the multimedia subsystem.
281	  Say Y here if you are using a Rockchip SoC that includes an IOMMU
282	  device.
283
284config TEGRA_IOMMU_GART
285	bool "Tegra GART IOMMU Support"
286	depends on ARCH_TEGRA_2x_SOC
287	depends on TEGRA_MC
288	select IOMMU_API
289	help
290	  Enables support for remapping discontiguous physical memory
291	  shared with the operating system into contiguous I/O virtual
292	  space through the GART (Graphics Address Relocation Table)
293	  hardware included on Tegra SoCs.
294
295config TEGRA_IOMMU_SMMU
296	bool "NVIDIA Tegra SMMU Support"
297	depends on ARCH_TEGRA
298	depends on TEGRA_AHB
299	depends on TEGRA_MC
300	select IOMMU_API
301	help
302	  This driver supports the IOMMU hardware (SMMU) found on NVIDIA Tegra
303	  SoCs (Tegra30 up to Tegra210).
304
305config EXYNOS_IOMMU
306	bool "Exynos IOMMU Support"
307	depends on ARCH_EXYNOS && MMU
308	depends on !CPU_BIG_ENDIAN # revisit driver if we can enable big-endian ptes
309	select IOMMU_API
310	select ARM_DMA_USE_IOMMU
311	help
312	  Support for the IOMMU (System MMU) of Samsung Exynos application
313	  processor family. This enables H/W multimedia accelerators to see
314	  non-linear physical memory chunks as linear memory in their
315	  address space.
316
317	  If unsure, say N here.
318
319config EXYNOS_IOMMU_DEBUG
320	bool "Debugging log for Exynos IOMMU"
321	depends on EXYNOS_IOMMU
322	help
323	  Select this to see the detailed log message that shows what
324	  happens in the IOMMU driver.
325
326	  Say N unless you need kernel log message for IOMMU debugging.
327
328config IPMMU_VMSA
329	bool "Renesas VMSA-compatible IPMMU"
330	depends on ARM || IOMMU_DMA
331	depends on ARCH_RENESAS || (COMPILE_TEST && !GENERIC_ATOMIC64)
332	select IOMMU_API
333	select IOMMU_IO_PGTABLE_LPAE
334	select ARM_DMA_USE_IOMMU
335	help
336	  Support for the Renesas VMSA-compatible IPMMU found in the R-Mobile
337	  APE6, R-Car Gen2, and R-Car Gen3 SoCs.
338
339	  If unsure, say N.
340
341config SPAPR_TCE_IOMMU
342	bool "sPAPR TCE IOMMU Support"
343	depends on PPC_POWERNV || PPC_PSERIES
344	select IOMMU_API
345	help
346	  Enables bits of IOMMU API required by VFIO. The iommu_ops
347	  is not implemented as it is not necessary for VFIO.
348
349# ARM IOMMU support
350config ARM_SMMU
351	bool "ARM Ltd. System MMU (SMMU) Support"
352	depends on (ARM64 || ARM) && MMU
353	select IOMMU_API
354	select IOMMU_IO_PGTABLE_LPAE
355	select ARM_DMA_USE_IOMMU if ARM
356	help
357	  Support for implementations of the ARM System MMU architecture
358	  versions 1 and 2.
359
360	  Say Y here if your SoC includes an IOMMU device implementing
361	  the ARM SMMU architecture.
362
363config ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT
364	bool "Default to disabling bypass on ARM SMMU v1 and v2"
365	depends on ARM_SMMU
366	default y
367	help
368	  Say Y here to (by default) disable bypass streams such that
369	  incoming transactions from devices that are not attached to
370	  an iommu domain will report an abort back to the device and
371	  will not be allowed to pass through the SMMU.
372
373	  Any old kernels that existed before this KConfig was
374	  introduced would default to _allowing_ bypass (AKA the
375	  equivalent of NO for this config).  However the default for
376	  this option is YES because the old behavior is insecure.
377
378	  There are few reasons to allow unmatched stream bypass, and
379	  even fewer good ones.  If saying YES here breaks your board
380	  you should work on fixing your board.  This KConfig option
381	  is expected to be removed in the future and we'll simply
382	  hardcode the bypass disable in the code.
383
384	  NOTE: the kernel command line parameter
385	  'arm-smmu.disable_bypass' will continue to override this
386	  config.
387
388config ARM_SMMU_V3
389	bool "ARM Ltd. System MMU Version 3 (SMMUv3) Support"
390	depends on ARM64
391	select IOMMU_API
392	select IOMMU_IO_PGTABLE_LPAE
393	select GENERIC_MSI_IRQ_DOMAIN
394	help
395	  Support for implementations of the ARM System MMU architecture
396	  version 3 providing translation support to a PCIe root complex.
397
398	  Say Y here if your system includes an IOMMU device implementing
399	  the ARM SMMUv3 architecture.
400
401config S390_IOMMU
402	def_bool y if S390 && PCI
403	depends on S390 && PCI
404	select IOMMU_API
405	help
406	  Support for the IOMMU API for s390 PCI devices.
407
408config S390_CCW_IOMMU
409	bool "S390 CCW IOMMU Support"
410	depends on S390 && CCW
411	select IOMMU_API
412	help
413	  Enables bits of IOMMU API required by VFIO. The iommu_ops
414	  is not implemented as it is not necessary for VFIO.
415
416config S390_AP_IOMMU
417	bool "S390 AP IOMMU Support"
418	depends on S390 && ZCRYPT
419	select IOMMU_API
420	help
421	  Enables bits of IOMMU API required by VFIO. The iommu_ops
422	  is not implemented as it is not necessary for VFIO.
423
424config MTK_IOMMU
425	bool "MTK IOMMU Support"
426	depends on ARM || ARM64
427	depends on ARCH_MEDIATEK || COMPILE_TEST
428	select ARM_DMA_USE_IOMMU
429	select IOMMU_API
430	select IOMMU_DMA
431	select IOMMU_IO_PGTABLE_ARMV7S
432	select MEMORY
433	select MTK_SMI
434	help
435	  Support for the M4U on certain Mediatek SOCs. M4U is MultiMedia
436	  Memory Management Unit. This option enables remapping of DMA memory
437	  accesses for the multimedia subsystem.
438
439	  If unsure, say N here.
440
441config MTK_IOMMU_V1
442	bool "MTK IOMMU Version 1 (M4U gen1) Support"
443	depends on ARM
444	depends on ARCH_MEDIATEK || COMPILE_TEST
445	select ARM_DMA_USE_IOMMU
446	select IOMMU_API
447	select MEMORY
448	select MTK_SMI
449	help
450	  Support for the M4U on certain Mediatek SoCs. M4U generation 1 HW is
451	  Multimedia Memory Managememt Unit. This option enables remapping of
452	  DMA memory accesses for the multimedia subsystem.
453
454	  if unsure, say N here.
455
456config QCOM_IOMMU
457	# Note: iommu drivers cannot (yet?) be built as modules
458	bool "Qualcomm IOMMU Support"
459	depends on ARCH_QCOM || (COMPILE_TEST && !GENERIC_ATOMIC64)
460	select IOMMU_API
461	select IOMMU_IO_PGTABLE_LPAE
462	select ARM_DMA_USE_IOMMU
463	help
464	  Support for IOMMU on certain Qualcomm SoCs.
465
466config HYPERV_IOMMU
467	bool "Hyper-V x2APIC IRQ Handling"
468	depends on HYPERV
469	select IOMMU_API
470	default HYPERV
471	help
472	  Stub IOMMU driver to handle IRQs as to allow Hyper-V Linux
473	  guests to run with x2APIC mode enabled.
474
475endif # IOMMU_SUPPORT
476