xref: /linux/drivers/iommu/Kconfig (revision b2128290c29902315e632ea59e0504d6bc9e9b42)
1ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only
2bd3c2e66SSakari Ailus# The IOVA library may also be used by non-IOMMU_API users
3bd3c2e66SSakari Ailusconfig IOMMU_IOVA
4bd3c2e66SSakari Ailus	tristate
5bd3c2e66SSakari Ailus
6ab493a0fSOhad Ben-Cohen# IOMMU_API always gets selected by whoever wants it.
7ab493a0fSOhad Ben-Cohenconfig IOMMU_API
8ab493a0fSOhad Ben-Cohen	bool
9b10f127eSOhad Ben-Cohen
108c9c727bSJoao Martinsconfig IOMMUFD_DRIVER
118c9c727bSJoao Martins	bool
128c9c727bSJoao Martins	default n
138c9c727bSJoao Martins
1468255b62SJoerg Roedelmenuconfig IOMMU_SUPPORT
1568255b62SJoerg Roedel	bool "IOMMU Hardware Support"
16e5144c93SArnd Bergmann	depends on MMU
1768255b62SJoerg Roedel	default y
18a7f7f624SMasahiro Yamada	help
1968255b62SJoerg Roedel	  Say Y here if you want to compile device drivers for IO Memory
2068255b62SJoerg Roedel	  Management Units into the kernel. These devices usually allow to
2168255b62SJoerg Roedel	  remap DMA requests and/or remap interrupts from other devices on the
2268255b62SJoerg Roedel	  system.
2368255b62SJoerg Roedel
2468255b62SJoerg Roedelif IOMMU_SUPPORT
2568255b62SJoerg Roedel
26fdb1d7beSWill Deaconmenu "Generic IOMMU Pagetable Support"
27fdb1d7beSWill Deacon
28fdb1d7beSWill Deacon# Selected by the actual pagetable implementations
29fdb1d7beSWill Deaconconfig IOMMU_IO_PGTABLE
30fdb1d7beSWill Deacon	bool
31fdb1d7beSWill Deacon
32e1d3c0fdSWill Deaconconfig IOMMU_IO_PGTABLE_LPAE
33e1d3c0fdSWill Deacon	bool "ARMv7/v8 Long Descriptor Format"
34e1d3c0fdSWill Deacon	select IOMMU_IO_PGTABLE
35d286a58bSRobin Murphy	depends on ARM || ARM64 || COMPILE_TEST
361b0b5f50SGeert Uytterhoeven	depends on !GENERIC_ATOMIC64	# for cmpxchg64()
37e1d3c0fdSWill Deacon	help
38e1d3c0fdSWill Deacon	  Enable support for the ARM long descriptor pagetable format.
39e1d3c0fdSWill Deacon	  This allocator supports 4K/2M/1G, 16K/32M and 64K/512M page
40e1d3c0fdSWill Deacon	  sizes at both stage-1 and stage-2, as well as address spaces
41e1d3c0fdSWill Deacon	  up to 48-bits in size.
42e1d3c0fdSWill Deacon
437e06063aSMostafa Salehconfig IOMMU_IO_PGTABLE_LPAE_KUNIT_TEST
447e06063aSMostafa Saleh	tristate "KUnit tests for LPAE"
457e06063aSMostafa Saleh	depends on IOMMU_IO_PGTABLE_LPAE && KUNIT
467e06063aSMostafa Saleh	default KUNIT_ALL_TESTS
47fe4b991dSWill Deacon	help
487e06063aSMostafa Saleh	  Enable kunit tests for LPAE page table allocator. This performs
497e06063aSMostafa Saleh	  a series of page-table consistency checks.
50fe4b991dSWill Deacon
51fe4b991dSWill Deacon	  If unsure, say N here.
52fe4b991dSWill Deacon
53e5fc9753SRobin Murphyconfig IOMMU_IO_PGTABLE_ARMV7S
54e5fc9753SRobin Murphy	bool "ARMv7/v8 Short Descriptor Format"
55e5fc9753SRobin Murphy	select IOMMU_IO_PGTABLE
5648e6f765SGeert Uytterhoeven	depends on ARM || ARM64 || COMPILE_TEST
57e5fc9753SRobin Murphy	help
58e5fc9753SRobin Murphy	  Enable support for the ARM Short-descriptor pagetable format.
59e5fc9753SRobin Murphy	  This supports 32-bit virtual and physical addresses mapped using
60e5fc9753SRobin Murphy	  2-level tables with 4KB pages/1MB sections, and contiguous entries
61e5fc9753SRobin Murphy	  for 64KB pages/16MB supersections if indicated by the IOMMU driver.
62e5fc9753SRobin Murphy
63e5fc9753SRobin Murphyconfig IOMMU_IO_PGTABLE_ARMV7S_SELFTEST
64e5fc9753SRobin Murphy	bool "ARMv7s selftests"
65e5fc9753SRobin Murphy	depends on IOMMU_IO_PGTABLE_ARMV7S
66e5fc9753SRobin Murphy	help
67e5fc9753SRobin Murphy	  Enable self-tests for ARMv7s page table allocator. This performs
68e5fc9753SRobin Murphy	  a series of page-table consistency checks during boot.
69e5fc9753SRobin Murphy
70e5fc9753SRobin Murphy	  If unsure, say N here.
71e5fc9753SRobin Murphy
72745ef109SJanne Grunauconfig IOMMU_IO_PGTABLE_DART
73745ef109SJanne Grunau	bool "Apple DART Formats"
74745ef109SJanne Grunau	select IOMMU_IO_PGTABLE
75d286a58bSRobin Murphy	depends on ARM64 || COMPILE_TEST
761b0b5f50SGeert Uytterhoeven	depends on !GENERIC_ATOMIC64	# for cmpxchg64()
77745ef109SJanne Grunau	help
78745ef109SJanne Grunau	  Enable support for the Apple DART pagetable formats. These include
79745ef109SJanne Grunau	  the t8020 and t6000/t8110 DART formats used in Apple M1/M2 family
80745ef109SJanne Grunau	  SoCs.
81745ef109SJanne Grunau
82745ef109SJanne Grunau	  If unsure, say N here.
83745ef109SJanne Grunau
84fdb1d7beSWill Deaconendmenu
85fdb1d7beSWill Deacon
86bad614b2SGary R Hookconfig IOMMU_DEBUGFS
87bad614b2SGary R Hook	bool "Export IOMMU internals in DebugFS"
88bad614b2SGary R Hook	depends on DEBUG_FS
89bad614b2SGary R Hook	help
90bad614b2SGary R Hook	  Allows exposure of IOMMU device internals. This option enables
91bad614b2SGary R Hook	  the use of debugfs by IOMMU drivers as required. Devices can,
92bad614b2SGary R Hook	  at initialization time, cause the IOMMU code to create a top-level
93bad614b2SGary R Hook	  debug/iommu directory, and then populate a subdirectory with
94bad614b2SGary R Hook	  entries as required.
95bad614b2SGary R Hook
96712d8f20SZhen Leichoice
97e96763ecSRobin Murphy	prompt "IOMMU default domain type"
9858d11317SOlof Johansson	depends on IOMMU_API
994bbdb725SLinus Torvalds	default IOMMU_DEFAULT_DMA_LAZY if X86 || S390
100e96763ecSRobin Murphy	default IOMMU_DEFAULT_DMA_STRICT
10158d11317SOlof Johansson	help
102e96763ecSRobin Murphy	  Choose the type of IOMMU domain used to manage DMA API usage by
103e96763ecSRobin Murphy	  device drivers. The options here typically represent different
104e96763ecSRobin Murphy	  levels of tradeoff between robustness/security and performance,
105e96763ecSRobin Murphy	  depending on the IOMMU driver. Not all IOMMUs support all options.
106e96763ecSRobin Murphy	  This choice can be overridden at boot via the command line, and for
107e96763ecSRobin Murphy	  some devices also at runtime via sysfs.
10858d11317SOlof Johansson
109712d8f20SZhen Lei	  If unsure, keep the default.
110712d8f20SZhen Lei
111e96763ecSRobin Murphyconfig IOMMU_DEFAULT_DMA_STRICT
112e96763ecSRobin Murphy	bool "Translated - Strict"
113712d8f20SZhen Lei	help
114e96763ecSRobin Murphy	  Trusted devices use translation to restrict their access to only
115e96763ecSRobin Murphy	  DMA-mapped pages, with strict TLB invalidation on unmap. Equivalent
116e96763ecSRobin Murphy	  to passing "iommu.passthrough=0 iommu.strict=1" on the command line.
117712d8f20SZhen Lei
118e96763ecSRobin Murphy	  Untrusted devices always use this mode, with an additional layer of
119e96763ecSRobin Murphy	  bounce-buffering such that they cannot gain access to any unrelated
120e96763ecSRobin Murphy	  data within a mapped page.
121e96763ecSRobin Murphy
122e96763ecSRobin Murphyconfig IOMMU_DEFAULT_DMA_LAZY
123e96763ecSRobin Murphy	bool "Translated - Lazy"
124712d8f20SZhen Lei	help
125e96763ecSRobin Murphy	  Trusted devices use translation to restrict their access to only
126e96763ecSRobin Murphy	  DMA-mapped pages, but with "lazy" batched TLB invalidation. This
127e96763ecSRobin Murphy	  mode allows higher performance with some IOMMUs due to reduced TLB
128e96763ecSRobin Murphy	  flushing, but at the cost of reduced isolation since devices may be
129e96763ecSRobin Murphy	  able to access memory for some time after it has been unmapped.
130e96763ecSRobin Murphy	  Equivalent to passing "iommu.passthrough=0 iommu.strict=0" on the
131e96763ecSRobin Murphy	  command line.
132712d8f20SZhen Lei
133e96763ecSRobin Murphy	  If this mode is not supported by the IOMMU driver, the effective
134e96763ecSRobin Murphy	  runtime default will fall back to IOMMU_DEFAULT_DMA_STRICT.
135e96763ecSRobin Murphy
136e96763ecSRobin Murphyconfig IOMMU_DEFAULT_PASSTHROUGH
137e96763ecSRobin Murphy	bool "Passthrough"
138e96763ecSRobin Murphy	help
139e96763ecSRobin Murphy	  Trusted devices are identity-mapped, giving them unrestricted access
140e96763ecSRobin Murphy	  to memory with minimal performance overhead. Equivalent to passing
141e96763ecSRobin Murphy	  "iommu.passthrough=1" (historically "iommu=pt") on the command line.
142e96763ecSRobin Murphy
143e96763ecSRobin Murphy	  If this mode is not supported by the IOMMU driver, the effective
144e96763ecSRobin Murphy	  runtime default will fall back to IOMMU_DEFAULT_DMA_STRICT.
145712d8f20SZhen Lei
146712d8f20SZhen Leiendchoice
14758d11317SOlof Johansson
1484e0ee78fSHiroshi Doyuconfig OF_IOMMU
1494e0ee78fSHiroshi Doyu	def_bool y
1507eba1d51SWill Deacon	depends on OF && IOMMU_API
1514e0ee78fSHiroshi Doyu
1520db2e5d1SRobin Murphy# IOMMU-agnostic DMA-mapping layer
1530db2e5d1SRobin Murphyconfig IOMMU_DMA
1544bbdb725SLinus Torvalds	def_bool ARM64 || X86 || S390
155b5c58b2fSLeon Romanovsky	select DMA_OPS_HELPERS
1560db2e5d1SRobin Murphy	select IOMMU_API
1570db2e5d1SRobin Murphy	select IOMMU_IOVA
15859a68eb8SRobin Murphy	select NEED_SG_DMA_LENGTH
159861370f4SCatalin Marinas	select NEED_SG_DMA_FLAGS if SWIOTLB
1600db2e5d1SRobin Murphy
1617ba56472SFenghua Yu# Shared Virtual Addressing
1627ba56472SFenghua Yuconfig IOMMU_SVA
1638f23f5dbSJason Gunthorpe	select IOMMU_MM_DATA
164cfc78dfdSJean-Philippe Brucker	bool
165cfc78dfdSJean-Philippe Brucker
16617c51a0eSLu Baoluconfig IOMMU_IOPF
16717c51a0eSLu Baolu	bool
16817c51a0eSLu Baolu
169695093e3SVarun Sethiconfig FSL_PAMU
170695093e3SVarun Sethi	bool "Freescale IOMMU support"
171a4d98fb3SJoerg Roedel	depends on PCI
172af29d9faSJoerg Roedel	depends on PHYS_64BIT
173a0d284d2SAndy Fleming	depends on PPC_E500MC || (COMPILE_TEST && PPC)
174695093e3SVarun Sethi	select IOMMU_API
175695093e3SVarun Sethi	select GENERIC_ALLOCATOR
176695093e3SVarun Sethi	help
177695093e3SVarun Sethi	  Freescale PAMU support. PAMU is the IOMMU present on Freescale QorIQ platforms.
178695093e3SVarun Sethi	  PAMU can authorize memory access, remap the memory address, and remap I/O
179695093e3SVarun Sethi	  transaction types.
180695093e3SVarun Sethi
181b10f127eSOhad Ben-Cohen# MSM IOMMU support
182b10f127eSOhad Ben-Cohenconfig MSM_IOMMU
183b10f127eSOhad Ben-Cohen	bool "MSM IOMMU Support"
184477ab7a1SJoerg Roedel	depends on ARM
18518368ee2SDmitry Baryshkov	depends on ARCH_QCOM || COMPILE_TEST
186b10f127eSOhad Ben-Cohen	select IOMMU_API
187c9220fbdSSricharan R	select IOMMU_IO_PGTABLE_ARMV7S
188b10f127eSOhad Ben-Cohen	help
189b10f127eSOhad Ben-Cohen	  Support for the IOMMUs found on certain Qualcomm SOCs.
190b10f127eSOhad Ben-Cohen	  These IOMMUs allow virtualization of the address space used by most
191b10f127eSOhad Ben-Cohen	  cores within the multimedia subsystem.
192b10f127eSOhad Ben-Cohen
193b10f127eSOhad Ben-Cohen	  If unsure, say N here.
194b10f127eSOhad Ben-Cohen
195cbe94c6eSJerry Snitselaarsource "drivers/iommu/amd/Kconfig"
1960da188c8SRobin Murphysource "drivers/iommu/arm/Kconfig"
197ab65ba57SJerry Snitselaarsource "drivers/iommu/intel/Kconfig"
1982ff4bed7SJason Gunthorpesource "drivers/iommu/iommufd/Kconfig"
1995c0ebbd3STomasz Jeznachsource "drivers/iommu/riscv/Kconfig"
20004618252SLu Baolu
201d3f13810SSuresh Siddhaconfig IRQ_REMAP
202a446e219SKees Cook	bool "Support for Interrupt Remapping"
203a446e219SKees Cook	depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI
2048154f3c0SMarc Zyngier	select IRQ_MSI_LIB
205a7f7f624SMasahiro Yamada	help
206166e9278SOhad Ben-Cohen	  Supports Interrupt remapping for IO-APIC and MSI devices.
207166e9278SOhad Ben-Cohen	  To use x2apic mode in the CPU's which support x2APIC enhancements or
208166e9278SOhad Ben-Cohen	  to support platforms with CPU's having > 8 bit APIC ID, say Y.
20968255b62SJoerg Roedel
210fcf3a6efSOhad Ben-Cohen# OMAP IOMMU support
211fcf3a6efSOhad Ben-Cohenconfig OMAP_IOMMU
212fcf3a6efSOhad Ben-Cohen	bool "OMAP IOMMU Support"
213477ab7a1SJoerg Roedel	depends on ARCH_OMAP2PLUS || COMPILE_TEST
214fcf3a6efSOhad Ben-Cohen	select IOMMU_API
215a7f7f624SMasahiro Yamada	help
21606b718c0SGerd Hoffmann	  The OMAP3 media platform drivers depend on iommu support,
21706b718c0SGerd Hoffmann	  if you need them say Y here.
218fcf3a6efSOhad Ben-Cohen
219fcf3a6efSOhad Ben-Cohenconfig OMAP_IOMMU_DEBUG
22061c75352SSuman Anna	bool "Export OMAP IOMMU internals in DebugFS"
221baaa7b5dSLaurent Pinchart	depends on OMAP_IOMMU && DEBUG_FS
222a7f7f624SMasahiro Yamada	help
223fcf3a6efSOhad Ben-Cohen	  Select this to see extensive information about
224baaa7b5dSLaurent Pinchart	  the internal state of OMAP IOMMU in debugfs.
225fcf3a6efSOhad Ben-Cohen
226fcf3a6efSOhad Ben-Cohen	  Say N unless you know you need this.
227fcf3a6efSOhad Ben-Cohen
228c68a2921SDaniel Kurtzconfig ROCKCHIP_IOMMU
229c68a2921SDaniel Kurtz	bool "Rockchip IOMMU Support"
23011175886SJoerg Roedel	depends on ARCH_ROCKCHIP || COMPILE_TEST
231c68a2921SDaniel Kurtz	select IOMMU_API
232c68a2921SDaniel Kurtz	select ARM_DMA_USE_IOMMU
233c68a2921SDaniel Kurtz	help
234c68a2921SDaniel Kurtz	  Support for IOMMUs found on Rockchip rk32xx SOCs.
235c68a2921SDaniel Kurtz	  These IOMMUs allow virtualization of the address space used by most
236c68a2921SDaniel Kurtz	  cores within the multimedia subsystem.
237c68a2921SDaniel Kurtz	  Say Y here if you are using a Rockchip SoC that includes an IOMMU
238c68a2921SDaniel Kurtz	  device.
239c68a2921SDaniel Kurtz
2404100b8c2SMaxime Ripardconfig SUN50I_IOMMU
2414100b8c2SMaxime Ripard	bool "Allwinner H6 IOMMU Support"
242c7451e49SGeert Uytterhoeven	depends on HAS_DMA
2434100b8c2SMaxime Ripard	depends on ARCH_SUNXI || COMPILE_TEST
2444100b8c2SMaxime Ripard	select ARM_DMA_USE_IOMMU
2454100b8c2SMaxime Ripard	select IOMMU_API
2464100b8c2SMaxime Ripard	help
2474100b8c2SMaxime Ripard	  Support for the IOMMU introduced in the Allwinner H6 SoCs.
2484100b8c2SMaxime Ripard
2497a31f6f4SHiroshi DOYUconfig TEGRA_IOMMU_SMMU
25089184651SThierry Reding	bool "NVIDIA Tegra SMMU Support"
251fbcf5398SJohan Hovold	depends on ARCH_TEGRA || COMPILE_TEST
25289184651SThierry Reding	depends on TEGRA_AHB
25389184651SThierry Reding	depends on TEGRA_MC
2547a31f6f4SHiroshi DOYU	select IOMMU_API
2557a31f6f4SHiroshi DOYU	help
25689184651SThierry Reding	  This driver supports the IOMMU hardware (SMMU) found on NVIDIA Tegra
257588c43a7SThierry Reding	  SoCs (Tegra30 up to Tegra210).
2587a31f6f4SHiroshi DOYU
2592a96536eSKyongHo Choconfig EXYNOS_IOMMU
2602a96536eSKyongHo Cho	bool "Exynos IOMMU Support"
261b4ceb4a5SRobin Murphy	depends on ARCH_EXYNOS || COMPILE_TEST
262db3a7fd7SArnd Bergmann	depends on !CPU_BIG_ENDIAN # revisit driver if we can enable big-endian ptes
2632a96536eSKyongHo Cho	select IOMMU_API
2644802c1d0STushar Behera	select ARM_DMA_USE_IOMMU
2652a96536eSKyongHo Cho	help
2662a96536eSKyongHo Cho	  Support for the IOMMU (System MMU) of Samsung Exynos application
2675455d700SSachin Kamat	  processor family. This enables H/W multimedia accelerators to see
2685455d700SSachin Kamat	  non-linear physical memory chunks as linear memory in their
2695455d700SSachin Kamat	  address space.
2702a96536eSKyongHo Cho
2712a96536eSKyongHo Cho	  If unsure, say N here.
2722a96536eSKyongHo Cho
2732a96536eSKyongHo Choconfig EXYNOS_IOMMU_DEBUG
2742a96536eSKyongHo Cho	bool "Debugging log for Exynos IOMMU"
2752a96536eSKyongHo Cho	depends on EXYNOS_IOMMU
2762a96536eSKyongHo Cho	help
2772a96536eSKyongHo Cho	  Select this to see the detailed log message that shows what
2785455d700SSachin Kamat	  happens in the IOMMU driver.
2792a96536eSKyongHo Cho
2805455d700SSachin Kamat	  Say N unless you need kernel log message for IOMMU debugging.
2812a96536eSKyongHo Cho
282d25a2a16SLaurent Pinchartconfig IPMMU_VMSA
283d25a2a16SLaurent Pinchart	bool "Renesas VMSA-compatible IPMMU"
284d286a58bSRobin Murphy	depends on ARCH_RENESAS || COMPILE_TEST
285e332003bSRandy Dunlap	depends on ARM || ARM64 || COMPILE_TEST
286d286a58bSRobin Murphy	depends on !GENERIC_ATOMIC64	# for IOMMU_IO_PGTABLE_LPAE
287d25a2a16SLaurent Pinchart	select IOMMU_API
288f20ed39fSLaurent Pinchart	select IOMMU_IO_PGTABLE_LPAE
289d25a2a16SLaurent Pinchart	select ARM_DMA_USE_IOMMU
290d25a2a16SLaurent Pinchart	help
29115021d36SGeert Uytterhoeven	  Support for the Renesas VMSA-compatible IPMMU found in the R-Mobile
292d714aaa7SLad Prabhakar	  APE6, R-Car Gen{2,3} and RZ/G{1,2} SoCs.
293d25a2a16SLaurent Pinchart
294d25a2a16SLaurent Pinchart	  If unsure, say N.
295d25a2a16SLaurent Pinchart
2964e13c1acSAlexey Kardashevskiyconfig SPAPR_TCE_IOMMU
2974e13c1acSAlexey Kardashevskiy	bool "sPAPR TCE IOMMU Support"
2989dd124b6SKrzysztof Kozlowski	depends on PPC_POWERNV || PPC_PSERIES
2994e13c1acSAlexey Kardashevskiy	select IOMMU_API
3004e13c1acSAlexey Kardashevskiy	help
3014e13c1acSAlexey Kardashevskiy	  Enables bits of IOMMU API required by VFIO. The iommu_ops
3024e13c1acSAlexey Kardashevskiy	  is not implemented as it is not necessary for VFIO.
3034e13c1acSAlexey Kardashevskiy
30446d1fb07SSven Peterconfig APPLE_DART
30546d1fb07SSven Peter	tristate "Apple DART IOMMU Support"
306d286a58bSRobin Murphy	depends on ARCH_APPLE || COMPILE_TEST
307d286a58bSRobin Murphy	depends on !GENERIC_ATOMIC64	# for IOMMU_IO_PGTABLE_DART
30846d1fb07SSven Peter	select IOMMU_API
309745ef109SJanne Grunau	select IOMMU_IO_PGTABLE_DART
31046d1fb07SSven Peter	help
31146d1fb07SSven Peter	  Support for Apple DART (Device Address Resolution Table) IOMMUs
31246d1fb07SSven Peter	  found in Apple ARM SoCs like the M1.
31346d1fb07SSven Peter	  This IOMMU is required for most peripherals using DMA to access
31446d1fb07SSven Peter	  the main memory.
31546d1fb07SSven Peter
31646d1fb07SSven Peter	  Say Y here if you are using an Apple SoC.
31746d1fb07SSven Peter
3188128f23cSGerald Schaeferconfig S390_IOMMU
3198128f23cSGerald Schaefer	def_bool y if S390 && PCI
3208128f23cSGerald Schaefer	depends on S390 && PCI
3218128f23cSGerald Schaefer	select IOMMU_API
3228128f23cSGerald Schaefer	help
3238128f23cSGerald Schaefer	  Support for the IOMMU API for s390 PCI devices.
3248128f23cSGerald Schaefer
3250df4fabeSYong Wuconfig MTK_IOMMU
32618d8c74eSYong Wu	tristate "MediaTek IOMMU Support"
3270df4fabeSYong Wu	depends on ARCH_MEDIATEK || COMPILE_TEST
3281928832fSArnd Bergmann	select ARM_DMA_USE_IOMMU
3290df4fabeSYong Wu	select IOMMU_API
3300df4fabeSYong Wu	select IOMMU_IO_PGTABLE_ARMV7S
3310df4fabeSYong Wu	select MEMORY
3320df4fabeSYong Wu	select MTK_SMI
3330df4fabeSYong Wu	help
3340df4fabeSYong Wu	  Support for the M4U on certain Mediatek SOCs. M4U is MultiMedia
3350df4fabeSYong Wu	  Memory Management Unit. This option enables remapping of DMA memory
3360df4fabeSYong Wu	  accesses for the multimedia subsystem.
3370df4fabeSYong Wu
3380df4fabeSYong Wu	  If unsure, say N here.
3390df4fabeSYong Wu
340b17336c5SHonghui Zhangconfig MTK_IOMMU_V1
3418de000cfSYong Wu	tristate "MediaTek IOMMU Version 1 (M4U gen1) Support"
342ba40f9dcSRobin Murphy	depends on (ARCH_MEDIATEK && ARM) || COMPILE_TEST
343b17336c5SHonghui Zhang	select ARM_DMA_USE_IOMMU
344b17336c5SHonghui Zhang	select IOMMU_API
345b17336c5SHonghui Zhang	select MEMORY
346b17336c5SHonghui Zhang	select MTK_SMI
347b17336c5SHonghui Zhang	help
348b17336c5SHonghui Zhang	  Support for the M4U on certain Mediatek SoCs. M4U generation 1 HW is
349b17336c5SHonghui Zhang	  Multimedia Memory Managememt Unit. This option enables remapping of
350b17336c5SHonghui Zhang	  DMA memory accesses for the multimedia subsystem.
351b17336c5SHonghui Zhang
352b17336c5SHonghui Zhang	  if unsure, say N here.
353b17336c5SHonghui Zhang
354edcd69abSJean-Philippe Bruckerconfig VIRTIO_IOMMU
355fa4afd78SJean-Philippe Brucker	tristate "Virtio IOMMU driver"
356fa4afd78SJean-Philippe Brucker	depends on VIRTIO
3578ce4904bSJean-Philippe Brucker	depends on (ARM64 || X86)
358edcd69abSJean-Philippe Brucker	select IOMMU_API
359edcd69abSJean-Philippe Brucker	select INTERVAL_TREE
3603cf48554SJean-Philippe Brucker	select ACPI_VIOT if ACPI
361edcd69abSJean-Philippe Brucker	help
362edcd69abSJean-Philippe Brucker	  Para-virtualised IOMMU driver with virtio.
363edcd69abSJean-Philippe Brucker
364edcd69abSJean-Philippe Brucker	  Say Y here if you intend to run this kernel as a guest.
365edcd69abSJean-Philippe Brucker
366b23e4fc4SChunyan Zhangconfig SPRD_IOMMU
367b23e4fc4SChunyan Zhang	tristate "Unisoc IOMMU Support"
368b23e4fc4SChunyan Zhang	depends on ARCH_SPRD || COMPILE_TEST
369b23e4fc4SChunyan Zhang	select IOMMU_API
370b23e4fc4SChunyan Zhang	help
371b23e4fc4SChunyan Zhang	  Support for IOMMU on Unisoc's SoCs, this IOMMU can be used by
372b23e4fc4SChunyan Zhang	  Unisoc's multimedia devices, such as display, Image codec(jpeg)
373b23e4fc4SChunyan Zhang	  and a few signal processors, including VSP(video), GSP(graphic),
374b23e4fc4SChunyan Zhang	  ISP(image), and CPP(camera pixel processor), etc.
375b23e4fc4SChunyan Zhang
376b23e4fc4SChunyan Zhang	  Say Y here if you want to use the multimedia devices listed above.
377b23e4fc4SChunyan Zhang
378*917ace84SBenjamin Gaignardconfig VSI_IOMMU
379*917ace84SBenjamin Gaignard	tristate "Verisilicon IOMMU Support"
380*917ace84SBenjamin Gaignard	depends on (ARCH_ROCKCHIP && ARM64) || COMPILE_TEST
381*917ace84SBenjamin Gaignard	select IOMMU_API
382*917ace84SBenjamin Gaignard	help
383*917ace84SBenjamin Gaignard	  Support for IOMMUs used by Verisilicon sub-systems like video
384*917ace84SBenjamin Gaignard	  decoders or encoder hardware blocks.
385*917ace84SBenjamin Gaignard
386*917ace84SBenjamin Gaignard	  Say Y here if you want to use this IOMMU in front of these
387*917ace84SBenjamin Gaignard	  hardware blocks.
388*917ace84SBenjamin Gaignard
389466ae697SMostafa Salehconfig IOMMU_DEBUG_PAGEALLOC
390466ae697SMostafa Saleh	bool "Debug IOMMU mappings against page allocations"
391466ae697SMostafa Saleh	depends on DEBUG_PAGEALLOC && IOMMU_API && PAGE_EXTENSION
392466ae697SMostafa Saleh	help
393466ae697SMostafa Saleh	  This enables a consistency check between the kernel page allocator and
394466ae697SMostafa Saleh	  the IOMMU subsystem. It verifies that pages being allocated or freed
395466ae697SMostafa Saleh	  are not currently mapped in any IOMMU domain.
396466ae697SMostafa Saleh
397466ae697SMostafa Saleh	  This helps detect DMA use-after-free bugs where a driver frees a page
398466ae697SMostafa Saleh	  but forgets to unmap it from the IOMMU, potentially allowing a device
399466ae697SMostafa Saleh	  to overwrite memory that the kernel has repurposed.
400466ae697SMostafa Saleh
401466ae697SMostafa Saleh	  These checks are best-effort and may not detect all problems.
402466ae697SMostafa Saleh
403466ae697SMostafa Saleh	  Due to performance overhead, this feature is disabled by default.
404466ae697SMostafa Saleh	  You must enable "iommu.debug_pagealloc" from the kernel command
405466ae697SMostafa Saleh	  line to activate the runtime checks.
406466ae697SMostafa Saleh
407466ae697SMostafa Saleh	  If unsure, say N.
40868255b62SJoerg Roedelendif # IOMMU_SUPPORT
4097c5b184dSJason Gunthorpe
4107c5b184dSJason Gunthorpesource "drivers/iommu/generic_pt/Kconfig"
411