Kconfig 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. # The IOVA library may also be used by non-IOMMU_API users
  3. config IOMMU_IOVA
  4. tristate
  5. # IOMMU_API always gets selected by whoever wants it.
  6. config IOMMU_API
  7. bool
  8. config IOMMUFD_DRIVER
  9. bool
  10. default n
  11. menuconfig IOMMU_SUPPORT
  12. bool "IOMMU Hardware Support"
  13. depends on MMU
  14. default y
  15. help
  16. Say Y here if you want to compile device drivers for IO Memory
  17. Management Units into the kernel. These devices usually allow to
  18. remap DMA requests and/or remap interrupts from other devices on the
  19. system.
  20. if IOMMU_SUPPORT
  21. menu "Generic IOMMU Pagetable Support"
  22. # Selected by the actual pagetable implementations
  23. config IOMMU_IO_PGTABLE
  24. bool
  25. config IOMMU_IO_PGTABLE_LPAE
  26. bool "ARMv7/v8 Long Descriptor Format"
  27. select IOMMU_IO_PGTABLE
  28. depends on ARM || ARM64 || COMPILE_TEST
  29. depends on !GENERIC_ATOMIC64 # for cmpxchg64()
  30. help
  31. Enable support for the ARM long descriptor pagetable format.
  32. This allocator supports 4K/2M/1G, 16K/32M and 64K/512M page
  33. sizes at both stage-1 and stage-2, as well as address spaces
  34. up to 48-bits in size.
  35. config IOMMU_IO_PGTABLE_LPAE_SELFTEST
  36. bool "LPAE selftests"
  37. depends on IOMMU_IO_PGTABLE_LPAE
  38. help
  39. Enable self-tests for LPAE page table allocator. This performs
  40. a series of page-table consistency checks during boot.
  41. If unsure, say N here.
  42. config IOMMU_IO_PGTABLE_ARMV7S
  43. bool "ARMv7/v8 Short Descriptor Format"
  44. select IOMMU_IO_PGTABLE
  45. depends on ARM || ARM64 || COMPILE_TEST
  46. help
  47. Enable support for the ARM Short-descriptor pagetable format.
  48. This supports 32-bit virtual and physical addresses mapped using
  49. 2-level tables with 4KB pages/1MB sections, and contiguous entries
  50. for 64KB pages/16MB supersections if indicated by the IOMMU driver.
  51. config IOMMU_IO_PGTABLE_ARMV7S_SELFTEST
  52. bool "ARMv7s selftests"
  53. depends on IOMMU_IO_PGTABLE_ARMV7S
  54. help
  55. Enable self-tests for ARMv7s page table allocator. This performs
  56. a series of page-table consistency checks during boot.
  57. If unsure, say N here.
  58. config IOMMU_IO_PGTABLE_DART
  59. bool "Apple DART Formats"
  60. select IOMMU_IO_PGTABLE
  61. depends on ARM64 || COMPILE_TEST
  62. depends on !GENERIC_ATOMIC64 # for cmpxchg64()
  63. help
  64. Enable support for the Apple DART pagetable formats. These include
  65. the t8020 and t6000/t8110 DART formats used in Apple M1/M2 family
  66. SoCs.
  67. If unsure, say N here.
  68. endmenu
  69. config IOMMU_DEBUGFS
  70. bool "Export IOMMU internals in DebugFS"
  71. depends on DEBUG_FS
  72. help
  73. Allows exposure of IOMMU device internals. This option enables
  74. the use of debugfs by IOMMU drivers as required. Devices can,
  75. at initialization time, cause the IOMMU code to create a top-level
  76. debug/iommu directory, and then populate a subdirectory with
  77. entries as required.
  78. choice
  79. prompt "IOMMU default domain type"
  80. depends on IOMMU_API
  81. default IOMMU_DEFAULT_DMA_LAZY if X86 || S390
  82. default IOMMU_DEFAULT_DMA_STRICT
  83. help
  84. Choose the type of IOMMU domain used to manage DMA API usage by
  85. device drivers. The options here typically represent different
  86. levels of tradeoff between robustness/security and performance,
  87. depending on the IOMMU driver. Not all IOMMUs support all options.
  88. This choice can be overridden at boot via the command line, and for
  89. some devices also at runtime via sysfs.
  90. If unsure, keep the default.
  91. config IOMMU_DEFAULT_DMA_STRICT
  92. bool "Translated - Strict"
  93. help
  94. Trusted devices use translation to restrict their access to only
  95. DMA-mapped pages, with strict TLB invalidation on unmap. Equivalent
  96. to passing "iommu.passthrough=0 iommu.strict=1" on the command line.
  97. Untrusted devices always use this mode, with an additional layer of
  98. bounce-buffering such that they cannot gain access to any unrelated
  99. data within a mapped page.
  100. config IOMMU_DEFAULT_DMA_LAZY
  101. bool "Translated - Lazy"
  102. help
  103. Trusted devices use translation to restrict their access to only
  104. DMA-mapped pages, but with "lazy" batched TLB invalidation. This
  105. mode allows higher performance with some IOMMUs due to reduced TLB
  106. flushing, but at the cost of reduced isolation since devices may be
  107. able to access memory for some time after it has been unmapped.
  108. Equivalent to passing "iommu.passthrough=0 iommu.strict=0" on the
  109. command line.
  110. If this mode is not supported by the IOMMU driver, the effective
  111. runtime default will fall back to IOMMU_DEFAULT_DMA_STRICT.
  112. config IOMMU_DEFAULT_PASSTHROUGH
  113. bool "Passthrough"
  114. help
  115. Trusted devices are identity-mapped, giving them unrestricted access
  116. to memory with minimal performance overhead. Equivalent to passing
  117. "iommu.passthrough=1" (historically "iommu=pt") on the command line.
  118. If this mode is not supported by the IOMMU driver, the effective
  119. runtime default will fall back to IOMMU_DEFAULT_DMA_STRICT.
  120. endchoice
  121. config OF_IOMMU
  122. def_bool y
  123. depends on OF && IOMMU_API
  124. # IOMMU-agnostic DMA-mapping layer
  125. config IOMMU_DMA
  126. def_bool ARM64 || X86 || S390
  127. select DMA_OPS_HELPERS
  128. select IOMMU_API
  129. select IOMMU_IOVA
  130. select IRQ_MSI_IOMMU
  131. select NEED_SG_DMA_LENGTH
  132. select NEED_SG_DMA_FLAGS if SWIOTLB
  133. # Shared Virtual Addressing
  134. config IOMMU_SVA
  135. select IOMMU_MM_DATA
  136. bool
  137. config IOMMU_IOPF
  138. bool
  139. config FSL_PAMU
  140. bool "Freescale IOMMU support"
  141. depends on PCI
  142. depends on PHYS_64BIT
  143. depends on PPC_E500MC || (COMPILE_TEST && PPC)
  144. select IOMMU_API
  145. select GENERIC_ALLOCATOR
  146. help
  147. Freescale PAMU support. PAMU is the IOMMU present on Freescale QorIQ platforms.
  148. PAMU can authorize memory access, remap the memory address, and remap I/O
  149. transaction types.
  150. # MSM IOMMU support
  151. config MSM_IOMMU
  152. bool "MSM IOMMU Support"
  153. depends on ARM
  154. depends on ARCH_QCOM || COMPILE_TEST
  155. select IOMMU_API
  156. select IOMMU_IO_PGTABLE_ARMV7S
  157. help
  158. Support for the IOMMUs found on certain Qualcomm SOCs.
  159. These IOMMUs allow virtualization of the address space used by most
  160. cores within the multimedia subsystem.
  161. If unsure, say N here.
  162. source "drivers/iommu/amd/Kconfig"
  163. source "drivers/iommu/intel/Kconfig"
  164. source "drivers/iommu/iommufd/Kconfig"
  165. config IRQ_REMAP
  166. bool "Support for Interrupt Remapping"
  167. depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI
  168. select DMAR_TABLE if INTEL_IOMMU
  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. # OMAP IOMMU support
  174. config OMAP_IOMMU
  175. bool "OMAP IOMMU Support"
  176. depends on ARCH_OMAP2PLUS || COMPILE_TEST
  177. select IOMMU_API
  178. help
  179. The OMAP3 media platform drivers depend on iommu support,
  180. if you need them say Y here.
  181. config OMAP_IOMMU_DEBUG
  182. bool "Export OMAP IOMMU internals in DebugFS"
  183. depends on OMAP_IOMMU && DEBUG_FS
  184. help
  185. Select this to see extensive information about
  186. the internal state of OMAP IOMMU in debugfs.
  187. Say N unless you know you need this.
  188. config ROCKCHIP_IOMMU
  189. bool "Rockchip IOMMU Support"
  190. depends on ARCH_ROCKCHIP || COMPILE_TEST
  191. select IOMMU_API
  192. select ARM_DMA_USE_IOMMU
  193. help
  194. Support for IOMMUs found on Rockchip rk32xx SOCs.
  195. These IOMMUs allow virtualization of the address space used by most
  196. cores within the multimedia subsystem.
  197. Say Y here if you are using a Rockchip SoC that includes an IOMMU
  198. device.
  199. config SUN50I_IOMMU
  200. bool "Allwinner H6 IOMMU Support"
  201. depends on HAS_DMA
  202. depends on ARCH_SUNXI || COMPILE_TEST
  203. select ARM_DMA_USE_IOMMU
  204. select IOMMU_API
  205. help
  206. Support for the IOMMU introduced in the Allwinner H6 SoCs.
  207. config TEGRA_IOMMU_SMMU
  208. bool "NVIDIA Tegra SMMU Support"
  209. depends on ARCH_TEGRA
  210. depends on TEGRA_AHB
  211. depends on TEGRA_MC
  212. select IOMMU_API
  213. help
  214. This driver supports the IOMMU hardware (SMMU) found on NVIDIA Tegra
  215. SoCs (Tegra30 up to Tegra210).
  216. config EXYNOS_IOMMU
  217. bool "Exynos IOMMU Support"
  218. depends on ARCH_EXYNOS || COMPILE_TEST
  219. depends on !CPU_BIG_ENDIAN # revisit driver if we can enable big-endian ptes
  220. select IOMMU_API
  221. select ARM_DMA_USE_IOMMU
  222. help
  223. Support for the IOMMU (System MMU) of Samsung Exynos application
  224. processor family. This enables H/W multimedia accelerators to see
  225. non-linear physical memory chunks as linear memory in their
  226. address space.
  227. If unsure, say N here.
  228. config EXYNOS_IOMMU_DEBUG
  229. bool "Debugging log for Exynos IOMMU"
  230. depends on EXYNOS_IOMMU
  231. help
  232. Select this to see the detailed log message that shows what
  233. happens in the IOMMU driver.
  234. Say N unless you need kernel log message for IOMMU debugging.
  235. config IPMMU_VMSA
  236. bool "Renesas VMSA-compatible IPMMU"
  237. depends on ARCH_RENESAS || COMPILE_TEST
  238. depends on ARM || ARM64 || COMPILE_TEST
  239. depends on !GENERIC_ATOMIC64 # for IOMMU_IO_PGTABLE_LPAE
  240. select IOMMU_API
  241. select IOMMU_IO_PGTABLE_LPAE
  242. select ARM_DMA_USE_IOMMU
  243. help
  244. Support for the Renesas VMSA-compatible IPMMU found in the R-Mobile
  245. APE6, R-Car Gen{2,3} and RZ/G{1,2} SoCs.
  246. If unsure, say N.
  247. config SPAPR_TCE_IOMMU
  248. bool "sPAPR TCE IOMMU Support"
  249. depends on PPC_POWERNV || PPC_PSERIES
  250. select IOMMU_API
  251. help
  252. Enables bits of IOMMU API required by VFIO. The iommu_ops
  253. is not implemented as it is not necessary for VFIO.
  254. config APPLE_DART
  255. tristate "Apple DART IOMMU Support"
  256. depends on ARCH_APPLE || COMPILE_TEST
  257. depends on !GENERIC_ATOMIC64 # for IOMMU_IO_PGTABLE_DART
  258. select IOMMU_API
  259. select IOMMU_IO_PGTABLE_DART
  260. default ARCH_APPLE
  261. help
  262. Support for Apple DART (Device Address Resolution Table) IOMMUs
  263. found in Apple ARM SoCs like the M1.
  264. This IOMMU is required for most peripherals using DMA to access
  265. the main memory.
  266. Say Y here if you are using an Apple SoC.
  267. # ARM IOMMU support
  268. config ARM_SMMU
  269. tristate "ARM Ltd. System MMU (SMMU) Support"
  270. depends on ARM64 || ARM || COMPILE_TEST
  271. depends on !GENERIC_ATOMIC64 # for IOMMU_IO_PGTABLE_LPAE
  272. select IOMMU_API
  273. select IOMMU_IO_PGTABLE_LPAE
  274. select ARM_DMA_USE_IOMMU if ARM
  275. help
  276. Support for implementations of the ARM System MMU architecture
  277. versions 1 and 2.
  278. Say Y here if your SoC includes an IOMMU device implementing
  279. the ARM SMMU architecture.
  280. config ARM_SMMU_LEGACY_DT_BINDINGS
  281. bool "Support the legacy \"mmu-masters\" devicetree bindings"
  282. depends on ARM_SMMU=y && OF
  283. help
  284. Support for the badly designed and deprecated "mmu-masters"
  285. devicetree bindings. This allows some DMA masters to attach
  286. to the SMMU but does not provide any support via the DMA API.
  287. If you're lucky, you might be able to get VFIO up and running.
  288. If you say Y here then you'll make me very sad. Instead, say N
  289. and move your firmware to the utopian future that was 2016.
  290. config ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT
  291. bool "Default to disabling bypass on ARM SMMU v1 and v2"
  292. depends on ARM_SMMU
  293. default y
  294. help
  295. Say Y here to (by default) disable bypass streams such that
  296. incoming transactions from devices that are not attached to
  297. an iommu domain will report an abort back to the device and
  298. will not be allowed to pass through the SMMU.
  299. Any old kernels that existed before this KConfig was
  300. introduced would default to _allowing_ bypass (AKA the
  301. equivalent of NO for this config). However the default for
  302. this option is YES because the old behavior is insecure.
  303. There are few reasons to allow unmatched stream bypass, and
  304. even fewer good ones. If saying YES here breaks your board
  305. you should work on fixing your board. This KConfig option
  306. is expected to be removed in the future and we'll simply
  307. hardcode the bypass disable in the code.
  308. NOTE: the kernel command line parameter
  309. 'arm-smmu.disable_bypass' will continue to override this
  310. config.
  311. config ARM_SMMU_QCOM
  312. def_tristate y
  313. depends on ARM_SMMU && ARCH_QCOM
  314. select QCOM_SCM
  315. help
  316. When running on a Qualcomm platform that has the custom variant
  317. of the ARM SMMU, this needs to be built into the SMMU driver.
  318. config ARM_SMMU_QCOM_DEBUG
  319. bool "ARM SMMU QCOM implementation defined debug support"
  320. depends on ARM_SMMU_QCOM=y
  321. help
  322. Support for implementation specific debug features in ARM SMMU
  323. hardware found in QTI platforms. This include support for
  324. the Translation Buffer Units (TBU) that can be used to obtain
  325. additional information when debugging memory management issues
  326. like context faults.
  327. Say Y here to enable debug for issues such as context faults
  328. or TLB sync timeouts which requires implementation defined
  329. register dumps.
  330. config ARM_SMMU_V3
  331. tristate "ARM Ltd. System MMU Version 3 (SMMUv3) Support"
  332. depends on ARM64
  333. select IOMMU_API
  334. select IOMMU_IO_PGTABLE_LPAE
  335. select GENERIC_MSI_IRQ
  336. select IOMMUFD_DRIVER if IOMMUFD
  337. help
  338. Support for implementations of the ARM System MMU architecture
  339. version 3 providing translation support to a PCIe root complex.
  340. Say Y here if your system includes an IOMMU device implementing
  341. the ARM SMMUv3 architecture.
  342. if ARM_SMMU_V3
  343. config ARM_SMMU_V3_SVA
  344. bool "Shared Virtual Addressing support for the ARM SMMUv3"
  345. select IOMMU_SVA
  346. select IOMMU_IOPF
  347. select MMU_NOTIFIER
  348. help
  349. Support for sharing process address spaces with devices using the
  350. SMMUv3.
  351. Say Y here if your system supports SVA extensions such as PCIe PASID
  352. and PRI.
  353. config ARM_SMMU_V3_KUNIT_TEST
  354. tristate "KUnit tests for arm-smmu-v3 driver" if !KUNIT_ALL_TESTS
  355. depends on KUNIT
  356. depends on ARM_SMMU_V3_SVA
  357. default KUNIT_ALL_TESTS
  358. help
  359. Enable this option to unit-test arm-smmu-v3 driver functions.
  360. If unsure, say N.
  361. config TEGRA241_CMDQV
  362. bool "NVIDIA Tegra241 CMDQ-V extension support for ARM SMMUv3"
  363. depends on ACPI
  364. help
  365. Support for NVIDIA CMDQ-Virtualization extension for ARM SMMUv3. The
  366. CMDQ-V extension is similar to v3.3 ECMDQ for multi command queues
  367. support, except with virtualization capabilities.
  368. Say Y here if your system is NVIDIA Tegra241 (Grace) or it has the same
  369. CMDQ-V extension.
  370. endif
  371. config S390_IOMMU
  372. def_bool y if S390 && PCI
  373. depends on S390 && PCI
  374. select IOMMU_API
  375. help
  376. Support for the IOMMU API for s390 PCI devices.
  377. config MTK_IOMMU
  378. tristate "MediaTek IOMMU Support"
  379. depends on ARCH_MEDIATEK || COMPILE_TEST
  380. select ARM_DMA_USE_IOMMU
  381. select IOMMU_API
  382. select IOMMU_IO_PGTABLE_ARMV7S
  383. select MEMORY
  384. select MTK_SMI
  385. help
  386. Support for the M4U on certain Mediatek SOCs. M4U is MultiMedia
  387. Memory Management Unit. This option enables remapping of DMA memory
  388. accesses for the multimedia subsystem.
  389. If unsure, say N here.
  390. config MTK_IOMMU_V1
  391. tristate "MediaTek 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. if unsure, say N here.
  403. config QCOM_IOMMU
  404. # Note: iommu drivers cannot (yet?) be built as modules
  405. bool "Qualcomm IOMMU Support"
  406. depends on ARCH_QCOM || COMPILE_TEST
  407. depends on !GENERIC_ATOMIC64 # for IOMMU_IO_PGTABLE_LPAE
  408. select QCOM_SCM
  409. select IOMMU_API
  410. select IOMMU_IO_PGTABLE_LPAE
  411. select ARM_DMA_USE_IOMMU
  412. help
  413. Support for IOMMU on certain Qualcomm SoCs.
  414. config HYPERV_IOMMU
  415. bool "Hyper-V IRQ Handling"
  416. depends on HYPERV && X86
  417. select IOMMU_API
  418. default HYPERV
  419. help
  420. Stub IOMMU driver to handle IRQs to support Hyper-V Linux
  421. guest and root partitions.
  422. config VIRTIO_IOMMU
  423. tristate "Virtio IOMMU driver"
  424. depends on VIRTIO
  425. depends on (ARM64 || X86)
  426. select IOMMU_API
  427. select INTERVAL_TREE
  428. select ACPI_VIOT if ACPI
  429. help
  430. Para-virtualised IOMMU driver with virtio.
  431. Say Y here if you intend to run this kernel as a guest.
  432. config SPRD_IOMMU
  433. tristate "Unisoc IOMMU Support"
  434. depends on ARCH_SPRD || COMPILE_TEST
  435. select IOMMU_API
  436. help
  437. Support for IOMMU on Unisoc's SoCs, this IOMMU can be used by
  438. Unisoc's multimedia devices, such as display, Image codec(jpeg)
  439. and a few signal processors, including VSP(video), GSP(graphic),
  440. ISP(image), and CPP(camera pixel processor), etc.
  441. Say Y here if you want to use the multimedia devices listed above.
  442. endif # IOMMU_SUPPORT