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