Kconfig 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  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. # The IOASID library may also be used by non-IOMMU_API users
  6. config IOASID
  7. tristate
  8. # IOMMU_API always gets selected by whoever wants it.
  9. config IOMMU_API
  10. bool
  11. if IOMMU_IOVA
  12. config IOMMU_LIMIT_IOVA_ALIGNMENT
  13. bool "Limit IOVA alignment"
  14. help
  15. When the IOVA framework applies IOVA alignment it aligns all
  16. IOVAs to the smallest PAGE_SIZE order which is greater than or
  17. equal to the requested IOVA size. This works fine for sizes up
  18. to several MiB, but for larger sizes it results in address
  19. space wastage and fragmentation. For example drivers with a 4
  20. GiB IOVA space might run out of IOVA space when allocating
  21. buffers great than 64 MiB.
  22. Enable this option to impose a limit on the alignment of IOVAs.
  23. If unsure, say N.
  24. config IOMMU_IOVA_ALIGNMENT
  25. int "Maximum PAGE_SIZE order of alignment for IOVAs"
  26. depends on IOMMU_LIMIT_IOVA_ALIGNMENT
  27. range 4 9
  28. default 9
  29. help
  30. With this parameter you can specify the maximum PAGE_SIZE order for
  31. IOVAs. Larger IOVAs will be aligned only to this specified order.
  32. The order is expressed a power of two multiplied by the PAGE_SIZE.
  33. If unsure, leave the default value "9".
  34. endif
  35. menuconfig IOMMU_SUPPORT
  36. bool "IOMMU Hardware Support"
  37. depends on MMU
  38. default y
  39. help
  40. Say Y here if you want to compile device drivers for IO Memory
  41. Management Units into the kernel. These devices usually allow to
  42. remap DMA requests and/or remap interrupts from other devices on the
  43. system.
  44. if IOMMU_SUPPORT
  45. menu "Generic IOMMU Pagetable Support"
  46. # Selected by the actual pagetable implementations
  47. config IOMMU_IO_PGTABLE
  48. bool
  49. config IOMMU_IO_PGTABLE_LPAE
  50. bool "ARMv7/v8 Long Descriptor Format"
  51. select IOMMU_IO_PGTABLE
  52. depends on ARM || ARM64 || (COMPILE_TEST && !GENERIC_ATOMIC64)
  53. help
  54. Enable support for the ARM long descriptor pagetable format.
  55. This allocator supports 4K/2M/1G, 16K/32M and 64K/512M page
  56. sizes at both stage-1 and stage-2, as well as address spaces
  57. up to 48-bits in size.
  58. config IOMMU_IO_PGTABLE_LPAE_SELFTEST
  59. bool "LPAE selftests"
  60. depends on IOMMU_IO_PGTABLE_LPAE
  61. help
  62. Enable self-tests for LPAE page table allocator. This performs
  63. a series of page-table consistency checks during boot.
  64. If unsure, say N here.
  65. config IOMMU_IO_PGTABLE_ARMV7S
  66. bool "ARMv7/v8 Short Descriptor Format"
  67. select IOMMU_IO_PGTABLE
  68. depends on ARM || ARM64 || COMPILE_TEST
  69. help
  70. Enable support for the ARM Short-descriptor pagetable format.
  71. This supports 32-bit virtual and physical addresses mapped using
  72. 2-level tables with 4KB pages/1MB sections, and contiguous entries
  73. for 64KB pages/16MB supersections if indicated by the IOMMU driver.
  74. config IOMMU_IO_PGTABLE_ARMV7S_SELFTEST
  75. bool "ARMv7s selftests"
  76. depends on IOMMU_IO_PGTABLE_ARMV7S
  77. help
  78. Enable self-tests for ARMv7s page table allocator. This performs
  79. a series of page-table consistency checks during boot.
  80. If unsure, say N here.
  81. endmenu
  82. config IOMMU_DEBUGFS
  83. bool "Export IOMMU internals in DebugFS"
  84. depends on DEBUG_FS
  85. help
  86. Allows exposure of IOMMU device internals. This option enables
  87. the use of debugfs by IOMMU drivers as required. Devices can,
  88. at initialization time, cause the IOMMU code to create a top-level
  89. debug/iommu directory, and then populate a subdirectory with
  90. entries as required.
  91. config IOMMU_DEFAULT_PASSTHROUGH
  92. bool "IOMMU passthrough by default"
  93. depends on IOMMU_API
  94. help
  95. Enable passthrough by default, removing the need to pass in
  96. iommu.passthrough=on or iommu=pt through command line. If this
  97. is enabled, you can still disable with iommu.passthrough=off
  98. or iommu=nopt depending on the architecture.
  99. If unsure, say N here.
  100. config OF_IOMMU
  101. def_bool y
  102. depends on OF && IOMMU_API
  103. # IOMMU-agnostic DMA-mapping layer
  104. config IOMMU_DMA
  105. bool
  106. select DMA_OPS
  107. select IOMMU_API
  108. select IOMMU_IOVA
  109. select IRQ_MSI_IOMMU
  110. select NEED_SG_DMA_LENGTH
  111. config FSL_PAMU
  112. bool "Freescale IOMMU support"
  113. depends on PCI
  114. depends on PHYS_64BIT
  115. depends on PPC_E500MC || (COMPILE_TEST && PPC)
  116. select IOMMU_API
  117. select GENERIC_ALLOCATOR
  118. help
  119. Freescale PAMU support. PAMU is the IOMMU present on Freescale QorIQ platforms.
  120. PAMU can authorize memory access, remap the memory address, and remap I/O
  121. transaction types.
  122. # MSM IOMMU support
  123. config MSM_IOMMU
  124. bool "MSM IOMMU Support"
  125. depends on ARM
  126. depends on ARCH_MSM8X60 || ARCH_MSM8960 || COMPILE_TEST
  127. select IOMMU_API
  128. select IOMMU_IO_PGTABLE_ARMV7S
  129. help
  130. Support for the IOMMUs found on certain Qualcomm SOCs.
  131. These IOMMUs allow virtualization of the address space used by most
  132. cores within the multimedia subsystem.
  133. If unsure, say N here.
  134. source "drivers/iommu/amd/Kconfig"
  135. source "drivers/iommu/intel/Kconfig"
  136. config IRQ_REMAP
  137. bool "Support for Interrupt Remapping"
  138. depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI
  139. select DMAR_TABLE
  140. help
  141. Supports Interrupt remapping for IO-APIC and MSI devices.
  142. To use x2apic mode in the CPU's which support x2APIC enhancements or
  143. to support platforms with CPU's having > 8 bit APIC ID, say Y.
  144. # OMAP IOMMU support
  145. config OMAP_IOMMU
  146. bool "OMAP IOMMU Support"
  147. depends on ARCH_OMAP2PLUS || COMPILE_TEST
  148. select IOMMU_API
  149. help
  150. The OMAP3 media platform drivers depend on iommu support,
  151. if you need them say Y here.
  152. config OMAP_IOMMU_DEBUG
  153. bool "Export OMAP IOMMU internals in DebugFS"
  154. depends on OMAP_IOMMU && DEBUG_FS
  155. help
  156. Select this to see extensive information about
  157. the internal state of OMAP IOMMU in debugfs.
  158. Say N unless you know you need this.
  159. config ROCKCHIP_IOMMU
  160. bool "Rockchip IOMMU Support"
  161. depends on ARCH_ROCKCHIP || COMPILE_TEST
  162. select IOMMU_API
  163. select ARM_DMA_USE_IOMMU
  164. help
  165. Support for IOMMUs found on Rockchip rk32xx SOCs.
  166. These IOMMUs allow virtualization of the address space used by most
  167. cores within the multimedia subsystem.
  168. Say Y here if you are using a Rockchip SoC that includes an IOMMU
  169. device.
  170. config SUN50I_IOMMU
  171. bool "Allwinner H6 IOMMU Support"
  172. depends on HAS_DMA
  173. depends on ARCH_SUNXI || COMPILE_TEST
  174. select ARM_DMA_USE_IOMMU
  175. select IOMMU_API
  176. help
  177. Support for the IOMMU introduced in the Allwinner H6 SoCs.
  178. config TEGRA_IOMMU_GART
  179. bool "Tegra GART IOMMU Support"
  180. depends on ARCH_TEGRA_2x_SOC
  181. depends on TEGRA_MC
  182. select IOMMU_API
  183. help
  184. Enables support for remapping discontiguous physical memory
  185. shared with the operating system into contiguous I/O virtual
  186. space through the GART (Graphics Address Relocation Table)
  187. hardware included on Tegra SoCs.
  188. config TEGRA_IOMMU_SMMU
  189. bool "NVIDIA Tegra SMMU Support"
  190. depends on ARCH_TEGRA
  191. depends on TEGRA_AHB
  192. depends on TEGRA_MC
  193. select IOMMU_API
  194. help
  195. This driver supports the IOMMU hardware (SMMU) found on NVIDIA Tegra
  196. SoCs (Tegra30 up to Tegra210).
  197. config EXYNOS_IOMMU
  198. bool "Exynos IOMMU Support"
  199. depends on ARCH_EXYNOS || COMPILE_TEST
  200. depends on !CPU_BIG_ENDIAN # revisit driver if we can enable big-endian ptes
  201. select IOMMU_API
  202. select ARM_DMA_USE_IOMMU
  203. help
  204. Support for the IOMMU (System MMU) of Samsung Exynos application
  205. processor family. This enables H/W multimedia accelerators to see
  206. non-linear physical memory chunks as linear memory in their
  207. address space.
  208. If unsure, say N here.
  209. config EXYNOS_IOMMU_DEBUG
  210. bool "Debugging log for Exynos IOMMU"
  211. depends on EXYNOS_IOMMU
  212. help
  213. Select this to see the detailed log message that shows what
  214. happens in the IOMMU driver.
  215. Say N unless you need kernel log message for IOMMU debugging.
  216. config IPMMU_VMSA
  217. bool "Renesas VMSA-compatible IPMMU"
  218. depends on ARCH_RENESAS || (COMPILE_TEST && !GENERIC_ATOMIC64)
  219. select IOMMU_API
  220. select IOMMU_IO_PGTABLE_LPAE
  221. select ARM_DMA_USE_IOMMU
  222. help
  223. Support for the Renesas VMSA-compatible IPMMU found in the R-Mobile
  224. APE6, R-Car Gen{2,3} and RZ/G{1,2} SoCs.
  225. If unsure, say N.
  226. config SPAPR_TCE_IOMMU
  227. bool "sPAPR TCE IOMMU Support"
  228. depends on PPC_POWERNV || PPC_PSERIES
  229. select IOMMU_API
  230. help
  231. Enables bits of IOMMU API required by VFIO. The iommu_ops
  232. is not implemented as it is not necessary for VFIO.
  233. # ARM IOMMU support
  234. config ARM_SMMU
  235. tristate "ARM Ltd. System MMU (SMMU) Support"
  236. depends on ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64)
  237. depends on QCOM_SCM || !QCOM_SCM #if QCOM_SCM=m this can't be =y
  238. select IOMMU_API
  239. select IOMMU_IO_PGTABLE_LPAE
  240. select ARM_DMA_USE_IOMMU if ARM
  241. help
  242. Support for implementations of the ARM System MMU architecture
  243. versions 1 and 2.
  244. Say Y here if your SoC includes an IOMMU device implementing
  245. the ARM SMMU architecture.
  246. config ARM_SMMU_LEGACY_DT_BINDINGS
  247. bool "Support the legacy \"mmu-masters\" devicetree bindings"
  248. depends on ARM_SMMU=y && OF
  249. help
  250. Support for the badly designed and deprecated "mmu-masters"
  251. devicetree bindings. This allows some DMA masters to attach
  252. to the SMMU but does not provide any support via the DMA API.
  253. If you're lucky, you might be able to get VFIO up and running.
  254. If you say Y here then you'll make me very sad. Instead, say N
  255. and move your firmware to the utopian future that was 2016.
  256. config ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT
  257. bool "Default to disabling bypass on ARM SMMU v1 and v2"
  258. depends on ARM_SMMU
  259. default y
  260. help
  261. Say Y here to (by default) disable bypass streams such that
  262. incoming transactions from devices that are not attached to
  263. an iommu domain will report an abort back to the device and
  264. will not be allowed to pass through the SMMU.
  265. Any old kernels that existed before this KConfig was
  266. introduced would default to _allowing_ bypass (AKA the
  267. equivalent of NO for this config). However the default for
  268. this option is YES because the old behavior is insecure.
  269. There are few reasons to allow unmatched stream bypass, and
  270. even fewer good ones. If saying YES here breaks your board
  271. you should work on fixing your board. This KConfig option
  272. is expected to be removed in the future and we'll simply
  273. hardcode the bypass disable in the code.
  274. NOTE: the kernel command line parameter
  275. 'arm-smmu.disable_bypass' will continue to override this
  276. config.
  277. config ARM_SMMU_V3
  278. tristate "ARM Ltd. System MMU Version 3 (SMMUv3) Support"
  279. depends on ARM64
  280. select IOMMU_API
  281. select IOMMU_IO_PGTABLE_LPAE
  282. select GENERIC_MSI_IRQ_DOMAIN
  283. help
  284. Support for implementations of the ARM System MMU architecture
  285. version 3 providing translation support to a PCIe root complex.
  286. Say Y here if your system includes an IOMMU device implementing
  287. the ARM SMMUv3 architecture.
  288. config ARM_SMMU_V3_SVA
  289. bool "Shared Virtual Addressing support for the ARM SMMUv3"
  290. depends on ARM_SMMU_V3
  291. help
  292. Support for sharing process address spaces with devices using the
  293. SMMUv3.
  294. Say Y here if your system supports SVA extensions such as PCIe PASID
  295. and PRI.
  296. config S390_IOMMU
  297. def_bool y if S390 && PCI
  298. depends on S390 && PCI
  299. select IOMMU_API
  300. help
  301. Support for the IOMMU API for s390 PCI devices.
  302. config S390_CCW_IOMMU
  303. bool "S390 CCW IOMMU Support"
  304. depends on S390 && CCW || COMPILE_TEST
  305. select IOMMU_API
  306. help
  307. Enables bits of IOMMU API required by VFIO. The iommu_ops
  308. is not implemented as it is not necessary for VFIO.
  309. config S390_AP_IOMMU
  310. bool "S390 AP IOMMU Support"
  311. depends on S390 && ZCRYPT || COMPILE_TEST
  312. select IOMMU_API
  313. help
  314. Enables bits of IOMMU API required by VFIO. The iommu_ops
  315. is not implemented as it is not necessary for VFIO.
  316. config MTK_IOMMU
  317. bool "MTK IOMMU Support"
  318. depends on ARCH_MEDIATEK || COMPILE_TEST
  319. select ARM_DMA_USE_IOMMU
  320. select IOMMU_API
  321. select IOMMU_IO_PGTABLE_ARMV7S
  322. select MEMORY
  323. select MTK_SMI
  324. help
  325. Support for the M4U on certain Mediatek SOCs. M4U is MultiMedia
  326. Memory Management Unit. This option enables remapping of DMA memory
  327. accesses for the multimedia subsystem.
  328. If unsure, say N here.
  329. config MTK_IOMMU_V1
  330. bool "MTK IOMMU Version 1 (M4U gen1) Support"
  331. depends on ARM
  332. depends on ARCH_MEDIATEK || COMPILE_TEST
  333. select ARM_DMA_USE_IOMMU
  334. select IOMMU_API
  335. select MEMORY
  336. select MTK_SMI
  337. help
  338. Support for the M4U on certain Mediatek SoCs. M4U generation 1 HW is
  339. Multimedia Memory Managememt Unit. This option enables remapping of
  340. DMA memory accesses for the multimedia subsystem.
  341. if unsure, say N here.
  342. config QCOM_IOMMU
  343. # Note: iommu drivers cannot (yet?) be built as modules
  344. bool "Qualcomm IOMMU Support"
  345. depends on ARCH_QCOM || (COMPILE_TEST && !GENERIC_ATOMIC64)
  346. depends on QCOM_SCM=y
  347. select IOMMU_API
  348. select IOMMU_IO_PGTABLE_LPAE
  349. select ARM_DMA_USE_IOMMU
  350. help
  351. Support for IOMMU on certain Qualcomm SoCs.
  352. config HYPERV_IOMMU
  353. bool "Hyper-V x2APIC IRQ Handling"
  354. depends on HYPERV && X86
  355. select IOMMU_API
  356. default HYPERV
  357. help
  358. Stub IOMMU driver to handle IRQs as to allow Hyper-V Linux
  359. guests to run with x2APIC mode enabled.
  360. config VIRTIO_IOMMU
  361. tristate "Virtio IOMMU driver"
  362. depends on VIRTIO
  363. depends on ARM64
  364. select IOMMU_API
  365. select INTERVAL_TREE
  366. help
  367. Para-virtualised IOMMU driver with virtio.
  368. Say Y here if you intend to run this kernel as a guest.
  369. endif # IOMMU_SUPPORT