xref: /freebsd-src/sys/contrib/device-tree/Bindings/reserved-memory/shared-dma-pool.yaml (revision fac71e4e09885bb2afa3d984a0c239a52e1a7418)
18cc087a1SEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
28cc087a1SEmmanuel Vadot%YAML 1.2
38cc087a1SEmmanuel Vadot---
48cc087a1SEmmanuel Vadot$id: http://devicetree.org/schemas/reserved-memory/shared-dma-pool.yaml#
58cc087a1SEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
68cc087a1SEmmanuel Vadot
78bab661aSEmmanuel Vadottitle: /reserved-memory DMA pool
88cc087a1SEmmanuel Vadot
98cc087a1SEmmanuel Vadotmaintainers:
108cc087a1SEmmanuel Vadot  - devicetree-spec@vger.kernel.org
118cc087a1SEmmanuel Vadot
128cc087a1SEmmanuel VadotallOf:
13*fac71e4eSEmmanuel Vadot  - $ref: reserved-memory.yaml
148cc087a1SEmmanuel Vadot
158cc087a1SEmmanuel Vadotproperties:
168cc087a1SEmmanuel Vadot  compatible:
178cc087a1SEmmanuel Vadot    oneOf:
188cc087a1SEmmanuel Vadot      - const: shared-dma-pool
198cc087a1SEmmanuel Vadot        description: >
208cc087a1SEmmanuel Vadot          This indicates a region of memory meant to be used as a shared
218cc087a1SEmmanuel Vadot          pool of DMA buffers for a set of devices. It can be used by an
228cc087a1SEmmanuel Vadot          operating system to instantiate the necessary pool management
238cc087a1SEmmanuel Vadot          subsystem if necessary.
248cc087a1SEmmanuel Vadot
258cc087a1SEmmanuel Vadot      - const: restricted-dma-pool
268cc087a1SEmmanuel Vadot        description: >
278cc087a1SEmmanuel Vadot          This indicates a region of memory meant to be used as a pool
288cc087a1SEmmanuel Vadot          of restricted DMA buffers for a set of devices. The memory
298cc087a1SEmmanuel Vadot          region would be the only region accessible to those devices.
308cc087a1SEmmanuel Vadot          When using this, the no-map and reusable properties must not
318cc087a1SEmmanuel Vadot          be set, so the operating system can create a virtual mapping
328cc087a1SEmmanuel Vadot          that will be used for synchronization. The main purpose for
338cc087a1SEmmanuel Vadot          restricted DMA is to mitigate the lack of DMA access control
348cc087a1SEmmanuel Vadot          on systems without an IOMMU, which could result in the DMA
358cc087a1SEmmanuel Vadot          accessing the system memory at unexpected times and/or
368cc087a1SEmmanuel Vadot          unexpected addresses, possibly leading to data leakage or
378cc087a1SEmmanuel Vadot          corruption. The feature on its own provides a basic level of
388cc087a1SEmmanuel Vadot          protection against the DMA overwriting buffer contents at
398cc087a1SEmmanuel Vadot          unexpected times. However, to protect against general data
408cc087a1SEmmanuel Vadot          leakage and system memory corruption, the system needs to
418cc087a1SEmmanuel Vadot          provide way to lock down the memory access, e.g., MPU. Note
428cc087a1SEmmanuel Vadot          that since coherent allocation needs remapping, one must set
438cc087a1SEmmanuel Vadot          up another device coherent pool by shared-dma-pool and use
448cc087a1SEmmanuel Vadot          dma_alloc_from_dev_coherent instead for atomic coherent
458cc087a1SEmmanuel Vadot          allocation.
468cc087a1SEmmanuel Vadot
478cc087a1SEmmanuel Vadot  linux,cma-default:
488cc087a1SEmmanuel Vadot    type: boolean
498cc087a1SEmmanuel Vadot    description: >
508cc087a1SEmmanuel Vadot      If this property is present, then Linux will use the region for
518cc087a1SEmmanuel Vadot      the default pool of the contiguous memory allocator.
528cc087a1SEmmanuel Vadot
538cc087a1SEmmanuel Vadot  linux,dma-default:
548cc087a1SEmmanuel Vadot    type: boolean
558cc087a1SEmmanuel Vadot    description: >
568cc087a1SEmmanuel Vadot      If this property is present, then Linux will use the region for
578cc087a1SEmmanuel Vadot      the default pool of the consistent DMA allocator.
588cc087a1SEmmanuel Vadot
59c9ccf3a3SEmmanuel Vadotif:
60c9ccf3a3SEmmanuel Vadot  properties:
61c9ccf3a3SEmmanuel Vadot    compatible:
62c9ccf3a3SEmmanuel Vadot      contains:
63c9ccf3a3SEmmanuel Vadot        const: restricted-dma-pool
64c9ccf3a3SEmmanuel Vadotthen:
65c9ccf3a3SEmmanuel Vadot  properties:
66c9ccf3a3SEmmanuel Vadot    no-map: false
67c9ccf3a3SEmmanuel Vadot    reusable: false
68c9ccf3a3SEmmanuel Vadot
698cc087a1SEmmanuel VadotunevaluatedProperties: false
708cc087a1SEmmanuel Vadot
718cc087a1SEmmanuel Vadotexamples:
728cc087a1SEmmanuel Vadot  - |
738cc087a1SEmmanuel Vadot      reserved-memory {
748cc087a1SEmmanuel Vadot          #address-cells = <1>;
758cc087a1SEmmanuel Vadot          #size-cells = <1>;
768cc087a1SEmmanuel Vadot          ranges;
778cc087a1SEmmanuel Vadot
788cc087a1SEmmanuel Vadot          /* global autoconfigured region for contiguous allocations */
798cc087a1SEmmanuel Vadot          linux,cma {
808cc087a1SEmmanuel Vadot              compatible = "shared-dma-pool";
818cc087a1SEmmanuel Vadot              reusable;
828cc087a1SEmmanuel Vadot              size = <0x4000000>;
838cc087a1SEmmanuel Vadot              alignment = <0x2000>;
848cc087a1SEmmanuel Vadot              linux,cma-default;
858cc087a1SEmmanuel Vadot          };
868cc087a1SEmmanuel Vadot
878cc087a1SEmmanuel Vadot          display_reserved: framebuffer@78000000 {
888cc087a1SEmmanuel Vadot              reg = <0x78000000 0x800000>;
898cc087a1SEmmanuel Vadot          };
908cc087a1SEmmanuel Vadot
918cc087a1SEmmanuel Vadot          restricted_dma_reserved: restricted-dma-pool@50000000 {
928cc087a1SEmmanuel Vadot              compatible = "restricted-dma-pool";
938cc087a1SEmmanuel Vadot              reg = <0x50000000 0x4000000>;
948cc087a1SEmmanuel Vadot          };
958cc087a1SEmmanuel Vadot      };
968cc087a1SEmmanuel Vadot
978cc087a1SEmmanuel Vadot...
98