Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dd967117 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull IOMMU updates from Joerg Roedel:

 - big-endian support and preparation for defered probing for the Exynos
   IOMMU driver

 - simplifications in iommu-group id handling

 - support for Mediatek generation one IOMMU hardware

 - conversion of the AMD IOMMU driver to use the generic IOVA allocator.
   This driver now also benefits from the recent scalability
   improvements in the IOVA code.

 - preparations to use generic DMA mapping code in the Rockchip IOMMU
   driver

 - device tree adaption and conversion to use generic page-table code
   for the MSM IOMMU driver

 - an iova_to_phys optimization in the ARM-SMMU driver to greatly
   improve page-table teardown performance with VFIO

 - various other small fixes and conversions

* tag 'iommu-updates-v4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: (59 commits)
  iommu/amd: Initialize dma-ops domains with 3-level page-table
  iommu/amd: Update Alias-DTE in update_device_table()
  iommu/vt-d: Return error code in domain_context_mapping_one()
  iommu/amd: Use container_of to get dma_ops_domain
  iommu/amd: Flush iova queue before releasing dma_ops_domain
  iommu/amd: Handle IOMMU_DOMAIN_DMA in ops->domain_free call-back
  iommu/amd: Use dev_data->domain in get_domain()
  iommu/amd: Optimize map_sg and unmap_sg
  iommu/amd: Introduce dir2prot() helper
  iommu/amd: Implement timeout to flush unmap queues
  iommu/amd: Implement flush queue
  iommu/amd: Allow NULL pointer parameter for domain_flush_complete()
  iommu/amd: Set up data structures for flush queue
  iommu/amd: Remove align-parameter from __map_single()
  iommu/amd: Remove other remains of old address allocator
  iommu/amd: Make use of the generic IOVA allocator
  iommu/amd: Remove special mapping code for dma_ops path
  iommu/amd: Pass gfp-flags to iommu_map_page()
  iommu/amd: Implement apply_dm_region call-back
  iommu/amd: Create a list of reserved iova addresses
  ...
parents 77d9ada2 f360d324
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
* ARM SMMUv3 Architecture Implementation

The SMMUv3 architecture is a significant deparature from previous
The SMMUv3 architecture is a significant departure from previous
revisions, replacing the MMIO register interface with in-memory command
and event queues and adding support for the ATS and PRI components of
the PCIe specification.
+9 −4
Original line number Diff line number Diff line
* Mediatek IOMMU Architecture Implementation

  Some Mediatek SOCs contain a Multimedia Memory Management Unit (M4U) which
uses the ARM Short-Descriptor translation table format for address translation.
  Some Mediatek SOCs contain a Multimedia Memory Management Unit (M4U), and
this M4U have two generations of HW architecture. Generation one uses flat
pagetable, and only supports 4K size page mapping. Generation two uses the
ARM Short-Descriptor translation table format for address translation.

  About the M4U Hardware Block Diagram, please check below:

@@ -36,7 +38,9 @@ in each larb. Take a example, There are many ports like MC, PP, VLD in the
video decode local arbiter, all these ports are according to the video HW.

Required properties:
- compatible : must be "mediatek,mt8173-m4u".
- compatible : must be one of the following string:
	"mediatek,mt2701-m4u" for mt2701 which uses generation one m4u HW.
	"mediatek,mt8173-m4u" for mt8173 which uses generation two m4u HW.
- reg : m4u register base and size.
- interrupts : the interrupt of m4u.
- clocks : must contain one entry for each clock-names.
@@ -46,7 +50,8 @@ Required properties:
	according to the local arbiter index, like larb0, larb1, larb2...
- iommu-cells : must be 1. This is the mtk_m4u_id according to the HW.
	Specifies the mtk_m4u_id as defined in
	dt-binding/memory/mt8173-larb-port.h.
	dt-binding/memory/mt2701-larb-port.h for mt2701 and
	dt-binding/memory/mt8173-larb-port.h for mt8173

