%YAML 1.2
---
$id: "http://devicetree.org/schemas/arm/msm/qcom_dma_heap.yaml#"
$schema: "http://devicetree.org/meta-schemas/core.yaml#"

title: DMA-BUF Heaps Memory Manager binding

maintainers:
  - Chris Goldsworthy <cgoldswo@quicinc.com>

description: |
  DMA-BUF heaps is a memory manager that allows for sharing of buffers between
  different processes and between user space and kernel space. DMA-BUF heaps
  manages different memory spaces by separating the memory spaces into heaps.

  All child nodes of a qcom,dma-heaps node are interpreted as DMA-BUF heap
  configurations for CMA and secure carveout heaps.

properties:
  $nodename:
    const: qcom,dma-heaps
    description: Container of DMA-BUF heap nodes

  compatible:
    items:
      -const: qcom,dma-heaps

patternProperties:
  '^qcom,[a-zA-Z]+$':
    properties:
      qcom,dma-heap-name:
        $ref: '/schemas/types.yaml#/definitions/string'
        maxItems: 1
        description: The name given to this heap.

      qcom,dma-heap-type:
        $ref: '/schemas/types.yaml#/definitions/string'
        maxItems: 1
        items:
          - enum:
              - HEAP_TYPE_SECURE_CARVEOUT
              - HEAP_TYPE_CARVEOUT
              - HEAP_TYPE_CMA
        description: |
          The heap type to use for this heap.

      qcom,uncached-heap:
      Usage: optional
      Value type: <boolean>
      Definition: Denotes whether this heap provides uncached memory or not.

      qcom,dynamic-heap:
      Usage: optional
      Value type: <boolean>
      Definition: Denotes whether a heap can have memory dynamically added and
           subtracted from it. Heaps with this property are assumed to start off
           with no memory, and must have memory added to them prior to any use.

      qcom,token:
        $ref: '/schemas/types.yaml#/definitions/uint32'
        minItems: 1
        description: |
          Specifies the set of secure domains which will be able to access
          the memory-region.

      qcom,max-align:
        $ref: '/schemas/types.yaml#/definitions/uint32'
        minItems: 1
        description: |
          Maximum alignment of an allocation, in units of page order.

      memory-region:
        $ref: '/schemas/types.yaml#/definitions/phandle'
        maxItems: 1
        description: |
          Specifies the reserved memory region that this heap will allocate
          memory from. This property is only required for heaps that draw memory
          from a particular reserved memory region. Refer to
          Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt
          for more information.

    required:
      - qcom,dma-heap-name
      - qcom,dma-heap-type

required:
  - compatible

examples:
  - |
    qcom,dma-heaps {
        compatible = "qcom,dma-heaps";
        #address-cells = <1>;
	#size-cells = <0>;

        qcom,adsp {
            qcom,dma-heap-name = "qcom,adsp";
            qcom,dma-heap-type = <HEAP_TYPE_CMA>;
            memory-region = <&sdsp_mem>;
        };

        qcom,spss {
            qcom,dma-heap-name = "qcom,secure-spss";
            qcom,dma-heap-type = <HEAP_TYPE_CMA>;
            memory-region = <&sp_mem>;
        };
    };
