xref: /openbmc/linux/Documentation/devicetree/bindings/reserved-memory/reserved-memory.yaml (revision 9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e)
1bf99826fSMaxime Ripard# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2bf99826fSMaxime Ripard%YAML 1.2
3bf99826fSMaxime Ripard---
4bf99826fSMaxime Ripard$id: http://devicetree.org/schemas/reserved-memory/reserved-memory.yaml#
5bf99826fSMaxime Ripard$schema: http://devicetree.org/meta-schemas/core.yaml#
6bf99826fSMaxime Ripard
7dd3cb467SAndrew Lunntitle: /reserved-memory Child Node Common
8bf99826fSMaxime Ripard
9bf99826fSMaxime Ripardmaintainers:
10bf99826fSMaxime Ripard  - devicetree-spec@vger.kernel.org
11bf99826fSMaxime Ripard
12bf99826fSMaxime Riparddescription: >
13bf99826fSMaxime Ripard  Reserved memory is specified as a node under the /reserved-memory node. The
14bf99826fSMaxime Ripard  operating system shall exclude reserved memory from normal usage one can
15bf99826fSMaxime Ripard  create child nodes describing particular reserved (excluded from normal use)
16bf99826fSMaxime Ripard  memory regions. Such memory regions are usually designed for the special
17bf99826fSMaxime Ripard  usage by various device drivers.
18bf99826fSMaxime Ripard
19bf99826fSMaxime Ripard  Each child of the reserved-memory node specifies one or more regions
20bf99826fSMaxime Ripard  of reserved memory. Each child node may either use a 'reg' property to
21bf99826fSMaxime Ripard  specify a specific range of reserved memory, or a 'size' property with
22bf99826fSMaxime Ripard  optional constraints to request a dynamically allocated block of
23bf99826fSMaxime Ripard  memory.
24bf99826fSMaxime Ripard
25bf99826fSMaxime Ripard  Following the generic-names recommended practice, node names should
26bf99826fSMaxime Ripard  reflect the purpose of the node (ie. "framebuffer" or "dma-pool").
27bf99826fSMaxime Ripard  Unit address (@<address>) should be appended to the name if the node
28bf99826fSMaxime Ripard  is a static allocation.
29bf99826fSMaxime Ripard
30bf99826fSMaxime Ripardproperties:
31bf99826fSMaxime Ripard  reg: true
32bf99826fSMaxime Ripard
33bf99826fSMaxime Ripard  size:
34*18b616d0SRob Herring    oneOf:
35*18b616d0SRob Herring      - $ref: /schemas/types.yaml#/definitions/uint32
36*18b616d0SRob Herring      - $ref: /schemas/types.yaml#/definitions/uint64
37bf99826fSMaxime Ripard    description: >
38bf99826fSMaxime Ripard      Length based on parent's \#size-cells. Size in bytes of memory to
39bf99826fSMaxime Ripard      reserve.
40bf99826fSMaxime Ripard
41bf99826fSMaxime Ripard  alignment:
42*18b616d0SRob Herring    oneOf:
43*18b616d0SRob Herring      - $ref: /schemas/types.yaml#/definitions/uint32
44*18b616d0SRob Herring      - $ref: /schemas/types.yaml#/definitions/uint64
45bf99826fSMaxime Ripard    description: >
46bf99826fSMaxime Ripard      Length based on parent's \#size-cells. Address boundary for
47bf99826fSMaxime Ripard      alignment of allocation.
48bf99826fSMaxime Ripard
49bf99826fSMaxime Ripard  alloc-ranges:
50bf99826fSMaxime Ripard    $ref: /schemas/types.yaml#/definitions/uint32-array
51bf99826fSMaxime Ripard    description: >
52bf99826fSMaxime Ripard      Address and Length pairs. Specifies regions of memory that are
53bf99826fSMaxime Ripard      acceptable to allocate from.
54bf99826fSMaxime Ripard
55af0d8135SThierry Reding  iommu-addresses:
56af0d8135SThierry Reding    $ref: /schemas/types.yaml#/definitions/phandle-array
57af0d8135SThierry Reding    description: >
58af0d8135SThierry Reding      A list of phandle and specifier pairs that describe static IO virtual
59af0d8135SThierry Reding      address space mappings and carveouts associated with a given reserved
60af0d8135SThierry Reding      memory region. The phandle in the first cell refers to the device for
61af0d8135SThierry Reding      which the mapping or carveout is to be created.
62af0d8135SThierry Reding
63af0d8135SThierry Reding      The specifier consists of an address/size pair and denotes the IO
64af0d8135SThierry Reding      virtual address range of the region for the given device. The exact
65af0d8135SThierry Reding      format depends on the values of the "#address-cells" and "#size-cells"
66af0d8135SThierry Reding      properties of the device referenced via the phandle.
67af0d8135SThierry Reding
68af0d8135SThierry Reding      When used in combination with a "reg" property, an IOVA mapping is to
69af0d8135SThierry Reding      be established for this memory region. One example where this can be
70af0d8135SThierry Reding      useful is to create an identity mapping for physical memory that the
71af0d8135SThierry Reding      firmware has configured some hardware to access (such as a bootsplash
72af0d8135SThierry Reding      framebuffer).
73af0d8135SThierry Reding
74af0d8135SThierry Reding      If no "reg" property is specified, the "iommu-addresses" property
75af0d8135SThierry Reding      defines carveout regions in the IOVA space for the given device. This
76af0d8135SThierry Reding      can be useful if a certain memory region should not be mapped through
77af0d8135SThierry Reding      the IOMMU.
78af0d8135SThierry Reding
79bf99826fSMaxime Ripard  no-map:
80bf99826fSMaxime Ripard    type: boolean
81bf99826fSMaxime Ripard    description: >
82bf99826fSMaxime Ripard      Indicates the operating system must not create a virtual mapping
83bf99826fSMaxime Ripard      of the region as part of its standard mapping of system memory,
84bf99826fSMaxime Ripard      nor permit speculative access to it under any circumstances other
85bf99826fSMaxime Ripard      than under the control of the device driver using the region.
86bf99826fSMaxime Ripard
87bf99826fSMaxime Ripard  reusable:
88bf99826fSMaxime Ripard    type: boolean
89bf99826fSMaxime Ripard    description: >
90bf99826fSMaxime Ripard      The operating system can use the memory in this region with the
91bf99826fSMaxime Ripard      limitation that the device driver(s) owning the region need to be
92bf99826fSMaxime Ripard      able to reclaim it back. Typically that means that the operating
93bf99826fSMaxime Ripard      system can use that region to store volatile or cached data that
94bf99826fSMaxime Ripard      can be otherwise regenerated or migrated elsewhere.
95bf99826fSMaxime Ripard
96bf99826fSMaxime RipardallOf:
97bf99826fSMaxime Ripard  - if:
98bf99826fSMaxime Ripard      required:
99bf99826fSMaxime Ripard        - no-map
100bf99826fSMaxime Ripard
101bf99826fSMaxime Ripard    then:
102bf99826fSMaxime Ripard      not:
103bf99826fSMaxime Ripard        required:
104bf99826fSMaxime Ripard          - reusable
105bf99826fSMaxime Ripard
106bf99826fSMaxime Ripard  - if:
107bf99826fSMaxime Ripard      required:
108bf99826fSMaxime Ripard        - reusable
109bf99826fSMaxime Ripard
110bf99826fSMaxime Ripard    then:
111bf99826fSMaxime Ripard      not:
112bf99826fSMaxime Ripard        required:
113bf99826fSMaxime Ripard          - no-map
114bf99826fSMaxime Ripard
115bf99826fSMaxime RipardoneOf:
116af0d8135SThierry Reding  - oneOf:
117bf99826fSMaxime Ripard      - required:
118bf99826fSMaxime Ripard          - reg
119bf99826fSMaxime Ripard
120bf99826fSMaxime Ripard      - required:
121bf99826fSMaxime Ripard          - size
122bf99826fSMaxime Ripard
123af0d8135SThierry Reding  - oneOf:
124af0d8135SThierry Reding      # IOMMU reservations
125af0d8135SThierry Reding      - required:
126af0d8135SThierry Reding          - iommu-addresses
127af0d8135SThierry Reding
128af0d8135SThierry Reding      # IOMMU mappings
129af0d8135SThierry Reding      - required:
130af0d8135SThierry Reding          - reg
131af0d8135SThierry Reding          - iommu-addresses
132af0d8135SThierry Reding
133bf99826fSMaxime RipardadditionalProperties: true
134bf99826fSMaxime Ripard
135af0d8135SThierry Redingexamples:
136af0d8135SThierry Reding  - |
137af0d8135SThierry Reding    / {
138af0d8135SThierry Reding      compatible = "foo";
139af0d8135SThierry Reding      model = "foo";
140af0d8135SThierry Reding
141af0d8135SThierry Reding      #address-cells = <2>;
142af0d8135SThierry Reding      #size-cells = <2>;
143af0d8135SThierry Reding
144af0d8135SThierry Reding      reserved-memory {
145af0d8135SThierry Reding        #address-cells = <2>;
146af0d8135SThierry Reding        #size-cells = <2>;
147af0d8135SThierry Reding        ranges;
148af0d8135SThierry Reding
149af0d8135SThierry Reding        adsp_resv: reservation-adsp {
150af0d8135SThierry Reding          /*
151af0d8135SThierry Reding           * Restrict IOVA mappings for ADSP buffers to the 512 MiB region
152af0d8135SThierry Reding           * from 0x40000000 - 0x5fffffff. Anything outside is reserved by
153af0d8135SThierry Reding           * the ADSP for I/O memory and private memory allocations.
154af0d8135SThierry Reding           */
155af0d8135SThierry Reding          iommu-addresses = <&adsp 0x0 0x00000000 0x00 0x40000000>,
156af0d8135SThierry Reding                            <&adsp 0x0 0x60000000 0xff 0xa0000000>;
157af0d8135SThierry Reding        };
158af0d8135SThierry Reding
159af0d8135SThierry Reding        fb: framebuffer@90000000 {
160af0d8135SThierry Reding          reg = <0x0 0x90000000 0x0 0x00800000>;
161af0d8135SThierry Reding          iommu-addresses = <&dc0 0x0 0x90000000 0x0 0x00800000>;
162af0d8135SThierry Reding        };
163af0d8135SThierry Reding      };
164af0d8135SThierry Reding
165af0d8135SThierry Reding      bus@0 {
166af0d8135SThierry Reding        #address-cells = <1>;
167af0d8135SThierry Reding        #size-cells = <1>;
168af0d8135SThierry Reding        ranges = <0x0 0x0 0x0 0x40000000>;
169af0d8135SThierry Reding
170af0d8135SThierry Reding        adsp: adsp@2990000 {
171af0d8135SThierry Reding          reg = <0x2990000 0x2000>;
172af0d8135SThierry Reding          memory-region = <&adsp_resv>;
173af0d8135SThierry Reding        };
174af0d8135SThierry Reding
175af0d8135SThierry Reding        dc0: display@15200000 {
176af0d8135SThierry Reding          reg = <0x15200000 0x10000>;
177af0d8135SThierry Reding          memory-region = <&fb>;
178af0d8135SThierry Reding        };
179af0d8135SThierry Reding      };
180af0d8135SThierry Reding    };
181bf99826fSMaxime Ripard...
182