Debian Codegraph @

dtschema/schemas/iommu/iommu-provider.yaml

raw
1 # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2 # Copyright (c) 2014 NVIDIA CORPORATION
3 # Copyright 2025 Arm Ltd.
4 %YAML 1.2
5 ---
6 $id: http://devicetree.org/schemas/iommu/iommu-provider.yaml#
7 $schema: http://devicetree.org/meta-schemas/base.yaml#
8
9 title: IOMMU Provider Common Properties
10
11 description: >
12 An IOMMU can provide the following services:
13
14 * Remap address space to allow devices to access physical memory ranges that
15 they otherwise wouldn't be capable of accessing.
16
17 Example: 32-bit DMA to 64-bit physical addresses
18
19 * Implement scatter-gather at page level granularity so that the device does
20 not have to.
21
22 * Provide system protection against "rogue" DMA by forcing all accesses to go
23 through the IOMMU and faulting when encountering accesses to unmapped
24 address regions.
25
26 * Provide address space isolation between multiple contexts.
27
28 Example: Virtualization
29
30 Device nodes compatible with this binding represent hardware with some of the
31 above capabilities.
32
33 IOMMUs can be single-master or multiple-master. Single-master IOMMU devices
34 typically have a fixed association to the master device, whereas multiple-
35 master IOMMU devices can translate accesses from more than one master.
36
37 The device tree node of the IOMMU device's parent bus must contain a valid
38 "dma-ranges" property that describes how the physical address space of the
39 IOMMU maps to memory. An empty "dma-ranges" property means that there is a
40 1:1 mapping from IOMMU to memory.
41
42 maintainers:
43 - Rob Herring <[email protected]>
44
45 # always select the core schema
46 select: true
47
48 properties:
49 '#iommu-cells':
50 description: >
51 The number of cells in an IOMMU specifier needed to encode an address.
52
53 The meaning of the IOMMU specifier is defined by the device tree binding
54 of the specific IOMMU. Below are a few examples of typical use-cases:
55
56 - #iommu-cells = <0>: Single master IOMMU devices are not configurable and
57 therefore no additional information needs to be encoded in the specifier.
58 This may also apply to multiple master IOMMU devices that do not allow the
59 association of masters to be configured. Note that an IOMMU can by design
60 be multi-master yet only expose a single master in a given configuration.
61 In such cases the number of cells will usually be 1 as in the next case.
62
63 - #iommu-cells = <1>: Multiple master IOMMU devices may need to be configured
64 in order to enable translation for a given master. In such cases the single
65 address cell corresponds to the master device's ID. In some cases more than
66 one cell can be required to represent a single master ID.
67
68 - #iommu-cells = <4>: Some IOMMU devices allow the DMA window for masters to
69 be configured. The first cell of the address in this may contain the master
70 device's ID for example, while the second cell could contain the start of
71 the DMA window for the given device. The length of the DMA window is given
72 by the third and fourth cells.
73
74 Note that these are merely examples and real-world use-cases may use different
75 definitions to represent their individual needs. Always refer to the specific
76 IOMMU binding for the exact meaning of the cells that make up the specifier.
77
78 additionalProperties: true
79
80 examples:
81 - |
82 // Single-master IOMMU
83 iommu1: iommu {
84 #iommu-cells = <0>;
85 };
86
87 master {
88 iommus = <&iommu1>;
89 };
90
91 - |
92 // Multiple-master IOMMU
93 iommu2: iommu {
94 /* the specifier represents the ID of the master */
95 #iommu-cells = <1>;
96 };
97
98 master-1 {
99 /* device has master ID 42 in the IOMMU */
100 iommus = <&iommu2 42>;
101 };
102
103 master-2 {
104 /* device has master IDs 23 and 24 in the IOMMU */
105 iommus = <&iommu2 23>, <&iommu2 24>;
106 };
107
108 - |
109 // Multiple-master IOMMU with configurable DMA window
110 iommu3: iommu {
111 /*
112 * One cell for the master ID and one cell for the
113 * address of the DMA window. The length of the DMA
114 * window is encoded in two cells.
115 *
116 * The DMA window is the range addressable by the
117 * master (i.e. the I/O virtual address space).
118 */
119 #iommu-cells = <4>;
120 };
121
122 master {
123 /* master ID 42, 4 GiB DMA window starting at 0 */
124 iommus = <&iommu3 42 0 0x1 0x0>;
125 };
126 ...