Kconfig 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  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. help
  169. Supports Interrupt remapping for IO-APIC and MSI devices.
  170. To use x2apic mode in the CPU's which support x2APIC enhancements or
  171. to support platforms with CPU's having > 8 bit APIC ID, say Y.
  172. # OMAP IOMMU support
  173. config OMAP_IOMMU
  174. bool "OMAP IOMMU Support"
  175. depends on ARCH_OMAP2PLUS || COMPILE_TEST
  176. select IOMMU_API
  177. help
  178. The OMAP3 media platform drivers depend on iommu support,
  179. if you need them say Y here.
  180. config OMAP_IOMMU_DEBUG
  181. bool "Export OMAP IOMMU internals in DebugFS"
  182. depends on OMAP_IOMMU && DEBUG_FS
  183. help
  184. Select this to see extensive information about
  185. the internal state of OMAP IOMMU in debugfs.
  186. Say N unless you know you need this.
  187. config ROCKCHIP_IOMMU
  188. bool "Rockchip IOMMU Support"
  189. depends on ARCH_ROCKCHIP || COMPILE_TEST
  190. select IOMMU_API
  191. select ARM_DMA_USE_IOMMU
  192. help
  193. Support for IOMMUs found on Rockchip rk32xx SOCs.
  194. These IOMMUs allow virtualization of the address space used by most
  195. cores within the multimedia subsystem.
  196. Say Y here if you are using a Rockchip SoC that includes an IOMMU
  197. device.
  198. config SUN50I_IOMMU
  199. bool "Allwinner H6 IOMMU Support"
  200. depends on HAS_DMA
  201. depends on ARCH_SUNXI || COMPILE_TEST
  202. select ARM_DMA_USE_IOMMU
  203. select IOMMU_API
  204. help
  205. Support for the IOMMU introduced in the Allwinner H6 SoCs.
  206. config TEGRA_IOMMU_SMMU
  207. bool "NVIDIA Tegra SMMU Support"
  208. depends on ARCH_TEGRA
  209. depends on TEGRA_AHB
  210. depends on TEGRA_MC
  211. select IOMMU_API
  212. help
  213. This driver supports the IOMMU hardware (SMMU) found on NVIDIA Tegra
  214. SoCs (Tegra30 up to Tegra210).
  215. config EXYNOS_IOMMU
  216. bool "Exynos IOMMU Support"
  217. depends on ARCH_EXYNOS || COMPILE_TEST
  218. depends on !CPU_BIG_ENDIAN # revisit driver if we can enable big-endian ptes
  219. select IOMMU_API
  220. select ARM_DMA_USE_IOMMU
  221. help
  222. Support for the IOMMU (System MMU) of Samsung Exynos application
  223. processor family. This enables H/W multimedia accelerators to see
  224. non-linear physical memory chunks as linear memory in their
  225. address space.
  226. If unsure, say N here.
  227. config EXYNOS_IOMMU_DEBUG
  228. bool "Debugging log for Exynos IOMMU"
  229. depends on EXYNOS_IOMMU
  230. help
  231. Select this to see the detailed log message that shows what
  232. happens in the IOMMU driver.
  233. Say N unless you need kernel log message for IOMMU debugging.
  234. config IPMMU_VMSA
  235. bool "Renesas VMSA-compatible IPMMU"
  236. depends on ARCH_RENESAS || COMPILE_TEST
  237. depends on ARM || ARM64 || COMPILE_TEST
  238. depends on !GENERIC_ATOMIC64 # for IOMMU_IO_PGTABLE_LPAE
  239. select IOMMU_API
  240. select IOMMU_IO_PGTABLE_LPAE
  241. select ARM_DMA_USE_IOMMU
  242. help
  243. Support for the Renesas VMSA-compatible IPMMU found in the R-Mobile
  244. APE6, R-Car Gen{2,3} and RZ/G{1,2} SoCs.
  245. If unsure, say N.
  246. config SPAPR_TCE_IOMMU
  247. bool "sPAPR TCE IOMMU Support"
  248. depends on PPC_POWERNV || PPC_PSERIES
  249. select IOMMU_API
  250. help
  251. Enables bits of IOMMU API required by VFIO. The iommu_ops
  252. is not implemented as it is not necessary for VFIO.
  253. config APPLE_DART
  254. tristate "Apple DART IOMMU Support"
  255. depends on ARCH_APPLE || COMPILE_TEST
  256. depends on !GENERIC_ATOMIC64 # for IOMMU_IO_PGTABLE_DART
  257. select IOMMU_API
  258. select IOMMU_IO_PGTABLE_DART
  259. default ARCH_APPLE
  260. help
  261. Support for Apple DART (Device Address Resolution Table) IOMMUs
  262. found in Apple ARM SoCs like the M1.
  263. This IOMMU is required for most peripherals using DMA to access
  264. the main memory.
  265. Say Y here if you are using an Apple SoC.
  266. # ARM IOMMU support
  267. config ARM_SMMU
  268. tristate "ARM Ltd. System MMU (SMMU) Support"
  269. depends on ARM64 || ARM || COMPILE_TEST
  270. depends on !GENERIC_ATOMIC64 # for IOMMU_IO_PGTABLE_LPAE
  271. select IOMMU_API
  272. select IOMMU_IO_PGTABLE_LPAE
  273. select ARM_DMA_USE_IOMMU if ARM
  274. help
  275. Support for implementations of the ARM System MMU architecture
  276. versions 1 and 2.
  277. Say Y here if your SoC includes an IOMMU device implementing
  278. the ARM SMMU architecture.
  279. config ARM_SMMU_LEGACY_DT_BINDINGS
  280. bool "Support the legacy \"mmu-masters\" devicetree bindings"
  281. depends on ARM_SMMU=y && OF
  282. help
  283. Support for the badly designed and deprecated "mmu-masters"
  284. devicetree bindings. This allows some DMA masters to attach
  285. to the SMMU but does not provide any support via the DMA API.
  286. If you're lucky, you might be able to get VFIO up and running.
  287. If you say Y here then you'll make me very sad. Instead, say N
  288. and move your firmware to the utopian future that was 2016.
  289. config ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT
  290. bool "Default to disabling bypass on ARM SMMU v1 and v2"
  291. depends on ARM_SMMU
  292. default y
  293. help
  294. Say Y here to (by default) disable bypass streams such that
  295. incoming transactions from devices that are not attached to
  296. an iommu domain will report an abort back to the device and
  297. will not be allowed to pass through the SMMU.
  298. Any old kernels that existed before this KConfig was
  299. introduced would default to _allowing_ bypass (AKA the
  300. equivalent of NO for this config). However the default for
  301. this option is YES because the old behavior is insecure.
  302. There are few reasons to allow unmatched stream bypass, and
  303. even fewer good ones. If saying YES here breaks your board
  304. you should work on fixing your board. This KConfig option
  305. is expected to be removed in the future and we'll simply
  306. hardcode the bypass disable in the code.
  307. NOTE: the kernel command line parameter
  308. 'arm-smmu.disable_bypass' will continue to override this
  309. config.
  310. config ARM_SMMU_QCOM
  311. def_tristate y
  312. depends on ARM_SMMU && ARCH_QCOM
  313. select QCOM_SCM
  314. help
  315. When running on a Qualcomm platform that has the custom variant
  316. of the ARM SMMU, this needs to be built into the SMMU driver.
  317. config ARM_SMMU_QCOM_DEBUG
  318. bool "ARM SMMU QCOM implementation defined debug support"
  319. depends on ARM_SMMU_QCOM=y
  320. help
  321. Support for implementation specific debug features in ARM SMMU
  322. hardware found in QTI platforms. This include support for
  323. the Translation Buffer Units (TBU) that can be used to obtain
  324. additional information when debugging memory management issues
  325. like context faults.
  326. Say Y here to enable debug for issues such as context faults
  327. or TLB sync timeouts which requires implementation defined
  328. register dumps.
  329. config 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
  335. select IOMMUFD_DRIVER if IOMMUFD
  336. help
  337. Support for implementations of the ARM System MMU architecture
  338. version 3 providing translation support to a PCIe root complex.
  339. Say Y here if your system includes an IOMMU device implementing
  340. the ARM SMMUv3 architecture.
  341. if ARM_SMMU_V3
  342. config ARM_SMMU_V3_SVA
  343. bool "Shared Virtual Addressing support for the ARM SMMUv3"
  344. select IOMMU_SVA
  345. select IOMMU_IOPF
  346. select MMU_NOTIFIER
  347. help
  348. Support for sharing process address spaces with devices using the
  349. SMMUv3.
  350. Say Y here if your system supports SVA extensions such as PCIe PASID
  351. and PRI.
  352. config ARM_SMMU_V3_KUNIT_TEST
  353. tristate "KUnit tests for arm-smmu-v3 driver" if !KUNIT_ALL_TESTS
  354. depends on KUNIT
  355. depends on ARM_SMMU_V3_SVA
  356. default KUNIT_ALL_TESTS
  357. help
  358. Enable this option to unit-test arm-smmu-v3 driver functions.
  359. If unsure, say N.
  360. config TEGRA241_CMDQV
  361. bool "NVIDIA Tegra241 CMDQ-V extension support for ARM SMMUv3"
  362. depends on ACPI
  363. help
  364. Support for NVIDIA CMDQ-Virtualization extension for ARM SMMUv3. The
  365. CMDQ-V extension is similar to v3.3 ECMDQ for multi command queues
  366. support, except with virtualization capabilities.
  367. Say Y here if your system is NVIDIA Tegra241 (Grace) or it has the same
  368. CMDQ-V extension.
  369. endif
  370. config S390_IOMMU
  371. def_bool y if S390 && PCI
  372. depends on S390 && PCI
  373. select IOMMU_API
  374. help
  375. Support for the IOMMU API for s390 PCI devices.
  376. config MTK_IOMMU
  377. tristate "MediaTek IOMMU Support"
  378. depends on ARCH_MEDIATEK || COMPILE_TEST
  379. select ARM_DMA_USE_IOMMU
  380. select IOMMU_API
  381. select IOMMU_IO_PGTABLE_ARMV7S
  382. select MEMORY
  383. select MTK_SMI
  384. help
  385. Support for the M4U on certain Mediatek SOCs. M4U is MultiMedia
  386. Memory Management Unit. This option enables remapping of DMA memory
  387. accesses for the multimedia subsystem.
  388. If unsure, say N here.
  389. config MTK_IOMMU_V1
  390. tristate "MediaTek IOMMU Version 1 (M4U gen1) Support"
  391. depends on ARM
  392. depends on ARCH_MEDIATEK || COMPILE_TEST
  393. select ARM_DMA_USE_IOMMU
  394. select IOMMU_API
  395. select MEMORY
  396. select MTK_SMI
  397. help
  398. Support for the M4U on certain Mediatek SoCs. M4U generation 1 HW is
  399. Multimedia Memory Managememt Unit. This option enables remapping of
  400. DMA memory accesses for the multimedia subsystem.
  401. if unsure, say N here.
  402. config QCOM_IOMMU
  403. # Note: iommu drivers cannot (yet?) be built as modules
  404. bool "Qualcomm IOMMU Support"
  405. depends on ARCH_QCOM || COMPILE_TEST
  406. depends on !GENERIC_ATOMIC64 # for IOMMU_IO_PGTABLE_LPAE
  407. select QCOM_SCM
  408. select IOMMU_API
  409. select IOMMU_IO_PGTABLE_LPAE
  410. select ARM_DMA_USE_IOMMU
  411. help
  412. Support for IOMMU on certain Qualcomm SoCs.
  413. config HYPERV_IOMMU
  414. bool "Hyper-V IRQ Handling"
  415. depends on HYPERV && X86
  416. select IOMMU_API
  417. default HYPERV
  418. help
  419. Stub IOMMU driver to handle IRQs to support Hyper-V Linux
  420. guest and root partitions.
  421. config VIRTIO_IOMMU
  422. tristate "Virtio IOMMU driver"
  423. depends on VIRTIO
  424. depends on (ARM64 || X86)
  425. select IOMMU_API
  426. select INTERVAL_TREE
  427. select ACPI_VIOT if ACPI
  428. help
  429. Para-virtualised IOMMU driver with virtio.
  430. Say Y here if you intend to run this kernel as a guest.
  431. config SPRD_IOMMU
  432. tristate "Unisoc IOMMU Support"
  433. depends on ARCH_SPRD || COMPILE_TEST
  434. select IOMMU_API
  435. help
  436. Support for IOMMU on Unisoc's SoCs, this IOMMU can be used by
  437. Unisoc's multimedia devices, such as display, Image codec(jpeg)
  438. and a few signal processors, including VSP(video), GSP(graphic),
  439. ISP(image), and CPP(camera pixel processor), etc.
  440. Say Y here if you want to use the multimedia devices listed above.
  441. endif # IOMMU_SUPPORT