@@ -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>
5572no-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
86103Example
87104-------
88- This example defines 3 contiguous regions are defined for Linux kernel:
105+ This example defines 4 contiguous regions for Linux kernel:
89106one 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