Skip to content

Commit b12fe99

Browse files
Claire Changkonradwilk
authored andcommitted
dt-bindings: of: Add restricted DMA pool
Introduce the new compatible string, restricted-dma-pool, for restricted DMA. One can specify the address and length of the restricted DMA memory region by restricted-dma-pool in the reserved-memory node. Signed-off-by: Claire Chang <[email protected]> Tested-by: Stefano Stabellini <[email protected]> Tested-by: Will Deacon <[email protected]> Signed-off-by: Konrad Rzeszutek Wilk <[email protected]>
1 parent 0b84e4f commit b12fe99

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,23 @@ compatible (optional) - standard definition
5151
used as a shared pool of DMA buffers for a set of devices. It can
5252
be used by an operating system to instantiate the necessary pool
5353
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
70+
coherent allocation.
5471
- vendor specific string in the form <vendor>,[<device>-]<usage>
5572
no-map (optional) - empty property
5673
- Indicates the operating system must not create a virtual mapping
@@ -85,10 +102,11 @@ memory-region-names (optional) - a list of names, one for each corresponding
85102

86103
Example
87104
-------
88-
This example defines 3 contiguous regions are defined for Linux kernel:
105+
This example defines 4 contiguous regions for Linux kernel:
89106
one default of all device drivers (named linux,cma@72000000 and 64MiB in size),
90-
one dedicated to the framebuffer device (named framebuffer@78000000, 8MiB), and
91-
one for multimedia processing (named multimedia-memory@77000000, 64MiB).
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).
92110

93111
/ {
94112
#address-cells = <1>;
@@ -120,6 +138,11 @@ one for multimedia processing (named multimedia-memory@77000000, 64MiB).
120138
compatible = "acme,multimedia-memory";
121139
reg = <0x77000000 0x4000000>;
122140
};
141+
142+
restricted_dma_reserved: restricted_dma_reserved {
143+
compatible = "restricted-dma-pool";
144+
reg = <0x50000000 0x4000000>;
145+
};
123146
};
124147

125148
/* ... */
@@ -138,4 +161,11 @@ one for multimedia processing (named multimedia-memory@77000000, 64MiB).
138161
memory-region = <&multimedia_reserved>;
139162
/* ... */
140163
};
164+
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>;
169+
/* ... */
170+
};
141171
};

0 commit comments

Comments
 (0)