diff mbox series

[v3,2/2] dt-bindings: dma: hisi: Add bindings for Hisi Ascend sdma

Message ID 20230824040007.1476-3-guomengqi3@huawei.com
State Changes Requested, archived
Headers show
Series Add dma controller for hisilicon ascend310/910 | expand

Checks

Context Check Description
robh/checkpatch success
robh/patch-applied success
robh/dtbs-check warning build log
robh/dt-meta-schema success

Commit Message

Guo Mengqi Aug. 24, 2023, 4 a.m. UTC
Add device-tree binding documentation for the Hisi Ascend sdma
controller.

Signed-off-by: Guo Mengqi <guomengqi3@huawei.com>
---
 .../bindings/dma/hisi,ascend-sdma.yaml        | 75 +++++++++++++++++++
 1 file changed, 75 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/hisi,ascend-sdma.yaml

Comments

Krzysztof Kozlowski Aug. 24, 2023, 7:15 a.m. UTC | #1
On 24/08/2023 06:00, Guo Mengqi wrote:
> Add device-tree binding documentation for the Hisi Ascend sdma
> controller.
> 
> Signed-off-by: Guo Mengqi <guomengqi3@huawei.com>
> ---
>  .../bindings/dma/hisi,ascend-sdma.yaml        | 75 +++++++++++++++++++
>  1 file changed, 75 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/dma/hisi,ascend-sdma.yaml

Filename matching compatible, so hisilicon,ascend-sdma.yaml. hisi, is a
deprecated prefix, so don't use it.


> 
> diff --git a/Documentation/devicetree/bindings/dma/hisi,ascend-sdma.yaml b/Documentation/devicetree/bindings/dma/hisi,ascend-sdma.yaml
> new file mode 100644
> index 000000000000..87b6132c1b4b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/dma/hisi,ascend-sdma.yaml
> @@ -0,0 +1,75 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/dma/hisi,ascend-sdma.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: HISI Ascend System DMA (SDMA) controller

What is HISI? HiSilicon?

> +
> +description: |
> +  The Ascend SDMA controller is used for transferring data
> +  in system memory. It utilizes IOMMU SVA feature and accepts
> +  virtual address from user process.
> +
> +maintainers:
> +  - Guo Mengqi <guomengqi3@huawei.com>
> +
> +allOf:
> +  - $ref: dma-controller.yaml#
> +
> +properties:
> +  compatible:
> +    enum:
> +      - hisilicon,ascend310-sdma
> +      - hisilicon,ascend910-sdma
> +
> +  reg:
> +    maxItems: 1
> +
> +  '#dma-cells':
> +    const: 1
> +    description:
> +      Clients specify a single cell with channel number.
> +
> +  hisilicon,ascend-sdma-channel-map:
> +    description: |
> +      bitmap, each bit stands for a channel that is allowed to
> +      use by this system. Maximum 64 bits.
> +    $ref: /schemas/types.yaml#/definitions/uint64

Why some channels would not be allowed to be used on some board with
ascend310? Who decides on this?

> +
> +  iommus:
> +    maxItems: 1
> +
> +  pasid-num-bits:
> +    description: |
> +      sdma utilizes iommu sva feature to transfer user space data.
> +      It acts as a basic dma controller if not bound to user space.
> +    const: 0x10


Best regards,
Krzysztof
Rob Herring (Arm) Aug. 24, 2023, 7:43 p.m. UTC | #2
On Thu, Aug 24, 2023 at 12:00:07PM +0800, Guo Mengqi wrote:
> Add device-tree binding documentation for the Hisi Ascend sdma
> controller.
> 
> Signed-off-by: Guo Mengqi <guomengqi3@huawei.com>
> ---
>  .../bindings/dma/hisi,ascend-sdma.yaml        | 75 +++++++++++++++++++
>  1 file changed, 75 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/dma/hisi,ascend-sdma.yaml
> 
> diff --git a/Documentation/devicetree/bindings/dma/hisi,ascend-sdma.yaml b/Documentation/devicetree/bindings/dma/hisi,ascend-sdma.yaml
> new file mode 100644
> index 000000000000..87b6132c1b4b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/dma/hisi,ascend-sdma.yaml
> @@ -0,0 +1,75 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/dma/hisi,ascend-sdma.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: HISI Ascend System DMA (SDMA) controller
> +
> +description: |
> +  The Ascend SDMA controller is used for transferring data
> +  in system memory. It utilizes IOMMU SVA feature and accepts
> +  virtual address from user process.
> +
> +maintainers:
> +  - Guo Mengqi <guomengqi3@huawei.com>
> +
> +allOf:
> +  - $ref: dma-controller.yaml#
> +
> +properties:
> +  compatible:
> +    enum:
> +      - hisilicon,ascend310-sdma
> +      - hisilicon,ascend910-sdma
> +
> +  reg:
> +    maxItems: 1
> +
> +  '#dma-cells':
> +    const: 1
> +    description:
> +      Clients specify a single cell with channel number.
> +
> +  hisilicon,ascend-sdma-channel-map:
> +    description: |
> +      bitmap, each bit stands for a channel that is allowed to
> +      use by this system. Maximum 64 bits.
> +    $ref: /schemas/types.yaml#/definitions/uint64

