Loading Documentation/ABI/testing/sysfs-kernel-iommu_groups +5 −1 Original line number Diff line number Diff line Loading @@ -42,8 +42,12 @@ Description: /sys/kernel/iommu_groups/<grp_id>/type shows the type of default ======== ====================================================== DMA All the DMA transactions from the device in this group are translated by the iommu. DMA-FQ As above, but using batched invalidation to lazily remove translations after use. This may offer reduced overhead at the cost of reduced memory protection. identity All the DMA transactions from the device in this group are not translated by the iommu. are not translated by the iommu. Maximum performance but zero protection. auto Change to the type the device was booted with. ======== ====================================================== Loading Documentation/admin-guide/kernel-parameters.txt +12 −17 Original line number Diff line number Diff line Loading @@ -290,10 +290,7 @@ amd_iommu= [HW,X86-64] Pass parameters to the AMD IOMMU driver in the system. Possible values are: fullflush - enable flushing of IO/TLB entries when they are unmapped. Otherwise they are flushed before they will be reused, which is a lot of faster fullflush - Deprecated, equivalent to iommu.strict=1 off - do not initialize any AMD IOMMU found in the system force_isolation - Force device isolation for all Loading Loading @@ -1944,18 +1941,17 @@ this case, gfx device will use physical address for DMA. strict [Default Off] With this option on every unmap_single operation will result in a hardware IOTLB flush operation as opposed to batching them for performance. Deprecated, equivalent to iommu.strict=1. sp_off [Default Off] By default, super page will be supported if Intel IOMMU has the capability. With this option, super page will not be supported. sm_on [Default Off] By default, scalable mode will be disabled even if the hardware advertises that it has support for the scalable mode translation. With this option set, scalable mode will be used on hardware which claims to support it. sm_on Enable the Intel IOMMU scalable mode if the hardware advertises that it has support for the scalable mode translation. sm_off Disallow use of the Intel IOMMU scalable mode. tboot_noforce [Default Off] Do not force the Intel IOMMU enabled under tboot. By default, tboot will force Intel IOMMU on, which Loading Loading @@ -2047,13 +2043,12 @@ throughput at the cost of reduced device isolation. Will fall back to strict mode if not supported by the relevant IOMMU driver. 1 - Strict mode (default). 1 - Strict mode. DMA unmap operations invalidate IOMMU hardware TLBs synchronously. Note: on x86, the default behaviour depends on the equivalent driver-specific parameters, but a strict mode explicitly specified by either method takes precedence. unset - Use value of CONFIG_IOMMU_DEFAULT_DMA_{LAZY,STRICT}. Note: on x86, strict mode specified via one of the legacy driver-specific options takes precedence. iommu.passthrough= [ARM64, X86] Configure DMA to bypass the IOMMU by default. Loading Documentation/devicetree/bindings/iommu/apple,dart.yaml 0 → 100644 +81 −0 Original line number Diff line number Diff line # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) %YAML 1.2 --- $id: http://devicetree.org/schemas/iommu/apple,dart.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# title: Apple DART IOMMU maintainers: - Sven Peter <sven@svenpeter.dev> description: |+ Apple SoCs may contain an implementation of their Device Address Resolution Table which provides a mandatory layer of address translations for various masters. Each DART instance is capable of handling up to 16 different streams with individual pagetables and page-level read/write protection flags. This DART IOMMU also raises interrupts in response to various fault conditions. properties: compatible: const: apple,t8103-dart reg: maxItems: 1 interrupts: maxItems: 1 clocks: description: Reference to the gate clock phandle if required for this IOMMU. Optional since not all IOMMUs are attached to a clock gate. '#iommu-cells': const: 1 description: Has to be one. The single cell describes the stream id emitted by a master to the IOMMU. required: - compatible - reg - '#iommu-cells' - interrupts additionalProperties: false examples: - |+ dart1: iommu@82f80000 { compatible = "apple,t8103-dart"; reg = <0x82f80000 0x4000>; interrupts = <1 781 4>; #iommu-cells = <1>; }; master1 { iommus = <&dart1 0>; }; - |+ dart2a: iommu@82f00000 { compatible = "apple,t8103-dart"; reg = <0x82f00000 0x4000>; interrupts = <1 781 4>; #iommu-cells = <1>; }; dart2b: iommu@82f80000 { compatible = "apple,t8103-dart"; reg = <0x82f80000 0x4000>; interrupts = <1 781 4>; #iommu-cells = <1>; }; master2 { iommus = <&dart2a 0>, <&dart2b 1>; }; MAINTAINERS +7 −0 Original line number Diff line number Diff line Loading @@ -1262,6 +1262,13 @@ L: linux-input@vger.kernel.org S: Odd fixes F: drivers/input/mouse/bcm5974.c APPLE DART IOMMU DRIVER M: Sven Peter <sven@svenpeter.dev> L: iommu@lists.linux-foundation.org S: Maintained F: Documentation/devicetree/bindings/iommu/apple,dart.yaml F: drivers/iommu/apple-dart.c APPLE SMC DRIVER M: Henrik Rydberg <rydberg@bitmath.org> L: linux-hwmon@vger.kernel.org Loading drivers/iommu/Kconfig +62 −7 Original line number Diff line number Diff line Loading @@ -79,16 +79,57 @@ config IOMMU_DEBUGFS debug/iommu directory, and then populate a subdirectory with entries as required. config IOMMU_DEFAULT_PASSTHROUGH bool "IOMMU passthrough by default" choice prompt "IOMMU default domain type" depends on IOMMU_API default IOMMU_DEFAULT_DMA_LAZY if AMD_IOMMU || INTEL_IOMMU default IOMMU_DEFAULT_DMA_STRICT help Enable passthrough by default, removing the need to pass in iommu.passthrough=on or iommu=pt through command line. If this is enabled, you can still disable with iommu.passthrough=off or iommu=nopt depending on the architecture. Choose the type of IOMMU domain used to manage DMA API usage by device drivers. The options here typically represent different levels of tradeoff between robustness/security and performance, depending on the IOMMU driver. Not all IOMMUs support all options. This choice can be overridden at boot via the command line, and for some devices also at runtime via sysfs. If unsure, say N here. If unsure, keep the default. config IOMMU_DEFAULT_DMA_STRICT bool "Translated - Strict" help Trusted devices use translation to restrict their access to only DMA-mapped pages, with strict TLB invalidation on unmap. Equivalent to passing "iommu.passthrough=0 iommu.strict=1" on the command line. Untrusted devices always use this mode, with an additional layer of bounce-buffering such that they cannot gain access to any unrelated data within a mapped page. config IOMMU_DEFAULT_DMA_LAZY bool "Translated - Lazy" help Trusted devices use translation to restrict their access to only DMA-mapped pages, but with "lazy" batched TLB invalidation. This mode allows higher performance with some IOMMUs due to reduced TLB flushing, but at the cost of reduced isolation since devices may be able to access memory for some time after it has been unmapped. Equivalent to passing "iommu.passthrough=0 iommu.strict=0" on the command line. If this mode is not supported by the IOMMU driver, the effective runtime default will fall back to IOMMU_DEFAULT_DMA_STRICT. config IOMMU_DEFAULT_PASSTHROUGH bool "Passthrough" help Trusted devices are identity-mapped, giving them unrestricted access to memory with minimal performance overhead. Equivalent to passing "iommu.passthrough=1" (historically "iommu=pt") on the command line. If this mode is not supported by the IOMMU driver, the effective runtime default will fall back to IOMMU_DEFAULT_DMA_STRICT. endchoice config OF_IOMMU def_bool y Loading Loading @@ -249,6 +290,20 @@ config SPAPR_TCE_IOMMU Enables bits of IOMMU API required by VFIO. The iommu_ops is not implemented as it is not necessary for VFIO. config APPLE_DART tristate "Apple DART IOMMU Support" depends on ARCH_APPLE || (COMPILE_TEST && !GENERIC_ATOMIC64) select IOMMU_API select IOMMU_IO_PGTABLE_LPAE default ARCH_APPLE help Support for Apple DART (Device Address Resolution Table) IOMMUs found in Apple ARM SoCs like the M1. This IOMMU is required for most peripherals using DMA to access the main memory. Say Y here if you are using an Apple SoC. # ARM IOMMU support config ARM_SMMU tristate "ARM Ltd. System MMU (SMMU) Support" Loading Loading
Documentation/ABI/testing/sysfs-kernel-iommu_groups +5 −1 Original line number Diff line number Diff line Loading @@ -42,8 +42,12 @@ Description: /sys/kernel/iommu_groups/<grp_id>/type shows the type of default ======== ====================================================== DMA All the DMA transactions from the device in this group are translated by the iommu. DMA-FQ As above, but using batched invalidation to lazily remove translations after use. This may offer reduced overhead at the cost of reduced memory protection. identity All the DMA transactions from the device in this group are not translated by the iommu. are not translated by the iommu. Maximum performance but zero protection. auto Change to the type the device was booted with. ======== ====================================================== Loading
Documentation/admin-guide/kernel-parameters.txt +12 −17 Original line number Diff line number Diff line Loading @@ -290,10 +290,7 @@ amd_iommu= [HW,X86-64] Pass parameters to the AMD IOMMU driver in the system. Possible values are: fullflush - enable flushing of IO/TLB entries when they are unmapped. Otherwise they are flushed before they will be reused, which is a lot of faster fullflush - Deprecated, equivalent to iommu.strict=1 off - do not initialize any AMD IOMMU found in the system force_isolation - Force device isolation for all Loading Loading @@ -1944,18 +1941,17 @@ this case, gfx device will use physical address for DMA. strict [Default Off] With this option on every unmap_single operation will result in a hardware IOTLB flush operation as opposed to batching them for performance. Deprecated, equivalent to iommu.strict=1. sp_off [Default Off] By default, super page will be supported if Intel IOMMU has the capability. With this option, super page will not be supported. sm_on [Default Off] By default, scalable mode will be disabled even if the hardware advertises that it has support for the scalable mode translation. With this option set, scalable mode will be used on hardware which claims to support it. sm_on Enable the Intel IOMMU scalable mode if the hardware advertises that it has support for the scalable mode translation. sm_off Disallow use of the Intel IOMMU scalable mode. tboot_noforce [Default Off] Do not force the Intel IOMMU enabled under tboot. By default, tboot will force Intel IOMMU on, which Loading Loading @@ -2047,13 +2043,12 @@ throughput at the cost of reduced device isolation. Will fall back to strict mode if not supported by the relevant IOMMU driver. 1 - Strict mode (default). 1 - Strict mode. DMA unmap operations invalidate IOMMU hardware TLBs synchronously. Note: on x86, the default behaviour depends on the equivalent driver-specific parameters, but a strict mode explicitly specified by either method takes precedence. unset - Use value of CONFIG_IOMMU_DEFAULT_DMA_{LAZY,STRICT}. Note: on x86, strict mode specified via one of the legacy driver-specific options takes precedence. iommu.passthrough= [ARM64, X86] Configure DMA to bypass the IOMMU by default. Loading
Documentation/devicetree/bindings/iommu/apple,dart.yaml 0 → 100644 +81 −0 Original line number Diff line number Diff line # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) %YAML 1.2 --- $id: http://devicetree.org/schemas/iommu/apple,dart.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# title: Apple DART IOMMU maintainers: - Sven Peter <sven@svenpeter.dev> description: |+ Apple SoCs may contain an implementation of their Device Address Resolution Table which provides a mandatory layer of address translations for various masters. Each DART instance is capable of handling up to 16 different streams with individual pagetables and page-level read/write protection flags. This DART IOMMU also raises interrupts in response to various fault conditions. properties: compatible: const: apple,t8103-dart reg: maxItems: 1 interrupts: maxItems: 1 clocks: description: Reference to the gate clock phandle if required for this IOMMU. Optional since not all IOMMUs are attached to a clock gate. '#iommu-cells': const: 1 description: Has to be one. The single cell describes the stream id emitted by a master to the IOMMU. required: - compatible - reg - '#iommu-cells' - interrupts additionalProperties: false examples: - |+ dart1: iommu@82f80000 { compatible = "apple,t8103-dart"; reg = <0x82f80000 0x4000>; interrupts = <1 781 4>; #iommu-cells = <1>; }; master1 { iommus = <&dart1 0>; }; - |+ dart2a: iommu@82f00000 { compatible = "apple,t8103-dart"; reg = <0x82f00000 0x4000>; interrupts = <1 781 4>; #iommu-cells = <1>; }; dart2b: iommu@82f80000 { compatible = "apple,t8103-dart"; reg = <0x82f80000 0x4000>; interrupts = <1 781 4>; #iommu-cells = <1>; }; master2 { iommus = <&dart2a 0>, <&dart2b 1>; };
MAINTAINERS +7 −0 Original line number Diff line number Diff line Loading @@ -1262,6 +1262,13 @@ L: linux-input@vger.kernel.org S: Odd fixes F: drivers/input/mouse/bcm5974.c APPLE DART IOMMU DRIVER M: Sven Peter <sven@svenpeter.dev> L: iommu@lists.linux-foundation.org S: Maintained F: Documentation/devicetree/bindings/iommu/apple,dart.yaml F: drivers/iommu/apple-dart.c APPLE SMC DRIVER M: Henrik Rydberg <rydberg@bitmath.org> L: linux-hwmon@vger.kernel.org Loading
drivers/iommu/Kconfig +62 −7 Original line number Diff line number Diff line Loading @@ -79,16 +79,57 @@ config IOMMU_DEBUGFS debug/iommu directory, and then populate a subdirectory with entries as required. config IOMMU_DEFAULT_PASSTHROUGH bool "IOMMU passthrough by default" choice prompt "IOMMU default domain type" depends on IOMMU_API default IOMMU_DEFAULT_DMA_LAZY if AMD_IOMMU || INTEL_IOMMU default IOMMU_DEFAULT_DMA_STRICT help Enable passthrough by default, removing the need to pass in iommu.passthrough=on or iommu=pt through command line. If this is enabled, you can still disable with iommu.passthrough=off or iommu=nopt depending on the architecture. Choose the type of IOMMU domain used to manage DMA API usage by device drivers. The options here typically represent different levels of tradeoff between robustness/security and performance, depending on the IOMMU driver. Not all IOMMUs support all options. This choice can be overridden at boot via the command line, and for some devices also at runtime via sysfs. If unsure, say N here. If unsure, keep the default. config IOMMU_DEFAULT_DMA_STRICT bool "Translated - Strict" help Trusted devices use translation to restrict their access to only DMA-mapped pages, with strict TLB invalidation on unmap. Equivalent to passing "iommu.passthrough=0 iommu.strict=1" on the command line. Untrusted devices always use this mode, with an additional layer of bounce-buffering such that they cannot gain access to any unrelated data within a mapped page. config IOMMU_DEFAULT_DMA_LAZY bool "Translated - Lazy" help Trusted devices use translation to restrict their access to only DMA-mapped pages, but with "lazy" batched TLB invalidation. This mode allows higher performance with some IOMMUs due to reduced TLB flushing, but at the cost of reduced isolation since devices may be able to access memory for some time after it has been unmapped. Equivalent to passing "iommu.passthrough=0 iommu.strict=0" on the command line. If this mode is not supported by the IOMMU driver, the effective runtime default will fall back to IOMMU_DEFAULT_DMA_STRICT. config IOMMU_DEFAULT_PASSTHROUGH bool "Passthrough" help Trusted devices are identity-mapped, giving them unrestricted access to memory with minimal performance overhead. Equivalent to passing "iommu.passthrough=1" (historically "iommu=pt") on the command line. If this mode is not supported by the IOMMU driver, the effective runtime default will fall back to IOMMU_DEFAULT_DMA_STRICT. endchoice config OF_IOMMU def_bool y Loading Loading @@ -249,6 +290,20 @@ config SPAPR_TCE_IOMMU Enables bits of IOMMU API required by VFIO. The iommu_ops is not implemented as it is not necessary for VFIO. config APPLE_DART tristate "Apple DART IOMMU Support" depends on ARCH_APPLE || (COMPILE_TEST && !GENERIC_ATOMIC64) select IOMMU_API select IOMMU_IO_PGTABLE_LPAE default ARCH_APPLE help Support for Apple DART (Device Address Resolution Table) IOMMUs found in Apple ARM SoCs like the M1. This IOMMU is required for most peripherals using DMA to access the main memory. Say Y here if you are using an Apple SoC. # ARM IOMMU support config ARM_SMMU tristate "ARM Ltd. System MMU (SMMU) Support" Loading