Example:
	iommu: iommu@10205000 {
+64 −0
Original line number Diff line number Diff line
* QCOM IOMMU

The MSM IOMMU is an implementation compatible with the ARM VMSA short
descriptor page tables. It provides address translation for bus masters outside
of the CPU, each connected to the IOMMU through a port called micro-TLB.

Required Properties:

  - compatible: Must contain "qcom,apq8064-iommu".
  - reg: Base address and size of the IOMMU registers.
  - interrupts: Specifiers for the MMU fault interrupts. For instances that
    support secure mode two interrupts must be specified, for non-secure and
    secure mode, in that order. For instances that don't support secure mode a
    single interrupt must be specified.
  - #iommu-cells: The number of cells needed to specify the stream id. This
		  is always 1.
  - qcom,ncb:	  The total number of context banks in the IOMMU.
  - clocks	: List of clocks to be used during SMMU register access. See
		  Documentation/devicetree/bindings/clock/clock-bindings.txt
		  for information about the format. For each clock specified
		  here, there must be a corresponding entry in clock-names
		  (see below).

  - clock-names	: List of clock names corresponding to the clocks specified in
		  the "clocks" property (above).
		  Should be "smmu_pclk" for specifying the interface clock
		  required for iommu's register accesses.
		  Should be "smmu_clk" for specifying the functional clock
		  required by iommu for bus accesses.

Each bus master connected to an IOMMU must reference the IOMMU in its device
node with the following property:

  - iommus: A reference to the IOMMU in multiple cells. The first cell is a
	    phandle to the IOMMU and the second cell is the stream id.
	    A single master device can be connected to more than one iommu
	    and multiple contexts in each of the iommu. So multiple entries
	    are required to list all the iommus and the stream ids that the
	    master is connected to.

Example: mdp iommu and its bus master

                mdp_port0: iommu@7500000 {
			compatible = "qcom,apq8064-iommu";
			#iommu-cells = <1>;
			clock-names =
			    "smmu_pclk",
			    "smmu_clk";
			clocks =
			    <&mmcc SMMU_AHB_CLK>,
			    <&mmcc MDP_AXI_CLK>;
			reg = <0x07500000 0x100000>;
			interrupts =
			    <GIC_SPI 63 0>,
			    <GIC_SPI 64 0>;
			qcom,ncb = <2>;
		};

		mdp: qcom,mdp@5100000 {
			compatible = "qcom,mdp";
			...
			iommus = <&mdp_port0 0
				  &mdp_port0 2>;
		};
+18 −3
Original line number Diff line number Diff line
@@ -2,16 +2,31 @@ SMI (Smart Multimedia Interface) Common

The hardware block diagram please check bindings/iommu/mediatek,iommu.txt

Mediatek SMI have two generations of HW architecture, mt8173 uses the second
generation of SMI HW while mt2701 uses the first generation HW of SMI.

There's slight differences between the two SMI, for generation 2, the
register which control the iommu port is at each larb's register base. But
for generation 1, the register is at smi ao base(smi always on register
base). Besides that, the smi async clock should be prepared and enabled for
SMI generation 1 to transform the smi clock into emi clock domain, but that is
not needed for SMI generation 2.

Required properties:
- compatible : must be "mediatek,mt8173-smi-common"
- compatible : must be one of :
	"mediatek,mt2701-smi-common"
	"mediatek,mt8173-smi-common"
- reg : the register and size of the SMI block.
- power-domains : a phandle to the power domain of this local arbiter.
- clocks : Must contain an entry for each entry in clock-names.
- clock-names : must contain 2 entries, as follows:
- clock-names : must contain 3 entries for generation 1 smi HW and 2 entries
  for generation 2 smi HW as follows:
  - "apb" : Advanced Peripheral Bus clock, It's the clock for setting
	    the register.
  - "smi" : It's the clock for transfer data and command.
	    They may be the same if both source clocks are the same.
  - "async" : asynchronous clock, it help transform the smi clock into the emi
	      clock domain, this clock is only needed by generation 1 smi HW.

Example:
	smi_common: smi@14022000 {
+3 −1
Original line number Diff line number Diff line
@@ -3,7 +3,9 @@ SMI (Smart Multimedia Interface) Local Arbiter
The hardware block diagram please check bindings/iommu/mediatek,iommu.txt

Required properties:
- compatible : must be "mediatek,mt8173-smi-larb"
- compatible : must be one of :
		"mediatek,mt8173-smi-larb"
		"mediatek,mt2701-smi-larb"
- reg : the register and size of this local arbiter.
- mediatek,smi : a phandle to the smi_common node.
- power-domains : a phandle to the power domain of this local arbiter.
Loading