Sounds like the common property dma-channel-mask. Use that.

> +
> +  iommus:
> +    maxItems: 1
> +
> +  pasid-num-bits:

Needs a vendor prefix.

> +    description: |
> +      sdma utilizes iommu sva feature to transfer user space data.

Isn't shared VA mostly a s/w concept?

> +      It acts as a basic dma controller if not bound to user space.

I don't understand what this means.

> +    const: 0x10

If only 1 value is allowed, what is the point of this property.

Rob
Guo Mengqi Aug. 30, 2023, 6:31 a.m. UTC | #3
在 2023/8/24 15:15, Krzysztof Kozlowski 写道:
> On 24/08/2023 06:00, Guo Mengqi wrote:
>> Add device-tree binding documentation for the Hisi Ascend sdma
>> controller.
>>
>> Signed-off-by: Guo Mengqi <guomengqi3@huawei.com>
>> ---
>>   .../bindings/dma/hisi,ascend-sdma.yaml        | 75 +++++++++++++++++++
>>   1 file changed, 75 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/dma/hisi,ascend-sdma.yaml
> Filename matching compatible, so hisilicon,ascend-sdma.yaml. hisi, is a
> deprecated prefix, so don't use it.
OK, will change it in next patch.
>
>> diff --git a/Documentation/devicetree/bindings/dma/hisi,ascend-sdma.yaml b/Documentation/devicetree/bindings/dma/hisi,ascend-sdma.yaml
>> new file mode 100644
>> index 000000000000..87b6132c1b4b
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/dma/hisi,ascend-sdma.yaml
>> @@ -0,0 +1,75 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/dma/hisi,ascend-sdma.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: HISI Ascend System DMA (SDMA) controller
> What is HISI? HiSilicon?
Yes, It is short for HiSilicon.
>> +
>> +description: |
>> +  The Ascend SDMA controller is used for transferring data
>> +  in system memory. It utilizes IOMMU SVA feature and accepts
>> +  virtual address from user process.
>> +
>> +maintainers:
>> +  - Guo Mengqi <guomengqi3@huawei.com>
>> +
>> +allOf:
>> +  - $ref: dma-controller.yaml#
>> +
>> +properties:
>> +  compatible:
>> +    enum:
>> +      - hisilicon,ascend310-sdma
>> +      - hisilicon,ascend910-sdma
>> +
>> +  reg:
>> +    maxItems: 1
>> +
>> +  '#dma-cells':
>> +    const: 1
>> +    description:
>> +      Clients specify a single cell with channel number.
>> +
>> +  hisilicon,ascend-sdma-channel-map:
>> +    description: |
>> +      bitmap, each bit stands for a channel that is allowed to
>> +      use by this system. Maximum 64 bits.
>> +    $ref: /schemas/types.yaml#/definitions/uint64
> Why some channels would not be allowed to be used on some board with
> ascend310? Who decides on this?
This is because the SoC runs more than one operating system. So from the 
perspective of any user OS, dma hardware is a shared resource.
>> +
>> +  iommus:
>> +    maxItems: 1
>> +
>> +  pasid-num-bits:
>> +    description: |
>> +      sdma utilizes iommu sva feature to transfer user space data.
>> +      It acts as a basic dma controller if not bound to user space.
>> +    const: 0x10
>
> Best regards,
> Krzysztof
>
> .

Best regards,

