162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_ci# The IOVA library may also be used by non-IOMMU_API users
362306a36Sopenharmony_ciconfig IOMMU_IOVA
462306a36Sopenharmony_ci	tristate
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci# IOMMU_API always gets selected by whoever wants it.
762306a36Sopenharmony_ciconfig IOMMU_API
862306a36Sopenharmony_ci	bool
962306a36Sopenharmony_ci
1062306a36Sopenharmony_cimenuconfig IOMMU_SUPPORT
1162306a36Sopenharmony_ci	bool "IOMMU Hardware Support"
1262306a36Sopenharmony_ci	depends on MMU
1362306a36Sopenharmony_ci	default y
1462306a36Sopenharmony_ci	help
1562306a36Sopenharmony_ci	  Say Y here if you want to compile device drivers for IO Memory
1662306a36Sopenharmony_ci	  Management Units into the kernel. These devices usually allow to
1762306a36Sopenharmony_ci	  remap DMA requests and/or remap interrupts from other devices on the
1862306a36Sopenharmony_ci	  system.
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ciif IOMMU_SUPPORT
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_cimenu "Generic IOMMU Pagetable Support"
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci# Selected by the actual pagetable implementations
2562306a36Sopenharmony_ciconfig IOMMU_IO_PGTABLE
2662306a36Sopenharmony_ci	bool
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ciconfig IOMMU_IO_PGTABLE_LPAE
2962306a36Sopenharmony_ci	bool "ARMv7/v8 Long Descriptor Format"
3062306a36Sopenharmony_ci	select IOMMU_IO_PGTABLE
3162306a36Sopenharmony_ci	depends on ARM || ARM64 || COMPILE_TEST
3262306a36Sopenharmony_ci	depends on !GENERIC_ATOMIC64	# for cmpxchg64()
3362306a36Sopenharmony_ci	help
3462306a36Sopenharmony_ci	  Enable support for the ARM long descriptor pagetable format.
3562306a36Sopenharmony_ci	  This allocator supports 4K/2M/1G, 16K/32M and 64K/512M page
3662306a36Sopenharmony_ci	  sizes at both stage-1 and stage-2, as well as address spaces
3762306a36Sopenharmony_ci	  up to 48-bits in size.
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ciconfig IOMMU_IO_PGTABLE_LPAE_SELFTEST
4062306a36Sopenharmony_ci	bool "LPAE selftests"
4162306a36Sopenharmony_ci	depends on IOMMU_IO_PGTABLE_LPAE
4262306a36Sopenharmony_ci	help
4362306a36Sopenharmony_ci	  Enable self-tests for LPAE page table allocator. This performs
4462306a36Sopenharmony_ci	  a series of page-table consistency checks during boot.
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci	  If unsure, say N here.
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ciconfig IOMMU_IO_PGTABLE_ARMV7S
4962306a36Sopenharmony_ci	bool "ARMv7/v8 Short Descriptor Format"
5062306a36Sopenharmony_ci	select IOMMU_IO_PGTABLE
5162306a36Sopenharmony_ci	depends on ARM || ARM64 || COMPILE_TEST
5262306a36Sopenharmony_ci	help
5362306a36Sopenharmony_ci	  Enable support for the ARM Short-descriptor pagetable format.
5462306a36Sopenharmony_ci	  This supports 32-bit virtual and physical addresses mapped using
5562306a36Sopenharmony_ci	  2-level tables with 4KB pages/1MB sections, and contiguous entries
5662306a36Sopenharmony_ci	  for 64KB pages/16MB supersections if indicated by the IOMMU driver.
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ciconfig IOMMU_IO_PGTABLE_ARMV7S_SELFTEST
5962306a36Sopenharmony_ci	bool "ARMv7s selftests"
6062306a36Sopenharmony_ci	depends on IOMMU_IO_PGTABLE_ARMV7S
6162306a36Sopenharmony_ci	help
6262306a36Sopenharmony_ci	  Enable self-tests for ARMv7s page table allocator. This performs
6362306a36Sopenharmony_ci	  a series of page-table consistency checks during boot.
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci	  If unsure, say N here.
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ciconfig IOMMU_IO_PGTABLE_DART
6862306a36Sopenharmony_ci	bool "Apple DART Formats"
6962306a36Sopenharmony_ci	select IOMMU_IO_PGTABLE
7062306a36Sopenharmony_ci	depends on ARM64 || COMPILE_TEST
7162306a36Sopenharmony_ci	depends on !GENERIC_ATOMIC64	# for cmpxchg64()
7262306a36Sopenharmony_ci	help
7362306a36Sopenharmony_ci	  Enable support for the Apple DART pagetable formats. These include
7462306a36Sopenharmony_ci	  the t8020 and t6000/t8110 DART formats used in Apple M1/M2 family
7562306a36Sopenharmony_ci	  SoCs.
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci	  If unsure, say N here.
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ciendmenu
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ciconfig IOMMU_DEBUGFS
8262306a36Sopenharmony_ci	bool "Export IOMMU internals in DebugFS"
8362306a36Sopenharmony_ci	depends on DEBUG_FS
8462306a36Sopenharmony_ci	help
8562306a36Sopenharmony_ci	  Allows exposure of IOMMU device internals. This option enables
8662306a36Sopenharmony_ci	  the use of debugfs by IOMMU drivers as required. Devices can,
8762306a36Sopenharmony_ci	  at initialization time, cause the IOMMU code to create a top-level
8862306a36Sopenharmony_ci	  debug/iommu directory, and then populate a subdirectory with
8962306a36Sopenharmony_ci	  entries as required.
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_cichoice
9262306a36Sopenharmony_ci	prompt "IOMMU default domain type"
9362306a36Sopenharmony_ci	depends on IOMMU_API
9462306a36Sopenharmony_ci	default IOMMU_DEFAULT_DMA_LAZY if X86 || IA64
9562306a36Sopenharmony_ci	default IOMMU_DEFAULT_DMA_STRICT
9662306a36Sopenharmony_ci	help
9762306a36Sopenharmony_ci	  Choose the type of IOMMU domain used to manage DMA API usage by
9862306a36Sopenharmony_ci	  device drivers. The options here typically represent different
9962306a36Sopenharmony_ci	  levels of tradeoff between robustness/security and performance,
10062306a36Sopenharmony_ci	  depending on the IOMMU driver. Not all IOMMUs support all options.
10162306a36Sopenharmony_ci	  This choice can be overridden at boot via the command line, and for
10262306a36Sopenharmony_ci	  some devices also at runtime via sysfs.
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci	  If unsure, keep the default.
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ciconfig IOMMU_DEFAULT_DMA_STRICT
10762306a36Sopenharmony_ci	bool "Translated - Strict"
10862306a36Sopenharmony_ci	help
10962306a36Sopenharmony_ci	  Trusted devices use translation to restrict their access to only
11062306a36Sopenharmony_ci	  DMA-mapped pages, with strict TLB invalidation on unmap. Equivalent
11162306a36Sopenharmony_ci	  to passing "iommu.passthrough=0 iommu.strict=1" on the command line.
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci	  Untrusted devices always use this mode, with an additional layer of
11462306a36Sopenharmony_ci	  bounce-buffering such that they cannot gain access to any unrelated
11562306a36Sopenharmony_ci	  data within a mapped page.
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_ciconfig IOMMU_DEFAULT_DMA_LAZY
11862306a36Sopenharmony_ci	bool "Translated - Lazy"
11962306a36Sopenharmony_ci	help
12062306a36Sopenharmony_ci	  Trusted devices use translation to restrict their access to only
12162306a36Sopenharmony_ci	  DMA-mapped pages, but with "lazy" batched TLB invalidation. This
12262306a36Sopenharmony_ci	  mode allows higher performance with some IOMMUs due to reduced TLB
12362306a36Sopenharmony_ci	  flushing, but at the cost of reduced isolation since devices may be
12462306a36Sopenharmony_ci	  able to access memory for some time after it has been unmapped.
12562306a36Sopenharmony_ci	  Equivalent to passing "iommu.passthrough=0 iommu.strict=0" on the
12662306a36Sopenharmony_ci	  command line.
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ci	  If this mode is not supported by the IOMMU driver, the effective
12962306a36Sopenharmony_ci	  runtime default will fall back to IOMMU_DEFAULT_DMA_STRICT.
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ciconfig IOMMU_DEFAULT_PASSTHROUGH
13262306a36Sopenharmony_ci	bool "Passthrough"
13362306a36Sopenharmony_ci	help
13462306a36Sopenharmony_ci	  Trusted devices are identity-mapped, giving them unrestricted access
13562306a36Sopenharmony_ci	  to memory with minimal performance overhead. Equivalent to passing
13662306a36Sopenharmony_ci	  "iommu.passthrough=1" (historically "iommu=pt") on the command line.
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_ci	  If this mode is not supported by the IOMMU driver, the effective
13962306a36Sopenharmony_ci	  runtime default will fall back to IOMMU_DEFAULT_DMA_STRICT.
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ciendchoice
14262306a36Sopenharmony_ci
14362306a36Sopenharmony_ciconfig OF_IOMMU
14462306a36Sopenharmony_ci	def_bool y
14562306a36Sopenharmony_ci	depends on OF && IOMMU_API
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci# IOMMU-agnostic DMA-mapping layer
14862306a36Sopenharmony_ciconfig IOMMU_DMA
14962306a36Sopenharmony_ci	def_bool ARM64 || IA64 || X86
15062306a36Sopenharmony_ci	select DMA_OPS
15162306a36Sopenharmony_ci	select IOMMU_API
15262306a36Sopenharmony_ci	select IOMMU_IOVA
15362306a36Sopenharmony_ci	select IRQ_MSI_IOMMU
15462306a36Sopenharmony_ci	select NEED_SG_DMA_LENGTH
15562306a36Sopenharmony_ci	select NEED_SG_DMA_FLAGS if SWIOTLB
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ci# Shared Virtual Addressing
15862306a36Sopenharmony_ciconfig IOMMU_SVA
15962306a36Sopenharmony_ci	bool
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ciconfig FSL_PAMU
16262306a36Sopenharmony_ci	bool "Freescale IOMMU support"
16362306a36Sopenharmony_ci	depends on PCI
16462306a36Sopenharmony_ci	depends on PHYS_64BIT
16562306a36Sopenharmony_ci	depends on PPC_E500MC || (COMPILE_TEST && PPC)
16662306a36Sopenharmony_ci	select IOMMU_API
16762306a36Sopenharmony_ci	select GENERIC_ALLOCATOR
16862306a36Sopenharmony_ci	help
16962306a36Sopenharmony_ci	  Freescale PAMU support. PAMU is the IOMMU present on Freescale QorIQ platforms.
17062306a36Sopenharmony_ci	  PAMU can authorize memory access, remap the memory address, and remap I/O
17162306a36Sopenharmony_ci	  transaction types.
17262306a36Sopenharmony_ci
17362306a36Sopenharmony_ci# MSM IOMMU support
17462306a36Sopenharmony_ciconfig MSM_IOMMU
17562306a36Sopenharmony_ci	bool "MSM IOMMU Support"
17662306a36Sopenharmony_ci	depends on ARM
17762306a36Sopenharmony_ci	depends on ARCH_MSM8X60 || ARCH_MSM8960 || COMPILE_TEST
17862306a36Sopenharmony_ci	select IOMMU_API
17962306a36Sopenharmony_ci	select IOMMU_IO_PGTABLE_ARMV7S
18062306a36Sopenharmony_ci	help
18162306a36Sopenharmony_ci	  Support for the IOMMUs found on certain Qualcomm SOCs.
18262306a36Sopenharmony_ci	  These IOMMUs allow virtualization of the address space used by most
18362306a36Sopenharmony_ci	  cores within the multimedia subsystem.
18462306a36Sopenharmony_ci
18562306a36Sopenharmony_ci	  If unsure, say N here.
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_cisource "drivers/iommu/amd/Kconfig"
18862306a36Sopenharmony_cisource "drivers/iommu/intel/Kconfig"
18962306a36Sopenharmony_cisource "drivers/iommu/iommufd/Kconfig"
19062306a36Sopenharmony_ci
19162306a36Sopenharmony_ciconfig IRQ_REMAP
19262306a36Sopenharmony_ci	bool "Support for Interrupt Remapping"
19362306a36Sopenharmony_ci	depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI
19462306a36Sopenharmony_ci	select DMAR_TABLE if INTEL_IOMMU
19562306a36Sopenharmony_ci	help
19662306a36Sopenharmony_ci	  Supports Interrupt remapping for IO-APIC and MSI devices.
19762306a36Sopenharmony_ci	  To use x2apic mode in the CPU's which support x2APIC enhancements or
19862306a36Sopenharmony_ci	  to support platforms with CPU's having > 8 bit APIC ID, say Y.
19962306a36Sopenharmony_ci
20062306a36Sopenharmony_ci# OMAP IOMMU support
20162306a36Sopenharmony_ciconfig OMAP_IOMMU
20262306a36Sopenharmony_ci	bool "OMAP IOMMU Support"
20362306a36Sopenharmony_ci	depends on ARCH_OMAP2PLUS || COMPILE_TEST
20462306a36Sopenharmony_ci	select IOMMU_API
20562306a36Sopenharmony_ci	help
20662306a36Sopenharmony_ci	  The OMAP3 media platform drivers depend on iommu support,
20762306a36Sopenharmony_ci	  if you need them say Y here.
20862306a36Sopenharmony_ci
20962306a36Sopenharmony_ciconfig OMAP_IOMMU_DEBUG
21062306a36Sopenharmony_ci	bool "Export OMAP IOMMU internals in DebugFS"
21162306a36Sopenharmony_ci	depends on OMAP_IOMMU && DEBUG_FS
21262306a36Sopenharmony_ci	help
21362306a36Sopenharmony_ci	  Select this to see extensive information about
21462306a36Sopenharmony_ci	  the internal state of OMAP IOMMU in debugfs.
21562306a36Sopenharmony_ci
21662306a36Sopenharmony_ci	  Say N unless you know you need this.
21762306a36Sopenharmony_ci
21862306a36Sopenharmony_ciconfig ROCKCHIP_IOMMU
21962306a36Sopenharmony_ci	bool "Rockchip IOMMU Support"
22062306a36Sopenharmony_ci	depends on ARCH_ROCKCHIP || COMPILE_TEST
22162306a36Sopenharmony_ci	select IOMMU_API
22262306a36Sopenharmony_ci	select ARM_DMA_USE_IOMMU
22362306a36Sopenharmony_ci	help
22462306a36Sopenharmony_ci	  Support for IOMMUs found on Rockchip rk32xx SOCs.
22562306a36Sopenharmony_ci	  These IOMMUs allow virtualization of the address space used by most
22662306a36Sopenharmony_ci	  cores within the multimedia subsystem.
22762306a36Sopenharmony_ci	  Say Y here if you are using a Rockchip SoC that includes an IOMMU
22862306a36Sopenharmony_ci	  device.
22962306a36Sopenharmony_ci
23062306a36Sopenharmony_ciconfig SUN50I_IOMMU
23162306a36Sopenharmony_ci	bool "Allwinner H6 IOMMU Support"
23262306a36Sopenharmony_ci	depends on HAS_DMA
23362306a36Sopenharmony_ci	depends on ARCH_SUNXI || COMPILE_TEST
23462306a36Sopenharmony_ci	select ARM_DMA_USE_IOMMU
23562306a36Sopenharmony_ci	select IOMMU_API
23662306a36Sopenharmony_ci	help
23762306a36Sopenharmony_ci	  Support for the IOMMU introduced in the Allwinner H6 SoCs.
23862306a36Sopenharmony_ci
23962306a36Sopenharmony_ciconfig TEGRA_IOMMU_GART
24062306a36Sopenharmony_ci	bool "Tegra GART IOMMU Support"
24162306a36Sopenharmony_ci	depends on ARCH_TEGRA_2x_SOC
24262306a36Sopenharmony_ci	depends on TEGRA_MC
24362306a36Sopenharmony_ci	select IOMMU_API
24462306a36Sopenharmony_ci	help
24562306a36Sopenharmony_ci	  Enables support for remapping discontiguous physical memory
24662306a36Sopenharmony_ci	  shared with the operating system into contiguous I/O virtual
24762306a36Sopenharmony_ci	  space through the GART (Graphics Address Relocation Table)
24862306a36Sopenharmony_ci	  hardware included on Tegra SoCs.
24962306a36Sopenharmony_ci
25062306a36Sopenharmony_ciconfig TEGRA_IOMMU_SMMU
25162306a36Sopenharmony_ci	bool "NVIDIA Tegra SMMU Support"
25262306a36Sopenharmony_ci	depends on ARCH_TEGRA
25362306a36Sopenharmony_ci	depends on TEGRA_AHB
25462306a36Sopenharmony_ci	depends on TEGRA_MC
25562306a36Sopenharmony_ci	select IOMMU_API
25662306a36Sopenharmony_ci	help
25762306a36Sopenharmony_ci	  This driver supports the IOMMU hardware (SMMU) found on NVIDIA Tegra
25862306a36Sopenharmony_ci	  SoCs (Tegra30 up to Tegra210).
25962306a36Sopenharmony_ci
26062306a36Sopenharmony_ciconfig EXYNOS_IOMMU
26162306a36Sopenharmony_ci	bool "Exynos IOMMU Support"
26262306a36Sopenharmony_ci	depends on ARCH_EXYNOS || COMPILE_TEST
26362306a36Sopenharmony_ci	depends on !CPU_BIG_ENDIAN # revisit driver if we can enable big-endian ptes
26462306a36Sopenharmony_ci	select IOMMU_API
26562306a36Sopenharmony_ci	select ARM_DMA_USE_IOMMU
26662306a36Sopenharmony_ci	help
26762306a36Sopenharmony_ci	  Support for the IOMMU (System MMU) of Samsung Exynos application
26862306a36Sopenharmony_ci	  processor family. This enables H/W multimedia accelerators to see
26962306a36Sopenharmony_ci	  non-linear physical memory chunks as linear memory in their
27062306a36Sopenharmony_ci	  address space.
27162306a36Sopenharmony_ci
27262306a36Sopenharmony_ci	  If unsure, say N here.
27362306a36Sopenharmony_ci
27462306a36Sopenharmony_ciconfig EXYNOS_IOMMU_DEBUG
27562306a36Sopenharmony_ci	bool "Debugging log for Exynos IOMMU"
27662306a36Sopenharmony_ci	depends on EXYNOS_IOMMU
27762306a36Sopenharmony_ci	help
27862306a36Sopenharmony_ci	  Select this to see the detailed log message that shows what
27962306a36Sopenharmony_ci	  happens in the IOMMU driver.
28062306a36Sopenharmony_ci
28162306a36Sopenharmony_ci	  Say N unless you need kernel log message for IOMMU debugging.
28262306a36Sopenharmony_ci
28362306a36Sopenharmony_ciconfig IPMMU_VMSA
28462306a36Sopenharmony_ci	bool "Renesas VMSA-compatible IPMMU"
28562306a36Sopenharmony_ci	depends on ARCH_RENESAS || COMPILE_TEST
28662306a36Sopenharmony_ci	depends on ARM || ARM64 || COMPILE_TEST
28762306a36Sopenharmony_ci	depends on !GENERIC_ATOMIC64	# for IOMMU_IO_PGTABLE_LPAE
28862306a36Sopenharmony_ci	select IOMMU_API
28962306a36Sopenharmony_ci	select IOMMU_IO_PGTABLE_LPAE
29062306a36Sopenharmony_ci	select ARM_DMA_USE_IOMMU
29162306a36Sopenharmony_ci	help
29262306a36Sopenharmony_ci	  Support for the Renesas VMSA-compatible IPMMU found in the R-Mobile
29362306a36Sopenharmony_ci	  APE6, R-Car Gen{2,3} and RZ/G{1,2} SoCs.
29462306a36Sopenharmony_ci
29562306a36Sopenharmony_ci	  If unsure, say N.
29662306a36Sopenharmony_ci
29762306a36Sopenharmony_ciconfig SPAPR_TCE_IOMMU
29862306a36Sopenharmony_ci	bool "sPAPR TCE IOMMU Support"
29962306a36Sopenharmony_ci	depends on PPC_POWERNV || PPC_PSERIES
30062306a36Sopenharmony_ci	select IOMMU_API
30162306a36Sopenharmony_ci	help
30262306a36Sopenharmony_ci	  Enables bits of IOMMU API required by VFIO. The iommu_ops
30362306a36Sopenharmony_ci	  is not implemented as it is not necessary for VFIO.
30462306a36Sopenharmony_ci
30562306a36Sopenharmony_ciconfig APPLE_DART
30662306a36Sopenharmony_ci	tristate "Apple DART IOMMU Support"
30762306a36Sopenharmony_ci	depends on ARCH_APPLE || COMPILE_TEST
30862306a36Sopenharmony_ci	depends on !GENERIC_ATOMIC64	# for IOMMU_IO_PGTABLE_DART
30962306a36Sopenharmony_ci	select IOMMU_API
31062306a36Sopenharmony_ci	select IOMMU_IO_PGTABLE_DART
31162306a36Sopenharmony_ci	default ARCH_APPLE
31262306a36Sopenharmony_ci	help
31362306a36Sopenharmony_ci	  Support for Apple DART (Device Address Resolution Table) IOMMUs
31462306a36Sopenharmony_ci	  found in Apple ARM SoCs like the M1.
31562306a36Sopenharmony_ci	  This IOMMU is required for most peripherals using DMA to access
31662306a36Sopenharmony_ci	  the main memory.
31762306a36Sopenharmony_ci
31862306a36Sopenharmony_ci	  Say Y here if you are using an Apple SoC.
31962306a36Sopenharmony_ci
32062306a36Sopenharmony_ci# ARM IOMMU support
32162306a36Sopenharmony_ciconfig ARM_SMMU
32262306a36Sopenharmony_ci	tristate "ARM Ltd. System MMU (SMMU) Support"
32362306a36Sopenharmony_ci	depends on ARM64 || ARM || COMPILE_TEST
32462306a36Sopenharmony_ci	depends on !GENERIC_ATOMIC64	# for IOMMU_IO_PGTABLE_LPAE
32562306a36Sopenharmony_ci	select IOMMU_API
32662306a36Sopenharmony_ci	select IOMMU_IO_PGTABLE_LPAE
32762306a36Sopenharmony_ci	select ARM_DMA_USE_IOMMU if ARM
32862306a36Sopenharmony_ci	help
32962306a36Sopenharmony_ci	  Support for implementations of the ARM System MMU architecture
33062306a36Sopenharmony_ci	  versions 1 and 2.
33162306a36Sopenharmony_ci
33262306a36Sopenharmony_ci	  Say Y here if your SoC includes an IOMMU device implementing
33362306a36Sopenharmony_ci	  the ARM SMMU architecture.
33462306a36Sopenharmony_ci
33562306a36Sopenharmony_ciconfig ARM_SMMU_LEGACY_DT_BINDINGS
33662306a36Sopenharmony_ci	bool "Support the legacy \"mmu-masters\" devicetree bindings"
33762306a36Sopenharmony_ci	depends on ARM_SMMU=y && OF
33862306a36Sopenharmony_ci	help
33962306a36Sopenharmony_ci	  Support for the badly designed and deprecated "mmu-masters"
34062306a36Sopenharmony_ci	  devicetree bindings. This allows some DMA masters to attach
34162306a36Sopenharmony_ci	  to the SMMU but does not provide any support via the DMA API.
34262306a36Sopenharmony_ci	  If you're lucky, you might be able to get VFIO up and running.
34362306a36Sopenharmony_ci
34462306a36Sopenharmony_ci	  If you say Y here then you'll make me very sad. Instead, say N
34562306a36Sopenharmony_ci	  and move your firmware to the utopian future that was 2016.
34662306a36Sopenharmony_ci
34762306a36Sopenharmony_ciconfig ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT
34862306a36Sopenharmony_ci	bool "Default to disabling bypass on ARM SMMU v1 and v2"
34962306a36Sopenharmony_ci	depends on ARM_SMMU
35062306a36Sopenharmony_ci	default y
35162306a36Sopenharmony_ci	help
35262306a36Sopenharmony_ci	  Say Y here to (by default) disable bypass streams such that
35362306a36Sopenharmony_ci	  incoming transactions from devices that are not attached to
35462306a36Sopenharmony_ci	  an iommu domain will report an abort back to the device and
35562306a36Sopenharmony_ci	  will not be allowed to pass through the SMMU.
35662306a36Sopenharmony_ci
35762306a36Sopenharmony_ci	  Any old kernels that existed before this KConfig was
35862306a36Sopenharmony_ci	  introduced would default to _allowing_ bypass (AKA the
35962306a36Sopenharmony_ci	  equivalent of NO for this config).  However the default for
36062306a36Sopenharmony_ci	  this option is YES because the old behavior is insecure.
36162306a36Sopenharmony_ci
36262306a36Sopenharmony_ci	  There are few reasons to allow unmatched stream bypass, and
36362306a36Sopenharmony_ci	  even fewer good ones.  If saying YES here breaks your board
36462306a36Sopenharmony_ci	  you should work on fixing your board.  This KConfig option
36562306a36Sopenharmony_ci	  is expected to be removed in the future and we'll simply
36662306a36Sopenharmony_ci	  hardcode the bypass disable in the code.
36762306a36Sopenharmony_ci
36862306a36Sopenharmony_ci	  NOTE: the kernel command line parameter
36962306a36Sopenharmony_ci	  'arm-smmu.disable_bypass' will continue to override this
37062306a36Sopenharmony_ci	  config.
37162306a36Sopenharmony_ci
37262306a36Sopenharmony_ciconfig ARM_SMMU_QCOM
37362306a36Sopenharmony_ci	def_tristate y
37462306a36Sopenharmony_ci	depends on ARM_SMMU && ARCH_QCOM
37562306a36Sopenharmony_ci	select QCOM_SCM
37662306a36Sopenharmony_ci	help
37762306a36Sopenharmony_ci	  When running on a Qualcomm platform that has the custom variant
37862306a36Sopenharmony_ci	  of the ARM SMMU, this needs to be built into the SMMU driver.
37962306a36Sopenharmony_ci
38062306a36Sopenharmony_ciconfig ARM_SMMU_QCOM_DEBUG
38162306a36Sopenharmony_ci	bool "ARM SMMU QCOM implementation defined debug support"
38262306a36Sopenharmony_ci	depends on ARM_SMMU_QCOM
38362306a36Sopenharmony_ci	help
38462306a36Sopenharmony_ci	  Support for implementation specific debug features in ARM SMMU
38562306a36Sopenharmony_ci	  hardware found in QTI platforms.
38662306a36Sopenharmony_ci
38762306a36Sopenharmony_ci	  Say Y here to enable debug for issues such as TLB sync timeouts
38862306a36Sopenharmony_ci	  which requires implementation defined register dumps.
38962306a36Sopenharmony_ci
39062306a36Sopenharmony_ciconfig ARM_SMMU_V3
39162306a36Sopenharmony_ci	tristate "ARM Ltd. System MMU Version 3 (SMMUv3) Support"
39262306a36Sopenharmony_ci	depends on ARM64
39362306a36Sopenharmony_ci	select IOMMU_API
39462306a36Sopenharmony_ci	select IOMMU_IO_PGTABLE_LPAE
39562306a36Sopenharmony_ci	select GENERIC_MSI_IRQ
39662306a36Sopenharmony_ci	help
39762306a36Sopenharmony_ci	  Support for implementations of the ARM System MMU architecture
39862306a36Sopenharmony_ci	  version 3 providing translation support to a PCIe root complex.
39962306a36Sopenharmony_ci
40062306a36Sopenharmony_ci	  Say Y here if your system includes an IOMMU device implementing
40162306a36Sopenharmony_ci	  the ARM SMMUv3 architecture.
40262306a36Sopenharmony_ci
40362306a36Sopenharmony_ciconfig ARM_SMMU_V3_SVA
40462306a36Sopenharmony_ci	bool "Shared Virtual Addressing support for the ARM SMMUv3"
40562306a36Sopenharmony_ci	depends on ARM_SMMU_V3
40662306a36Sopenharmony_ci	select IOMMU_SVA
40762306a36Sopenharmony_ci	select MMU_NOTIFIER
40862306a36Sopenharmony_ci	help
40962306a36Sopenharmony_ci	  Support for sharing process address spaces with devices using the
41062306a36Sopenharmony_ci	  SMMUv3.
41162306a36Sopenharmony_ci
41262306a36Sopenharmony_ci	  Say Y here if your system supports SVA extensions such as PCIe PASID
41362306a36Sopenharmony_ci	  and PRI.
41462306a36Sopenharmony_ci
41562306a36Sopenharmony_ciconfig S390_IOMMU
41662306a36Sopenharmony_ci	def_bool y if S390 && PCI
41762306a36Sopenharmony_ci	depends on S390 && PCI
41862306a36Sopenharmony_ci	select IOMMU_API
41962306a36Sopenharmony_ci	help
42062306a36Sopenharmony_ci	  Support for the IOMMU API for s390 PCI devices.
42162306a36Sopenharmony_ci
42262306a36Sopenharmony_ciconfig MTK_IOMMU
42362306a36Sopenharmony_ci	tristate "MediaTek IOMMU Support"
42462306a36Sopenharmony_ci	depends on ARCH_MEDIATEK || COMPILE_TEST
42562306a36Sopenharmony_ci	select ARM_DMA_USE_IOMMU
42662306a36Sopenharmony_ci	select IOMMU_API
42762306a36Sopenharmony_ci	select IOMMU_IO_PGTABLE_ARMV7S
42862306a36Sopenharmony_ci	select MEMORY
42962306a36Sopenharmony_ci	select MTK_SMI
43062306a36Sopenharmony_ci	help
43162306a36Sopenharmony_ci	  Support for the M4U on certain Mediatek SOCs. M4U is MultiMedia
43262306a36Sopenharmony_ci	  Memory Management Unit. This option enables remapping of DMA memory
43362306a36Sopenharmony_ci	  accesses for the multimedia subsystem.
43462306a36Sopenharmony_ci
43562306a36Sopenharmony_ci	  If unsure, say N here.
43662306a36Sopenharmony_ci
43762306a36Sopenharmony_ciconfig MTK_IOMMU_V1
43862306a36Sopenharmony_ci	tristate "MediaTek IOMMU Version 1 (M4U gen1) Support"
43962306a36Sopenharmony_ci	depends on ARM
44062306a36Sopenharmony_ci	depends on ARCH_MEDIATEK || COMPILE_TEST
44162306a36Sopenharmony_ci	select ARM_DMA_USE_IOMMU
44262306a36Sopenharmony_ci	select IOMMU_API
44362306a36Sopenharmony_ci	select MEMORY
44462306a36Sopenharmony_ci	select MTK_SMI
44562306a36Sopenharmony_ci	help
44662306a36Sopenharmony_ci	  Support for the M4U on certain Mediatek SoCs. M4U generation 1 HW is
44762306a36Sopenharmony_ci	  Multimedia Memory Managememt Unit. This option enables remapping of
44862306a36Sopenharmony_ci	  DMA memory accesses for the multimedia subsystem.
44962306a36Sopenharmony_ci
45062306a36Sopenharmony_ci	  if unsure, say N here.
45162306a36Sopenharmony_ci
45262306a36Sopenharmony_ciconfig QCOM_IOMMU
45362306a36Sopenharmony_ci	# Note: iommu drivers cannot (yet?) be built as modules
45462306a36Sopenharmony_ci	bool "Qualcomm IOMMU Support"
45562306a36Sopenharmony_ci	depends on ARCH_QCOM || COMPILE_TEST
45662306a36Sopenharmony_ci	depends on !GENERIC_ATOMIC64	# for IOMMU_IO_PGTABLE_LPAE
45762306a36Sopenharmony_ci	select QCOM_SCM
45862306a36Sopenharmony_ci	select IOMMU_API
45962306a36Sopenharmony_ci	select IOMMU_IO_PGTABLE_LPAE
46062306a36Sopenharmony_ci	select ARM_DMA_USE_IOMMU
46162306a36Sopenharmony_ci	help
46262306a36Sopenharmony_ci	  Support for IOMMU on certain Qualcomm SoCs.
46362306a36Sopenharmony_ci
46462306a36Sopenharmony_ciconfig HYPERV_IOMMU
46562306a36Sopenharmony_ci	bool "Hyper-V IRQ Handling"
46662306a36Sopenharmony_ci	depends on HYPERV && X86
46762306a36Sopenharmony_ci	select IOMMU_API
46862306a36Sopenharmony_ci	default HYPERV
46962306a36Sopenharmony_ci	help
47062306a36Sopenharmony_ci	  Stub IOMMU driver to handle IRQs to support Hyper-V Linux
47162306a36Sopenharmony_ci	  guest and root partitions.
47262306a36Sopenharmony_ci
47362306a36Sopenharmony_ciconfig VIRTIO_IOMMU
47462306a36Sopenharmony_ci	tristate "Virtio IOMMU driver"
47562306a36Sopenharmony_ci	depends on VIRTIO
47662306a36Sopenharmony_ci	depends on (ARM64 || X86)
47762306a36Sopenharmony_ci	select IOMMU_API
47862306a36Sopenharmony_ci	select INTERVAL_TREE
47962306a36Sopenharmony_ci	select ACPI_VIOT if ACPI
48062306a36Sopenharmony_ci	help
48162306a36Sopenharmony_ci	  Para-virtualised IOMMU driver with virtio.
48262306a36Sopenharmony_ci
48362306a36Sopenharmony_ci	  Say Y here if you intend to run this kernel as a guest.
48462306a36Sopenharmony_ci
48562306a36Sopenharmony_ciconfig SPRD_IOMMU
48662306a36Sopenharmony_ci	tristate "Unisoc IOMMU Support"
48762306a36Sopenharmony_ci	depends on ARCH_SPRD || COMPILE_TEST
48862306a36Sopenharmony_ci	select IOMMU_API
48962306a36Sopenharmony_ci	help
49062306a36Sopenharmony_ci	  Support for IOMMU on Unisoc's SoCs, this IOMMU can be used by
49162306a36Sopenharmony_ci	  Unisoc's multimedia devices, such as display, Image codec(jpeg)
49262306a36Sopenharmony_ci	  and a few signal processors, including VSP(video), GSP(graphic),
49362306a36Sopenharmony_ci	  ISP(image), and CPP(camera pixel processor), etc.
49462306a36Sopenharmony_ci
49562306a36Sopenharmony_ci	  Say Y here if you want to use the multimedia devices listed above.
49662306a36Sopenharmony_ci
49762306a36Sopenharmony_ciendif # IOMMU_SUPPORT
498