1# The IOVA library may also be used by non-IOMMU_API users 2config IOMMU_IOVA 3 tristate 4 5# IOMMU_API always gets selected by whoever wants it. 6config IOMMU_API 7 bool 8 9menuconfig IOMMU_SUPPORT 10 bool "IOMMU Hardware Support" 11 depends on MMU 12 default y 13 ---help--- 14 Say Y here if you want to compile device drivers for IO Memory 15 Management Units into the kernel. These devices usually allow to 16 remap DMA requests and/or remap interrupts from other devices on the 17 system. 18 19if IOMMU_SUPPORT 20 21menu "Generic IOMMU Pagetable Support" 22 23# Selected by the actual pagetable implementations 24config IOMMU_IO_PGTABLE 25 bool 26 27config IOMMU_IO_PGTABLE_LPAE 28 bool "ARMv7/v8 Long Descriptor Format" 29 select IOMMU_IO_PGTABLE 30 depends on ARM || ARM64 || (COMPILE_TEST && !GENERIC_ATOMIC64) 31 help 32 Enable support for the ARM long descriptor pagetable format. 33 This allocator supports 4K/2M/1G, 16K/32M and 64K/512M page 34 sizes at both stage-1 and stage-2, as well as address spaces 35 up to 48-bits in size. 36 37config IOMMU_IO_PGTABLE_LPAE_SELFTEST 38 bool "LPAE selftests" 39 depends on IOMMU_IO_PGTABLE_LPAE 40 help 41 Enable self-tests for LPAE page table allocator. This performs 42 a series of page-table consistency checks during boot. 43 44 If unsure, say N here. 45 46config IOMMU_IO_PGTABLE_ARMV7S 47 bool "ARMv7/v8 Short Descriptor Format" 48 select IOMMU_IO_PGTABLE 49 depends on ARM || ARM64 || COMPILE_TEST 50 help 51 Enable support for the ARM Short-descriptor pagetable format. 52 This supports 32-bit virtual and physical addresses mapped using 53 2-level tables with 4KB pages/1MB sections, and contiguous entries 54 for 64KB pages/16MB supersections if indicated by the IOMMU driver. 55 56config IOMMU_IO_PGTABLE_ARMV7S_SELFTEST 57 bool "ARMv7s selftests" 58 depends on IOMMU_IO_PGTABLE_ARMV7S 59 help 60 Enable self-tests for ARMv7s page table allocator. This performs 61 a series of page-table consistency checks during boot. 62 63 If unsure, say N here. 64 65endmenu 66 67config IOMMU_DEBUGFS 68 bool "Export IOMMU internals in DebugFS" 69 depends on DEBUG_FS 70 help 71 Allows exposure of IOMMU device internals. This option enables 72 the use of debugfs by IOMMU drivers as required. Devices can, 73 at initialization time, cause the IOMMU code to create a top-level 74 debug/iommu directory, and then populate a subdirectory with 75 entries as required. 76 77config IOMMU_DEFAULT_PASSTHROUGH 78 bool "IOMMU passthrough by default" 79 depends on IOMMU_API 80 help 81 Enable passthrough by default, removing the need to pass in 82 iommu.passthrough=on or iommu=pt through command line. If this 83 is enabled, you can still disable with iommu.passthrough=off 84 or iommu=nopt depending on the architecture. 85 86 If unsure, say N here. 87 88config OF_IOMMU 89 def_bool y 90 depends on OF && IOMMU_API 91 92# IOMMU-agnostic DMA-mapping layer 93config IOMMU_DMA 94 bool 95 select IOMMU_API 96 select IOMMU_IOVA 97 select NEED_SG_DMA_LENGTH 98 99config FSL_PAMU 100 bool "Freescale IOMMU support" 101 depends on PCI 102 depends on PHYS_64BIT 103 depends on PPC_E500MC || (COMPILE_TEST && PPC) 104 select IOMMU_API 105 select GENERIC_ALLOCATOR 106 help 107 Freescale PAMU support. PAMU is the IOMMU present on Freescale QorIQ platforms. 108 PAMU can authorize memory access, remap the memory address, and remap I/O 109 transaction types. 110 111# MSM IOMMU support 112config MSM_IOMMU 113 bool "MSM IOMMU Support" 114 depends on ARM 115 depends on ARCH_MSM8X60 || ARCH_MSM8960 || COMPILE_TEST 116 select IOMMU_API 117 select IOMMU_IO_PGTABLE_ARMV7S 118 help 119 Support for the IOMMUs found on certain Qualcomm SOCs. 120 These IOMMUs allow virtualization of the address space used by most 121 cores within the multimedia subsystem. 122 123 If unsure, say N here. 124 125config IOMMU_PGTABLES_L2 126 def_bool y 127 depends on MSM_IOMMU && MMU && SMP && CPU_DCACHE_DISABLE=n 128 129# AMD IOMMU support 130config AMD_IOMMU 131 bool "AMD IOMMU support" 132 select SWIOTLB 133 select PCI_MSI 134 select PCI_ATS 135 select PCI_PRI 136 select PCI_PASID 137 select IOMMU_API 138 select IOMMU_IOVA 139 depends on X86_64 && PCI && ACPI 140 ---help--- 141 With this option you can enable support for AMD IOMMU hardware in 142 your system. An IOMMU is a hardware component which provides 143 remapping of DMA memory accesses from devices. With an AMD IOMMU you 144 can isolate the DMA memory of different devices and protect the 145 system from misbehaving device drivers or hardware. 146 147 You can find out if your system has an AMD IOMMU if you look into 148 your BIOS for an option to enable it or if you have an IVRS ACPI 149 table. 150 151config AMD_IOMMU_V2 152 tristate "AMD IOMMU Version 2 driver" 153 depends on AMD_IOMMU 154 select MMU_NOTIFIER 155 ---help--- 156 This option enables support for the AMD IOMMUv2 features of the IOMMU 157 hardware. Select this option if you want to use devices that support 158 the PCI PRI and PASID interface. 159 160config AMD_IOMMU_DEBUGFS 161 bool "Enable AMD IOMMU internals in DebugFS" 162 depends on AMD_IOMMU && IOMMU_DEBUGFS 163 ---help--- 164 !!!WARNING!!! !!!WARNING!!! !!!WARNING!!! !!!WARNING!!! 165 166 DO NOT ENABLE THIS OPTION UNLESS YOU REALLY, -REALLY- KNOW WHAT YOU ARE DOING!!! 167 Exposes AMD IOMMU device internals in DebugFS. 168 169 This option is -NOT- intended for production environments, and should 170 not generally be enabled. 171 172# Intel IOMMU support 173config DMAR_TABLE 174 bool 175 176config INTEL_IOMMU 177 bool "Support for Intel IOMMU using DMA Remapping Devices" 178 depends on PCI_MSI && ACPI && (X86 || IA64_GENERIC) 179 select IOMMU_API 180 select IOMMU_IOVA 181 select NEED_DMA_MAP_STATE 182 select DMAR_TABLE 183 help 184 DMA remapping (DMAR) devices support enables independent address 185 translations for Direct Memory Access (DMA) from devices. 186 These DMA remapping devices are reported via ACPI tables 187 and include PCI device scope covered by these DMA 188 remapping devices. 189 190config INTEL_IOMMU_DEBUGFS 191 bool "Export Intel IOMMU internals in Debugfs" 192 depends on INTEL_IOMMU && IOMMU_DEBUGFS 193 help 194 !!!WARNING!!! 195 196 DO NOT ENABLE THIS OPTION UNLESS YOU REALLY KNOW WHAT YOU ARE DOING!!! 197 198 Expose Intel IOMMU internals in Debugfs. 199 200 This option is -NOT- intended for production environments, and should 201 only be enabled for debugging Intel IOMMU. 202 203config INTEL_IOMMU_SVM 204 bool "Support for Shared Virtual Memory with Intel IOMMU" 205 depends on INTEL_IOMMU && X86 206 select PCI_PASID 207 select MMU_NOTIFIER 208 help 209 Shared Virtual Memory (SVM) provides a facility for devices 210 to access DMA resources through process address space by 211 means of a Process Address Space ID (PASID). 212 213config INTEL_IOMMU_DEFAULT_ON 214 def_bool y 215 prompt "Enable Intel DMA Remapping Devices by default" 216 depends on INTEL_IOMMU 217 help 218 Selecting this option will enable a DMAR device at boot time if 219 one is found. If this option is not selected, DMAR support can 220 be enabled by passing intel_iommu=on to the kernel. 221 222config INTEL_IOMMU_BROKEN_GFX_WA 223 bool "Workaround broken graphics drivers (going away soon)" 224 depends on INTEL_IOMMU && BROKEN && X86 225 ---help--- 226 Current Graphics drivers tend to use physical address 227 for DMA and avoid using DMA APIs. Setting this config 228 option permits the IOMMU driver to set a unity map for 229 all the OS-visible memory. Hence the driver can continue 230 to use physical addresses for DMA, at least until this 231 option is removed in the 2.6.32 kernel. 232 233config INTEL_IOMMU_FLOPPY_WA 234 def_bool y 235 depends on INTEL_IOMMU && X86 236 ---help--- 237 Floppy disk drivers are known to bypass DMA API calls 238 thereby failing to work when IOMMU is enabled. This 239 workaround will setup a 1:1 mapping for the first 240 16MiB to make floppy (an ISA device) work. 241 242config IRQ_REMAP 243 bool "Support for Interrupt Remapping" 244 depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI 245 select DMAR_TABLE 246 ---help--- 247 Supports Interrupt remapping for IO-APIC and MSI devices. 248 To use x2apic mode in the CPU's which support x2APIC enhancements or 249 to support platforms with CPU's having > 8 bit APIC ID, say Y. 250 251# OMAP IOMMU support 252config OMAP_IOMMU 253 bool "OMAP IOMMU Support" 254 depends on ARM && MMU 255 depends on ARCH_OMAP2PLUS || COMPILE_TEST 256 select IOMMU_API 257 ---help--- 258 The OMAP3 media platform drivers depend on iommu support, 259 if you need them say Y here. 260 261config OMAP_IOMMU_DEBUG 262 bool "Export OMAP IOMMU internals in DebugFS" 263 depends on OMAP_IOMMU && DEBUG_FS 264 ---help--- 265 Select this to see extensive information about 266 the internal state of OMAP IOMMU in debugfs. 267 268 Say N unless you know you need this. 269 270config ROCKCHIP_IOMMU 271 bool "Rockchip IOMMU Support" 272 depends on ARM || ARM64 273 depends on ARCH_ROCKCHIP || COMPILE_TEST 274 select IOMMU_API 275 select ARM_DMA_USE_IOMMU 276 help 277 Support for IOMMUs found on Rockchip rk32xx SOCs. 278 These IOMMUs allow virtualization of the address space used by most 279 cores within the multimedia subsystem. 280 Say Y here if you are using a Rockchip SoC that includes an IOMMU 281 device. 282 283config TEGRA_IOMMU_GART 284 bool "Tegra GART IOMMU Support" 285 depends on ARCH_TEGRA_2x_SOC 286 depends on TEGRA_MC 287 select IOMMU_API 288 help 289 Enables support for remapping discontiguous physical memory 290 shared with the operating system into contiguous I/O virtual 291 space through the GART (Graphics Address Relocation Table) 292 hardware included on Tegra SoCs. 293 294config TEGRA_IOMMU_SMMU 295 bool "NVIDIA Tegra SMMU Support" 296 depends on ARCH_TEGRA 297 depends on TEGRA_AHB 298 depends on TEGRA_MC 299 select IOMMU_API 300 help 301 This driver supports the IOMMU hardware (SMMU) found on NVIDIA Tegra 302 SoCs (Tegra30 up to Tegra210). 303 304config EXYNOS_IOMMU 305 bool "Exynos IOMMU Support" 306 depends on ARCH_EXYNOS && MMU 307 depends on !CPU_BIG_ENDIAN # revisit driver if we can enable big-endian ptes 308 select IOMMU_API 309 select ARM_DMA_USE_IOMMU 310 help 311 Support for the IOMMU (System MMU) of Samsung Exynos application 312 processor family. This enables H/W multimedia accelerators to see 313 non-linear physical memory chunks as linear memory in their 314 address space. 315 316 If unsure, say N here. 317 318config EXYNOS_IOMMU_DEBUG 319 bool "Debugging log for Exynos IOMMU" 320 depends on EXYNOS_IOMMU 321 help 322 Select this to see the detailed log message that shows what 323 happens in the IOMMU driver. 324 325 Say N unless you need kernel log message for IOMMU debugging. 326 327config IPMMU_VMSA 328 bool "Renesas VMSA-compatible IPMMU" 329 depends on ARM || IOMMU_DMA 330 depends on ARCH_RENESAS || (COMPILE_TEST && !GENERIC_ATOMIC64) 331 select IOMMU_API 332 select IOMMU_IO_PGTABLE_LPAE 333 select ARM_DMA_USE_IOMMU 334 help 335 Support for the Renesas VMSA-compatible IPMMU found in the R-Mobile 336 APE6, R-Car Gen2, and R-Car Gen3 SoCs. 337 338 If unsure, say N. 339 340config SPAPR_TCE_IOMMU 341 bool "sPAPR TCE IOMMU Support" 342 depends on PPC_POWERNV || PPC_PSERIES 343 select IOMMU_API 344 help 345 Enables bits of IOMMU API required by VFIO. The iommu_ops 346 is not implemented as it is not necessary for VFIO. 347 348# ARM IOMMU support 349config ARM_SMMU 350 bool "ARM Ltd. System MMU (SMMU) Support" 351 depends on (ARM64 || ARM) && MMU 352 select IOMMU_API 353 select IOMMU_IO_PGTABLE_LPAE 354 select ARM_DMA_USE_IOMMU if ARM 355 help 356 Support for implementations of the ARM System MMU architecture 357 versions 1 and 2. 358 359 Say Y here if your SoC includes an IOMMU device implementing 360 the ARM SMMU architecture. 361 362config ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT 363 bool "Default to disabling bypass on ARM SMMU v1 and v2" 364 depends on ARM_SMMU 365 default y 366 help 367 Say Y here to (by default) disable bypass streams such that 368 incoming transactions from devices that are not attached to 369 an iommu domain will report an abort back to the device and 370 will not be allowed to pass through the SMMU. 371 372 Any old kernels that existed before this KConfig was 373 introduced would default to _allowing_ bypass (AKA the 374 equivalent of NO for this config). However the default for 375 this option is YES because the old behavior is insecure. 376 377 There are few reasons to allow unmatched stream bypass, and 378 even fewer good ones. If saying YES here breaks your board 379 you should work on fixing your board. This KConfig option 380 is expected to be removed in the future and we'll simply 381 hardcode the bypass disable in the code. 382 383 NOTE: the kernel command line parameter 384 'arm-smmu.disable_bypass' will continue to override this 385 config. 386 387config ARM_SMMU_V3 388 bool "ARM Ltd. System MMU Version 3 (SMMUv3) Support" 389 depends on ARM64 390 select IOMMU_API 391 select IOMMU_IO_PGTABLE_LPAE 392 select GENERIC_MSI_IRQ_DOMAIN 393 help 394 Support for implementations of the ARM System MMU architecture 395 version 3 providing translation support to a PCIe root complex. 396 397 Say Y here if your system includes an IOMMU device implementing 398 the ARM SMMUv3 architecture. 399 400config S390_IOMMU 401 def_bool y if S390 && PCI 402 depends on S390 && PCI 403 select IOMMU_API 404 help 405 Support for the IOMMU API for s390 PCI devices. 406 407config S390_CCW_IOMMU 408 bool "S390 CCW IOMMU Support" 409 depends on S390 && CCW 410 select IOMMU_API 411 help 412 Enables bits of IOMMU API required by VFIO. The iommu_ops 413 is not implemented as it is not necessary for VFIO. 414 415config S390_AP_IOMMU 416 bool "S390 AP IOMMU Support" 417 depends on S390 && ZCRYPT 418 select IOMMU_API 419 help 420 Enables bits of IOMMU API required by VFIO. The iommu_ops 421 is not implemented as it is not necessary for VFIO. 422 423config MTK_IOMMU 424 bool "MTK IOMMU Support" 425 depends on ARM || ARM64 426 depends on ARCH_MEDIATEK || COMPILE_TEST 427 select ARM_DMA_USE_IOMMU 428 select IOMMU_API 429 select IOMMU_DMA 430 select IOMMU_IO_PGTABLE_ARMV7S 431 select MEMORY 432 select MTK_SMI 433 help 434 Support for the M4U on certain Mediatek SOCs. M4U is MultiMedia 435 Memory Management Unit. This option enables remapping of DMA memory 436 accesses for the multimedia subsystem. 437 438 If unsure, say N here. 439 440config MTK_IOMMU_V1 441 bool "MTK IOMMU Version 1 (M4U gen1) Support" 442 depends on ARM 443 depends on ARCH_MEDIATEK || COMPILE_TEST 444 select ARM_DMA_USE_IOMMU 445 select IOMMU_API 446 select MEMORY 447 select MTK_SMI 448 help 449 Support for the M4U on certain Mediatek SoCs. M4U generation 1 HW is 450 Multimedia Memory Managememt Unit. This option enables remapping of 451 DMA memory accesses for the multimedia subsystem. 452 453 if unsure, say N here. 454 455config QCOM_IOMMU 456 # Note: iommu drivers cannot (yet?) be built as modules 457 bool "Qualcomm IOMMU Support" 458 depends on ARCH_QCOM || (COMPILE_TEST && !GENERIC_ATOMIC64) 459 select IOMMU_API 460 select IOMMU_IO_PGTABLE_LPAE 461 select ARM_DMA_USE_IOMMU 462 help 463 Support for IOMMU on certain Qualcomm SoCs. 464 465config HYPERV_IOMMU 466 bool "Hyper-V x2APIC IRQ Handling" 467 depends on HYPERV 468 select IOMMU_API 469 default HYPERV 470 help 471 Stub IOMMU driver to handle IRQs as to allow Hyper-V Linux 472 guests to run with x2APIC mode enabled. 473 474endif # IOMMU_SUPPORT 475