xref: /freebsd/sys/contrib/device-tree/Bindings/iommu/riscv,iommu.yaml (revision 833e5d42ab135b0238e61c5b3c19b8619677cbfa)
1*5f62a964SEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2*5f62a964SEmmanuel Vadot%YAML 1.2
3*5f62a964SEmmanuel Vadot---
4*5f62a964SEmmanuel Vadot$id: http://devicetree.org/schemas/iommu/riscv,iommu.yaml#
5*5f62a964SEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6*5f62a964SEmmanuel Vadot
7*5f62a964SEmmanuel Vadottitle: RISC-V IOMMU Architecture Implementation
8*5f62a964SEmmanuel Vadot
9*5f62a964SEmmanuel Vadotmaintainers:
10*5f62a964SEmmanuel Vadot  - Tomasz Jeznach <tjeznach@rivosinc.com>
11*5f62a964SEmmanuel Vadot
12*5f62a964SEmmanuel Vadotdescription: |
13*5f62a964SEmmanuel Vadot  The RISC-V IOMMU provides memory address translation and isolation for
14*5f62a964SEmmanuel Vadot  input and output devices, supporting per-device translation context,
15*5f62a964SEmmanuel Vadot  shared process address spaces including the ATS and PRI components of
16*5f62a964SEmmanuel Vadot  the PCIe specification, two stage address translation and MSI remapping.
17*5f62a964SEmmanuel Vadot  It supports identical translation table format to the RISC-V address
18*5f62a964SEmmanuel Vadot  translation tables with page level access and protection attributes.
19*5f62a964SEmmanuel Vadot  Hardware uses in-memory command and fault reporting queues with wired
20*5f62a964SEmmanuel Vadot  interrupt or MSI notifications.
21*5f62a964SEmmanuel Vadot
22*5f62a964SEmmanuel Vadot  Visit https://github.com/riscv-non-isa/riscv-iommu for more details.
23*5f62a964SEmmanuel Vadot
24*5f62a964SEmmanuel Vadot  For information on assigning RISC-V IOMMU to its peripheral devices,
25*5f62a964SEmmanuel Vadot  see generic IOMMU bindings.
26*5f62a964SEmmanuel Vadot
27*5f62a964SEmmanuel Vadotproperties:
28*5f62a964SEmmanuel Vadot  # For PCIe IOMMU hardware compatible property should contain the vendor
29*5f62a964SEmmanuel Vadot  # and device ID according to the PCI Bus Binding specification.
30*5f62a964SEmmanuel Vadot  # Since PCI provides built-in identification methods, compatible is not
31*5f62a964SEmmanuel Vadot  # actually required. For non-PCIe hardware implementations 'riscv,iommu'
32*5f62a964SEmmanuel Vadot  # should be specified along with 'reg' property providing MMIO location.
33*5f62a964SEmmanuel Vadot  compatible:
34*5f62a964SEmmanuel Vadot    oneOf:
35*5f62a964SEmmanuel Vadot      - items:
36*5f62a964SEmmanuel Vadot          - enum:
37*5f62a964SEmmanuel Vadot              - qemu,riscv-iommu
38*5f62a964SEmmanuel Vadot          - const: riscv,iommu
39*5f62a964SEmmanuel Vadot      - items:
40*5f62a964SEmmanuel Vadot          - enum:
41*5f62a964SEmmanuel Vadot              - pci1efd,edf1
42*5f62a964SEmmanuel Vadot          - const: riscv,pci-iommu
43*5f62a964SEmmanuel Vadot
44*5f62a964SEmmanuel Vadot  reg:
45*5f62a964SEmmanuel Vadot    maxItems: 1
46*5f62a964SEmmanuel Vadot    description:
47*5f62a964SEmmanuel Vadot      For non-PCI devices this represents base address and size of for the
48*5f62a964SEmmanuel Vadot      IOMMU memory mapped registers interface.
49*5f62a964SEmmanuel Vadot      For PCI IOMMU hardware implementation this should represent an address
50*5f62a964SEmmanuel Vadot      of the IOMMU, as defined in the PCI Bus Binding reference.
51*5f62a964SEmmanuel Vadot
52*5f62a964SEmmanuel Vadot  '#iommu-cells':
53*5f62a964SEmmanuel Vadot    const: 1
54*5f62a964SEmmanuel Vadot    description:
55*5f62a964SEmmanuel Vadot      The single cell describes the requester id emitted by a master to the
56*5f62a964SEmmanuel Vadot      IOMMU.
57*5f62a964SEmmanuel Vadot
58*5f62a964SEmmanuel Vadot  interrupts:
59*5f62a964SEmmanuel Vadot    minItems: 1
60*5f62a964SEmmanuel Vadot    maxItems: 4
61*5f62a964SEmmanuel Vadot    description:
62*5f62a964SEmmanuel Vadot      Wired interrupt vectors available for RISC-V IOMMU to notify the
63*5f62a964SEmmanuel Vadot      RISC-V HARTS. The cause to interrupt vector is software defined
64*5f62a964SEmmanuel Vadot      using IVEC IOMMU register.
65*5f62a964SEmmanuel Vadot
66*5f62a964SEmmanuel Vadot  msi-parent: true
67*5f62a964SEmmanuel Vadot
68*5f62a964SEmmanuel Vadot  power-domains:
69*5f62a964SEmmanuel Vadot    maxItems: 1
70*5f62a964SEmmanuel Vadot
71*5f62a964SEmmanuel Vadotrequired:
72*5f62a964SEmmanuel Vadot  - compatible
73*5f62a964SEmmanuel Vadot  - reg
74*5f62a964SEmmanuel Vadot  - '#iommu-cells'
75*5f62a964SEmmanuel Vadot
76*5f62a964SEmmanuel VadotadditionalProperties: false
77*5f62a964SEmmanuel Vadot
78*5f62a964SEmmanuel Vadotexamples:
79*5f62a964SEmmanuel Vadot  - |+
80*5f62a964SEmmanuel Vadot    /* Example 1 (IOMMU device with wired interrupts) */
81*5f62a964SEmmanuel Vadot    #include <dt-bindings/interrupt-controller/irq.h>
82*5f62a964SEmmanuel Vadot
83*5f62a964SEmmanuel Vadot    iommu1: iommu@1bccd000 {
84*5f62a964SEmmanuel Vadot        compatible = "qemu,riscv-iommu", "riscv,iommu";
85*5f62a964SEmmanuel Vadot        reg = <0x1bccd000 0x1000>;
86*5f62a964SEmmanuel Vadot        interrupt-parent = <&aplic_smode>;
87*5f62a964SEmmanuel Vadot        interrupts = <32 IRQ_TYPE_LEVEL_HIGH>,
88*5f62a964SEmmanuel Vadot                     <33 IRQ_TYPE_LEVEL_HIGH>,
89*5f62a964SEmmanuel Vadot                     <34 IRQ_TYPE_LEVEL_HIGH>,
90*5f62a964SEmmanuel Vadot                     <35 IRQ_TYPE_LEVEL_HIGH>;
91*5f62a964SEmmanuel Vadot        #iommu-cells = <1>;
92*5f62a964SEmmanuel Vadot    };
93*5f62a964SEmmanuel Vadot
94*5f62a964SEmmanuel Vadot    /* Device with two IOMMU device IDs, 0 and 7 */
95*5f62a964SEmmanuel Vadot    master1 {
96*5f62a964SEmmanuel Vadot        iommus = <&iommu1 0>, <&iommu1 7>;
97*5f62a964SEmmanuel Vadot    };
98*5f62a964SEmmanuel Vadot
99*5f62a964SEmmanuel Vadot  - |+
100*5f62a964SEmmanuel Vadot    /* Example 2 (IOMMU device with shared wired interrupt) */
101*5f62a964SEmmanuel Vadot    #include <dt-bindings/interrupt-controller/irq.h>
102*5f62a964SEmmanuel Vadot
103*5f62a964SEmmanuel Vadot    iommu2: iommu@1bccd000 {
104*5f62a964SEmmanuel Vadot        compatible = "qemu,riscv-iommu", "riscv,iommu";
105*5f62a964SEmmanuel Vadot        reg = <0x1bccd000 0x1000>;
106*5f62a964SEmmanuel Vadot        interrupt-parent = <&aplic_smode>;
107*5f62a964SEmmanuel Vadot        interrupts = <32 IRQ_TYPE_LEVEL_HIGH>;
108*5f62a964SEmmanuel Vadot        #iommu-cells = <1>;
109*5f62a964SEmmanuel Vadot    };
110*5f62a964SEmmanuel Vadot
111*5f62a964SEmmanuel Vadot  - |+
112*5f62a964SEmmanuel Vadot    /* Example 3 (IOMMU device with MSIs) */
113*5f62a964SEmmanuel Vadot    iommu3: iommu@1bcdd000 {
114*5f62a964SEmmanuel Vadot        compatible = "qemu,riscv-iommu", "riscv,iommu";
115*5f62a964SEmmanuel Vadot        reg = <0x1bccd000 0x1000>;
116*5f62a964SEmmanuel Vadot        msi-parent = <&imsics_smode>;
117*5f62a964SEmmanuel Vadot        #iommu-cells = <1>;
118*5f62a964SEmmanuel Vadot    };
119*5f62a964SEmmanuel Vadot
120*5f62a964SEmmanuel Vadot  - |+
121*5f62a964SEmmanuel Vadot    /* Example 4 (IOMMU PCIe device with MSIs) */
122*5f62a964SEmmanuel Vadot    bus {
123*5f62a964SEmmanuel Vadot        #address-cells = <2>;
124*5f62a964SEmmanuel Vadot        #size-cells = <2>;
125*5f62a964SEmmanuel Vadot
126*5f62a964SEmmanuel Vadot        pcie@30000000 {
127*5f62a964SEmmanuel Vadot            device_type = "pci";
128*5f62a964SEmmanuel Vadot            #address-cells = <3>;
129*5f62a964SEmmanuel Vadot            #size-cells = <2>;
130*5f62a964SEmmanuel Vadot            reg = <0x0 0x30000000  0x0 0x1000000>;
131*5f62a964SEmmanuel Vadot            ranges = <0x02000000 0x0 0x41000000  0x0 0x41000000  0x0 0x0f000000>;
132*5f62a964SEmmanuel Vadot
133*5f62a964SEmmanuel Vadot            /*
134*5f62a964SEmmanuel Vadot             * The IOMMU manages all functions in this PCI domain except
135*5f62a964SEmmanuel Vadot             * itself. Omit BDF 00:01.0.
136*5f62a964SEmmanuel Vadot             */
137*5f62a964SEmmanuel Vadot            iommu-map = <0x0 &iommu0 0x0 0x8>,
138*5f62a964SEmmanuel Vadot                        <0x9 &iommu0 0x9 0xfff7>;
139*5f62a964SEmmanuel Vadot
140*5f62a964SEmmanuel Vadot            /* The IOMMU programming interface uses slot 00:01.0 */
141*5f62a964SEmmanuel Vadot            iommu0: iommu@1,0 {
142*5f62a964SEmmanuel Vadot                compatible = "pci1efd,edf1", "riscv,pci-iommu";
143*5f62a964SEmmanuel Vadot                reg = <0x800 0 0 0 0>;
144*5f62a964SEmmanuel Vadot                #iommu-cells = <1>;
145*5f62a964SEmmanuel Vadot            };
146*5f62a964SEmmanuel Vadot        };
147*5f62a964SEmmanuel Vadot    };
148