1 *** Reserved memory regions ***
3 Reserved memory is specified as a node under the /reserved-memory node.
4 The operating system shall exclude reserved memory from normal usage
5 one can create child nodes describing particular reserved (excluded from
6 normal use) memory regions. Such memory regions are usually designed for
7 the special usage by various device drivers.
9 Parameters for each memory region can be encoded into the device tree
10 with the following nodes:
14 #address-cells, #size-cells (required) - standard definition
15 - Should use the same values as the root node
16 ranges (required) - standard definition
19 /reserved-memory/ child nodes
20 -----------------------------
21 Each child of the reserved-memory node specifies one or more regions of
22 reserved memory. Each child node may either use a 'reg' property to
23 specify a specific range of reserved memory, or a 'size' property with
24 optional constraints to request a dynamically allocated block of memory.
26 Following the generic-names recommended practice, node names should
27 reflect the purpose of the node (ie. "framebuffer" or "dma-pool"). Unit
28 address (@<address>) should be appended to the name if the node is a
32 Requires either a) or b) below.
34 reg (required) - standard definition
36 size (required) - length based on parent's #size-cells
37 - Size in bytes of memory to reserve.
38 alignment (optional) - length based on parent's #size-cells
39 - Address boundary for alignment of allocation.
40 alloc-ranges (optional) - prop-encoded-array (address, length pairs).
41 - Specifies regions of memory that are
42 acceptable to allocate from.
44 If both reg and size are present, then the reg property takes precedence
47 Additional properties:
48 compatible (optional) - standard definition
49 - may contain the following strings:
50 - shared-dma-pool: This indicates a region of memory meant to be
51 used as a shared pool of DMA buffers for a set of devices. It can
52 be used by an operating system to instantiate the necessary pool
53 management subsystem if necessary.
54 - restricted-dma-pool: This indicates a region of memory meant to be
55 used as a pool of restricted DMA buffers for a set of devices. The
56 memory region would be the only region accessible to those devices.
57 When using this, the no-map and reusable properties must not be set,
58 so the operating system can create a virtual mapping that will be used
59 for synchronization. The main purpose for restricted DMA is to
60 mitigate the lack of DMA access control on systems without an IOMMU,
61 which could result in the DMA accessing the system memory at
62 unexpected times and/or unexpected addresses, possibly leading to data
63 leakage or corruption. The feature on its own provides a basic level
64 of protection against the DMA overwriting buffer contents at
65 unexpected times. However, to protect against general data leakage and
66 system memory corruption, the system needs to provide way to lock down
67 the memory access, e.g., MPU. Note that since coherent allocation
68 needs remapping, one must set up another device coherent pool by
69 shared-dma-pool and use dma_alloc_from_dev_coherent instead for atomic
71 - vendor specific string in the form <vendor>,[<device>-]<usage>
72 no-map (optional) - empty property
73 - Indicates the operating system must not create a virtual mapping
74 of the region as part of its standard mapping of system memory,
75 nor permit speculative access to it under any circumstances other
76 than under the control of the device driver using the region.
77 reusable (optional) - empty property
78 - The operating system can use the memory in this region with the
79 limitation that the device driver(s) owning the region need to be
80 able to reclaim it back. Typically that means that the operating
81 system can use that region to store volatile or cached data that
82 can be otherwise regenerated or migrated elsewhere.
84 A node must not carry both the no-map and the reusable property as these are
85 logically contradictory.
87 Linux implementation note:
88 - If a "linux,cma-default" property is present, then Linux will use the
89 region for the default pool of the contiguous memory allocator.
91 - If a "linux,dma-default" property is present, then Linux will use the
92 region for the default pool of the consistent DMA allocator.
94 Device node references to reserved memory
95 -----------------------------------------
96 Regions in the /reserved-memory node may be referenced by other device
97 nodes by adding a memory-region property to the device node.
99 memory-region (optional) - phandle, specifier pairs to children of /reserved-memory
100 memory-region-names (optional) - a list of names, one for each corresponding
101 entry in the memory-region property
105 This example defines 4 contiguous regions for Linux kernel:
106 one default of all device drivers (named linux,cma@72000000 and 64MiB in size),
107 one dedicated to the framebuffer device (named framebuffer@78000000, 8MiB),
108 one for multimedia processing (named multimedia-memory@77000000, 64MiB), and
109 one for restricted dma pool (named restricted_dma_reserved@0x50000000, 64MiB).
112 #address-cells = <1>;
116 reg = <0x40000000 0x40000000>;
120 #address-cells = <1>;
124 /* global autoconfigured region for contiguous allocations */
126 compatible = "shared-dma-pool";
129 alignment = <0x2000>;
133 display_reserved: framebuffer@78000000 {
134 reg = <0x78000000 0x800000>;
137 multimedia_reserved: multimedia@77000000 {
138 compatible = "acme,multimedia-memory";
139 reg = <0x77000000 0x4000000>;
142 restricted_dma_reserved: restricted_dma_reserved {
143 compatible = "restricted-dma-pool";
144 reg = <0x50000000 0x4000000>;
150 fb0: video@12300000 {
151 memory-region = <&display_reserved>;
155 scaler: scaler@12500000 {
156 memory-region = <&multimedia_reserved>;
160 codec: codec@12600000 {
161 memory-region = <&multimedia_reserved>;
165 pcie_device: pcie_device@0,0 {
166 reg = <0x83010000 0x0 0x00000000 0x0 0x00100000
167 0x83010000 0x0 0x00100000 0x0 0x00100000>;
168 memory-region = <&restricted_dma_reserved>;