xref: /freebsd/sys/contrib/device-tree/Bindings/iommu/arm,smmu.yaml (revision 8cc087a1eee9ec1ca9f7ac1e63ad51bdb5a682eb)
1c66ec88fSEmmanuel Vadot# SPDX-License-Identifier: GPL-2.0-only
2c66ec88fSEmmanuel Vadot%YAML 1.2
3c66ec88fSEmmanuel Vadot---
4c66ec88fSEmmanuel Vadot$id: http://devicetree.org/schemas/iommu/arm,smmu.yaml#
5c66ec88fSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6c66ec88fSEmmanuel Vadot
7c66ec88fSEmmanuel Vadottitle: ARM System MMU Architecture Implementation
8c66ec88fSEmmanuel Vadot
9c66ec88fSEmmanuel Vadotmaintainers:
10c66ec88fSEmmanuel Vadot  - Will Deacon <will@kernel.org>
11c66ec88fSEmmanuel Vadot  - Robin Murphy <Robin.Murphy@arm.com>
12c66ec88fSEmmanuel Vadot
13c66ec88fSEmmanuel Vadotdescription: |+
14c66ec88fSEmmanuel Vadot  ARM SoCs may contain an implementation of the ARM System Memory
15c66ec88fSEmmanuel Vadot  Management Unit Architecture, which can be used to provide 1 or 2 stages
16c66ec88fSEmmanuel Vadot  of address translation to bus masters external to the CPU.
17c66ec88fSEmmanuel Vadot
18c66ec88fSEmmanuel Vadot  The SMMU may also raise interrupts in response to various fault
19c66ec88fSEmmanuel Vadot  conditions.
20c66ec88fSEmmanuel Vadot
21c66ec88fSEmmanuel Vadotproperties:
22c66ec88fSEmmanuel Vadot  $nodename:
23c66ec88fSEmmanuel Vadot    pattern: "^iommu@[0-9a-f]*"
24c66ec88fSEmmanuel Vadot  compatible:
25c66ec88fSEmmanuel Vadot    oneOf:
26c66ec88fSEmmanuel Vadot      - description: Qcom SoCs implementing "arm,smmu-v2"
27c66ec88fSEmmanuel Vadot        items:
28c66ec88fSEmmanuel Vadot          - enum:
29c66ec88fSEmmanuel Vadot              - qcom,msm8996-smmu-v2
30c66ec88fSEmmanuel Vadot              - qcom,msm8998-smmu-v2
31c66ec88fSEmmanuel Vadot          - const: qcom,smmu-v2
32c66ec88fSEmmanuel Vadot
33c66ec88fSEmmanuel Vadot      - description: Qcom SoCs implementing "arm,mmu-500"
34c66ec88fSEmmanuel Vadot        items:
35c66ec88fSEmmanuel Vadot          - enum:
36*8cc087a1SEmmanuel Vadot              - qcom,qcm2290-smmu-500
37c66ec88fSEmmanuel Vadot              - qcom,sc7180-smmu-500
382eb4d8dcSEmmanuel Vadot              - qcom,sc7280-smmu-500
395def4c47SEmmanuel Vadot              - qcom,sc8180x-smmu-500
40c66ec88fSEmmanuel Vadot              - qcom,sdm845-smmu-500
41*8cc087a1SEmmanuel Vadot              - qcom,sm6350-smmu-500
42c66ec88fSEmmanuel Vadot              - qcom,sm8150-smmu-500
43c66ec88fSEmmanuel Vadot              - qcom,sm8250-smmu-500
445def4c47SEmmanuel Vadot              - qcom,sm8350-smmu-500
45c66ec88fSEmmanuel Vadot          - const: arm,mmu-500
465def4c47SEmmanuel Vadot      - description: Qcom Adreno GPUs implementing "arm,smmu-v2"
475def4c47SEmmanuel Vadot        items:
485def4c47SEmmanuel Vadot          - enum:
495def4c47SEmmanuel Vadot              - qcom,sc7180-smmu-v2
505def4c47SEmmanuel Vadot              - qcom,sdm845-smmu-v2
515def4c47SEmmanuel Vadot          - const: qcom,adreno-smmu
525def4c47SEmmanuel Vadot          - const: qcom,smmu-v2
53c66ec88fSEmmanuel Vadot      - description: Marvell SoCs implementing "arm,mmu-500"
54c66ec88fSEmmanuel Vadot        items:
55c66ec88fSEmmanuel Vadot          - const: marvell,ap806-smmu-500
56c66ec88fSEmmanuel Vadot          - const: arm,mmu-500
575956d97fSEmmanuel Vadot      - description: NVIDIA SoCs that require memory controller interaction
585956d97fSEmmanuel Vadot          and may program multiple ARM MMU-500s identically with the memory
595956d97fSEmmanuel Vadot          controller interleaving translations between multiple instances
605956d97fSEmmanuel Vadot          for improved performance.
61c66ec88fSEmmanuel Vadot        items:
62c66ec88fSEmmanuel Vadot          - enum:
63c66ec88fSEmmanuel Vadot              - nvidia,tegra194-smmu
645956d97fSEmmanuel Vadot              - nvidia,tegra186-smmu
65c66ec88fSEmmanuel Vadot          - const: nvidia,smmu-500
66c66ec88fSEmmanuel Vadot      - items:
67c66ec88fSEmmanuel Vadot          - const: arm,mmu-500
68c66ec88fSEmmanuel Vadot          - const: arm,smmu-v2
69c66ec88fSEmmanuel Vadot      - items:
70c66ec88fSEmmanuel Vadot          - enum:
71c66ec88fSEmmanuel Vadot              - arm,mmu-400
72c66ec88fSEmmanuel Vadot              - arm,mmu-401
73c66ec88fSEmmanuel Vadot          - const: arm,smmu-v1
74c66ec88fSEmmanuel Vadot      - enum:
75c66ec88fSEmmanuel Vadot          - arm,smmu-v1
76c66ec88fSEmmanuel Vadot          - arm,smmu-v2
77c66ec88fSEmmanuel Vadot          - arm,mmu-400
78c66ec88fSEmmanuel Vadot          - arm,mmu-401
79c66ec88fSEmmanuel Vadot          - arm,mmu-500
80c66ec88fSEmmanuel Vadot          - cavium,smmu-v2
81c66ec88fSEmmanuel Vadot
82c66ec88fSEmmanuel Vadot  reg:
83c66ec88fSEmmanuel Vadot    minItems: 1
84c66ec88fSEmmanuel Vadot    maxItems: 2
85c66ec88fSEmmanuel Vadot
86c66ec88fSEmmanuel Vadot  '#global-interrupts':
87c66ec88fSEmmanuel Vadot    description: The number of global interrupts exposed by the device.
88c66ec88fSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
89c66ec88fSEmmanuel Vadot    minimum: 0
90c66ec88fSEmmanuel Vadot    maximum: 260   # 2 secure, 2 non-secure, and up to 256 perf counters
91c66ec88fSEmmanuel Vadot
92c66ec88fSEmmanuel Vadot  '#iommu-cells':
93c66ec88fSEmmanuel Vadot    enum: [ 1, 2 ]
94c66ec88fSEmmanuel Vadot    description: |
95c66ec88fSEmmanuel Vadot      See Documentation/devicetree/bindings/iommu/iommu.txt for details. With a
96c66ec88fSEmmanuel Vadot      value of 1, each IOMMU specifier represents a distinct stream ID emitted
97c66ec88fSEmmanuel Vadot      by that device into the relevant SMMU.
98c66ec88fSEmmanuel Vadot
99c66ec88fSEmmanuel Vadot      SMMUs with stream matching support and complex masters may use a value of
100c66ec88fSEmmanuel Vadot      2, where the second cell of the IOMMU specifier represents an SMR mask to
101c66ec88fSEmmanuel Vadot      combine with the ID in the first cell.  Care must be taken to ensure the
102c66ec88fSEmmanuel Vadot      set of matched IDs does not result in conflicts.
103c66ec88fSEmmanuel Vadot
104c66ec88fSEmmanuel Vadot  interrupts:
105c66ec88fSEmmanuel Vadot    minItems: 1
106c66ec88fSEmmanuel Vadot    maxItems: 388   # 260 plus 128 contexts
107c66ec88fSEmmanuel Vadot    description: |
108c66ec88fSEmmanuel Vadot      Interrupt list, with the first #global-interrupts entries corresponding to
109c66ec88fSEmmanuel Vadot      the global interrupts and any following entries corresponding to context
110c66ec88fSEmmanuel Vadot      interrupts, specified in order of their indexing by the SMMU.
111c66ec88fSEmmanuel Vadot
112c66ec88fSEmmanuel Vadot      For SMMUv2 implementations, there must be exactly one interrupt per
113c66ec88fSEmmanuel Vadot      context bank. In the case of a single, combined interrupt, it must be
114c66ec88fSEmmanuel Vadot      listed multiple times.
115c66ec88fSEmmanuel Vadot
116c66ec88fSEmmanuel Vadot  dma-coherent:
117c66ec88fSEmmanuel Vadot    description: |
118c66ec88fSEmmanuel Vadot      Present if page table walks made by the SMMU are cache coherent with the
119c66ec88fSEmmanuel Vadot      CPU.
120c66ec88fSEmmanuel Vadot
121c66ec88fSEmmanuel Vadot      NOTE: this only applies to the SMMU itself, not masters connected
122c66ec88fSEmmanuel Vadot      upstream of the SMMU.
123c66ec88fSEmmanuel Vadot
124c66ec88fSEmmanuel Vadot  calxeda,smmu-secure-config-access:
125c66ec88fSEmmanuel Vadot    type: boolean
126c66ec88fSEmmanuel Vadot    description:
127c66ec88fSEmmanuel Vadot      Enable proper handling of buggy implementations that always use secure
128c66ec88fSEmmanuel Vadot      access to SMMU configuration registers. In this case non-secure aliases of
129c66ec88fSEmmanuel Vadot      secure registers have to be used during SMMU configuration.
130c66ec88fSEmmanuel Vadot
131c66ec88fSEmmanuel Vadot  stream-match-mask:
132c66ec88fSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32
133c66ec88fSEmmanuel Vadot    description: |
134c66ec88fSEmmanuel Vadot      For SMMUs supporting stream matching and using #iommu-cells = <1>,
135c66ec88fSEmmanuel Vadot      specifies a mask of bits to ignore when matching stream IDs (e.g. this may
136c66ec88fSEmmanuel Vadot      be programmed into the SMRn.MASK field of every stream match register
137c66ec88fSEmmanuel Vadot      used). For cases where it is desirable to ignore some portion of every
138c66ec88fSEmmanuel Vadot      Stream ID (e.g. for certain MMU-500 configurations given globally unique
139c66ec88fSEmmanuel Vadot      input IDs). This property is not valid for SMMUs using stream indexing, or
140c66ec88fSEmmanuel Vadot      using stream matching with #iommu-cells = <2>, and may be ignored if
141c66ec88fSEmmanuel Vadot      present in such cases.
142c66ec88fSEmmanuel Vadot
143c66ec88fSEmmanuel Vadot  clock-names:
144c66ec88fSEmmanuel Vadot    items:
145c66ec88fSEmmanuel Vadot      - const: bus
146c66ec88fSEmmanuel Vadot      - const: iface
147c66ec88fSEmmanuel Vadot
148c66ec88fSEmmanuel Vadot  clocks:
149c66ec88fSEmmanuel Vadot    items:
150c66ec88fSEmmanuel Vadot      - description: bus clock required for downstream bus access and for the
151c66ec88fSEmmanuel Vadot          smmu ptw
152c66ec88fSEmmanuel Vadot      - description: interface clock required to access smmu's registers
153c66ec88fSEmmanuel Vadot          through the TCU's programming interface.
154c66ec88fSEmmanuel Vadot
155c66ec88fSEmmanuel Vadot  power-domains:
156c66ec88fSEmmanuel Vadot    maxItems: 1
157c66ec88fSEmmanuel Vadot
158c66ec88fSEmmanuel Vadotrequired:
159c66ec88fSEmmanuel Vadot  - compatible
160c66ec88fSEmmanuel Vadot  - reg
161c66ec88fSEmmanuel Vadot  - '#global-interrupts'
162c66ec88fSEmmanuel Vadot  - '#iommu-cells'
163c66ec88fSEmmanuel Vadot  - interrupts
164c66ec88fSEmmanuel Vadot
165c66ec88fSEmmanuel VadotadditionalProperties: false
166c66ec88fSEmmanuel Vadot
167c66ec88fSEmmanuel VadotallOf:
168c66ec88fSEmmanuel Vadot  - if:
169c66ec88fSEmmanuel Vadot      properties:
170c66ec88fSEmmanuel Vadot        compatible:
171c66ec88fSEmmanuel Vadot          contains:
172c66ec88fSEmmanuel Vadot            enum:
173c66ec88fSEmmanuel Vadot              - nvidia,tegra194-smmu
1745956d97fSEmmanuel Vadot              - nvidia,tegra186-smmu
175c66ec88fSEmmanuel Vadot    then:
176c66ec88fSEmmanuel Vadot      properties:
177c66ec88fSEmmanuel Vadot        reg:
1785956d97fSEmmanuel Vadot          minItems: 1
179c66ec88fSEmmanuel Vadot          maxItems: 2
180c66ec88fSEmmanuel Vadot    else:
181c66ec88fSEmmanuel Vadot      properties:
182c66ec88fSEmmanuel Vadot        reg:
183c66ec88fSEmmanuel Vadot          maxItems: 1
184c66ec88fSEmmanuel Vadot
185c66ec88fSEmmanuel Vadotexamples:
186c66ec88fSEmmanuel Vadot  - |+
187c66ec88fSEmmanuel Vadot    /* SMMU with stream matching or stream indexing */
188c66ec88fSEmmanuel Vadot    smmu1: iommu@ba5e0000 {
189c66ec88fSEmmanuel Vadot            compatible = "arm,smmu-v1";
190c66ec88fSEmmanuel Vadot            reg = <0xba5e0000 0x10000>;
191c66ec88fSEmmanuel Vadot            #global-interrupts = <2>;
192c66ec88fSEmmanuel Vadot            interrupts = <0 32 4>,
193c66ec88fSEmmanuel Vadot                         <0 33 4>,
194c66ec88fSEmmanuel Vadot                         <0 34 4>, /* This is the first context interrupt */
195c66ec88fSEmmanuel Vadot                         <0 35 4>,
196c66ec88fSEmmanuel Vadot                         <0 36 4>,
197c66ec88fSEmmanuel Vadot                         <0 37 4>;
198c66ec88fSEmmanuel Vadot            #iommu-cells = <1>;
199c66ec88fSEmmanuel Vadot    };
200c66ec88fSEmmanuel Vadot
201c66ec88fSEmmanuel Vadot    /* device with two stream IDs, 0 and 7 */
202c66ec88fSEmmanuel Vadot    master1 {
203c66ec88fSEmmanuel Vadot            iommus = <&smmu1 0>,
204c66ec88fSEmmanuel Vadot                     <&smmu1 7>;
205c66ec88fSEmmanuel Vadot    };
206c66ec88fSEmmanuel Vadot
207c66ec88fSEmmanuel Vadot
208c66ec88fSEmmanuel Vadot    /* SMMU with stream matching */
209c66ec88fSEmmanuel Vadot    smmu2: iommu@ba5f0000 {
210c66ec88fSEmmanuel Vadot            compatible = "arm,smmu-v1";
211c66ec88fSEmmanuel Vadot            reg = <0xba5f0000 0x10000>;
212c66ec88fSEmmanuel Vadot            #global-interrupts = <2>;
213c66ec88fSEmmanuel Vadot            interrupts = <0 38 4>,
214c66ec88fSEmmanuel Vadot                         <0 39 4>,
215c66ec88fSEmmanuel Vadot                         <0 40 4>, /* This is the first context interrupt */
216c66ec88fSEmmanuel Vadot                         <0 41 4>,
217c66ec88fSEmmanuel Vadot                         <0 42 4>,
218c66ec88fSEmmanuel Vadot                         <0 43 4>;
219c66ec88fSEmmanuel Vadot            #iommu-cells = <2>;
220c66ec88fSEmmanuel Vadot    };
221c66ec88fSEmmanuel Vadot
222c66ec88fSEmmanuel Vadot    /* device with stream IDs 0 and 7 */
223c66ec88fSEmmanuel Vadot    master2 {
224c66ec88fSEmmanuel Vadot            iommus = <&smmu2 0 0>,
225c66ec88fSEmmanuel Vadot                     <&smmu2 7 0>;
226c66ec88fSEmmanuel Vadot    };
227c66ec88fSEmmanuel Vadot
228c66ec88fSEmmanuel Vadot    /* device with stream IDs 1, 17, 33 and 49 */
229c66ec88fSEmmanuel Vadot    master3 {
230c66ec88fSEmmanuel Vadot            iommus = <&smmu2 1 0x30>;
231c66ec88fSEmmanuel Vadot    };
232c66ec88fSEmmanuel Vadot
233c66ec88fSEmmanuel Vadot
234c66ec88fSEmmanuel Vadot    /* ARM MMU-500 with 10-bit stream ID input configuration */
235c66ec88fSEmmanuel Vadot    smmu3: iommu@ba600000 {
236c66ec88fSEmmanuel Vadot            compatible = "arm,mmu-500", "arm,smmu-v2";
237c66ec88fSEmmanuel Vadot            reg = <0xba600000 0x10000>;
238c66ec88fSEmmanuel Vadot            #global-interrupts = <2>;
239c66ec88fSEmmanuel Vadot            interrupts = <0 44 4>,
240c66ec88fSEmmanuel Vadot                         <0 45 4>,
241c66ec88fSEmmanuel Vadot                         <0 46 4>, /* This is the first context interrupt */
242c66ec88fSEmmanuel Vadot                         <0 47 4>,
243c66ec88fSEmmanuel Vadot                         <0 48 4>,
244c66ec88fSEmmanuel Vadot                         <0 49 4>;
245c66ec88fSEmmanuel Vadot            #iommu-cells = <1>;
246c66ec88fSEmmanuel Vadot            /* always ignore appended 5-bit TBU number */
247c66ec88fSEmmanuel Vadot            stream-match-mask = <0x7c00>;
248c66ec88fSEmmanuel Vadot    };
249c66ec88fSEmmanuel Vadot
250c66ec88fSEmmanuel Vadot    bus {
251c66ec88fSEmmanuel Vadot            /* bus whose child devices emit one unique 10-bit stream
252c66ec88fSEmmanuel Vadot               ID each, but may master through multiple SMMU TBUs */
253c66ec88fSEmmanuel Vadot            iommu-map = <0 &smmu3 0 0x400>;
254c66ec88fSEmmanuel Vadot
255c66ec88fSEmmanuel Vadot
256c66ec88fSEmmanuel Vadot    };
257c66ec88fSEmmanuel Vadot
258c66ec88fSEmmanuel Vadot  - |+
259c66ec88fSEmmanuel Vadot    /* Qcom's arm,smmu-v2 implementation */
260c66ec88fSEmmanuel Vadot    #include <dt-bindings/interrupt-controller/arm-gic.h>
261c66ec88fSEmmanuel Vadot    #include <dt-bindings/interrupt-controller/irq.h>
262c66ec88fSEmmanuel Vadot    smmu4: iommu@d00000 {
263c66ec88fSEmmanuel Vadot      compatible = "qcom,msm8996-smmu-v2", "qcom,smmu-v2";
264c66ec88fSEmmanuel Vadot      reg = <0xd00000 0x10000>;
265c66ec88fSEmmanuel Vadot
266c66ec88fSEmmanuel Vadot      #global-interrupts = <1>;
267c66ec88fSEmmanuel Vadot      interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>,
268c66ec88fSEmmanuel Vadot             <GIC_SPI 320 IRQ_TYPE_LEVEL_HIGH>,
269c66ec88fSEmmanuel Vadot             <GIC_SPI 321 IRQ_TYPE_LEVEL_HIGH>;
270c66ec88fSEmmanuel Vadot      #iommu-cells = <1>;
271c66ec88fSEmmanuel Vadot      power-domains = <&mmcc 0>;
272c66ec88fSEmmanuel Vadot
273c66ec88fSEmmanuel Vadot      clocks = <&mmcc 123>,
274c66ec88fSEmmanuel Vadot        <&mmcc 124>;
275c66ec88fSEmmanuel Vadot      clock-names = "bus", "iface";
276c66ec88fSEmmanuel Vadot    };
277