Guo Mengqi
Guo Mengqi Aug. 30, 2023, 9:33 a.m. UTC | #4
在 2023/8/25 3:43, Rob Herring 写道:
> On Thu, Aug 24, 2023 at 12:00:07PM +0800, Guo Mengqi wrote:
>> Add device-tree binding documentation for the Hisi Ascend sdma
>> controller.
>>
>> Signed-off-by: Guo Mengqi <guomengqi3@huawei.com>
>> ---
>>   .../bindings/dma/hisi,ascend-sdma.yaml        | 75 +++++++++++++++++++
>>   1 file changed, 75 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/dma/hisi,ascend-sdma.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/dma/hisi,ascend-sdma.yaml b/Documentation/devicetree/bindings/dma/hisi,ascend-sdma.yaml
>> new file mode 100644
>> index 000000000000..87b6132c1b4b
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/dma/hisi,ascend-sdma.yaml
>> @@ -0,0 +1,75 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/dma/hisi,ascend-sdma.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: HISI Ascend System DMA (SDMA) controller
>> +
>> +description: |
>> +  The Ascend SDMA controller is used for transferring data
>> +  in system memory. It utilizes IOMMU SVA feature and accepts
>> +  virtual address from user process.
>> +
>> +maintainers:
>> +  - Guo Mengqi <guomengqi3@huawei.com>
>> +
>> +allOf:
>> +  - $ref: dma-controller.yaml#
>> +
>> +properties:
>> +  compatible:
>> +    enum:
>> +      - hisilicon,ascend310-sdma
>> +      - hisilicon,ascend910-sdma
>> +
>> +  reg:
>> +    maxItems: 1
>> +
>> +  '#dma-cells':
>> +    const: 1
>> +    description:
>> +      Clients specify a single cell with channel number.
>> +
>> +  hisilicon,ascend-sdma-channel-map:
>> +    description: |
>> +      bitmap, each bit stands for a channel that is allowed to
>> +      use by this system. Maximum 64 bits.
>> +    $ref: /schemas/types.yaml#/definitions/uint64
> Sounds like the common property dma-channel-mask. Use that.
It does seem to be the one I'm looking for. Will use it in next patch.
>> +
>> +  iommus:
>> +    maxItems: 1
>> +
>> +  pasid-num-bits:
> Needs a vendor prefix.
This can be found in iommu optional properties. Although nobody use it 
for now.
>> +    description: |
>> +      sdma utilizes iommu sva feature to transfer user space data.
> Isn't shared VA mostly a s/w concept?

Well, sdma controller has built-in mechanism to support shared VA 
translation.

I add this to explain purpose of property.

>> +      It acts as a basic dma controller if not bound to user space.
> I don't understand what this means.

By "basic" I mean iommu bypass mode, which is supported in hardware design.

So if the transfer is all in physical address, it seems quite... basic?


However, shared VA is main usage scenario. Driver only implements shared 
VA. So I guess I can remove this line.

>> +    const: 0x10
> If only 1 value is allowed, what is the point of this property.

It seems that the property should be declared here, to tell iommu it 
supports PASID (see 2e981b9468e670b76bd1048fa939ad1f9653bd79 mainline).

I think it could be adjust to other values. I will check out if there is 
a specific range.

> Rob
> .

Best regards,

Guo Mengqi
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/dma/hisi,ascend-sdma.yaml b/Documentation/devicetree/bindings/dma/hisi,ascend-sdma.yaml
new file mode 100644
index 000000000000..87b6132c1b4b
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/hisi,ascend-sdma.yaml
@@ -0,0 +1,75 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/dma/hisi,ascend-sdma.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: HISI Ascend System DMA (SDMA) controller
+
+description: |
+  The Ascend SDMA controller is used for transferring data
+  in system memory. It utilizes IOMMU SVA feature and accepts
+  virtual address from user process.
+
+maintainers:
+  - Guo Mengqi <guomengqi3@huawei.com>
+
+allOf:
+  - $ref: dma-controller.yaml#
+
+properties:
+  compatible:
+    enum:
+      - hisilicon,ascend310-sdma
+      - hisilicon,ascend910-sdma
+
+  reg:
+    maxItems: 1
+
+  '#dma-cells':
+    const: 1
+    description:
+      Clients specify a single cell with channel number.
+
+  hisilicon,ascend-sdma-channel-map:
+    description: |
+      bitmap, each bit stands for a channel that is allowed to
+      use by this system. Maximum 64 bits.
+    $ref: /schemas/types.yaml#/definitions/uint64
+
+  iommus:
+    maxItems: 1
+
+  pasid-num-bits:
+    description: |
+      sdma utilizes iommu sva feature to transfer user space data.
+      It acts as a basic dma controller if not bound to user space.
+    const: 0x10
+
+  dma-coherent: true
+
+  dma-can-stall: true
+
+required:
+  - compatible
+  - reg
+  - hisilicon,ascend-sdma-channel-map
+  - '#dma-cells'
+  - iommus
+
+additionalProperties: false
+
+examples:
+  - |
+    dma-controller@880e0000 {
+        compatible = "hisilicon,ascend310-sdma";
+        reg = <0x880e0000 0x10000>;
+        hisilicon,ascend-sdma-channel-map = <0x00000000 0x0000ff00>;
+        iommus = <&smmu 0x7f46>;
+        pasid-num-bits = <0x10>;
+        dma-coherent;
+        dma-can-stall;
+        #dma-cells = <1>;
+    };
+
+...