[PATCH v2] dt-bindings: dma: qcom,bam-dma: Allow memory-region property

Vishnu Santhosh posted 1 patch 4 days, 18 hours ago
.../devicetree/bindings/dma/qcom,bam-dma.yaml       | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
[PATCH v2] dt-bindings: dma: qcom,bam-dma: Allow memory-region property
Posted by Vishnu Santhosh 4 days, 18 hours ago
Some Qualcomm SoCs, such as Shikra, run the modem in a separate security
domain, preventing it from accessing BAM descriptor FIFOs allocated from
arbitrary host memory.

Add an optional memory-region property to constrain DMA allocations made
by the BAM DMA controller to a restricted DMA pool. Access permissions
for the remote execution environment are managed separately.

Co-developed-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com>
Signed-off-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com>
Signed-off-by: Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com>
---
Changes in v2:
- Replace the qcom,vmid property and BAM DMA driver SCM assignment with
  the standard memory-region restricted DMA pool mechanism.
- Rely on generic DMA handling to constrain descriptor FIFO allocations
  to the restricted pool.
- Drop the Shikra-specific BAM compatible and all BAM DMA driver changes.
- Link to v1: https://lore.kernel.org/r/20260714-qcom-bam-dma-vmid-ext-v1-0-cef87c57b7dc@oss.qualcomm.com
---
 .../devicetree/bindings/dma/qcom,bam-dma.yaml       | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/Documentation/devicetree/bindings/dma/qcom,bam-dma.yaml b/Documentation/devicetree/bindings/dma/qcom,bam-dma.yaml
index e72adc172af102d8f400044ea0dc32db6b2365be..1e4324799f2b3b8a9ebf9f084e457e66aad20d28 100644
--- a/Documentation/devicetree/bindings/dma/qcom,bam-dma.yaml
+++ b/Documentation/devicetree/bindings/dma/qcom,bam-dma.yaml
@@ -50,6 +50,13 @@ properties:
     minItems: 1
     maxItems: 7
 
+  memory-region:
+    maxItems: 1
+    description:
+      Phandle to a reserved-memory node compatible with restricted-dma-pool.
+      The BAM DMA controller uses the pool for DMA allocations, including
+      channel descriptor FIFOs.
+
   num-channels:
     $ref: /schemas/types.yaml#/definitions/uint32
     description:
@@ -137,6 +144,20 @@ examples:
             qcom,num-ees = <4>;
             num-channels = <20>;
             qcom,controlled-remotely;
+            memory-region = <&bam_dmux_pool>;
+        };
+    };
+
+    reserved-memory {
+        #address-cells = <1>;
+        #size-cells = <1>;
+        ranges;
+
+        bam_dmux_pool: restricted-dma-pool {
+            compatible = "restricted-dma-pool";
+            size = <0x40000>;
+            alignment = <0x40000>;
+            alloc-ranges = <0x80000000 0x80000000>;
         };
     };
 ...

---
base-commit: 40288c9206c17eb66a603262e06a58d300d0f279
change-id: 20260714-qcom-bam-dma-vmid-ext-8a3bd3c5c00e

Best regards,
-- 
Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com>
Re: [PATCH v2] dt-bindings: dma: qcom,bam-dma: Allow memory-region property
Posted by Krzysztof Kozlowski 4 days, 10 hours ago
On Sun, Sep 20, 2026 at 08:03:05AM +0530, Vishnu Santhosh wrote:
> Some Qualcomm SoCs, such as Shikra, run the modem in a separate security
> domain, preventing it from accessing BAM descriptor FIFOs allocated from
> arbitrary host memory.
> 
> Add an optional memory-region property to constrain DMA allocations made
> by the BAM DMA controller to a restricted DMA pool. Access permissions
> for the remote execution environment are managed separately.
> 
> Co-developed-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com>
> Signed-off-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com>
> Signed-off-by: Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com>
> ---
> Changes in v2:
> - Replace the qcom,vmid property and BAM DMA driver SCM assignment with
>   the standard memory-region restricted DMA pool mechanism.
> - Rely on generic DMA handling to constrain descriptor FIFO allocations
>   to the restricted pool.
> - Drop the Shikra-specific BAM compatible and all BAM DMA driver changes.
> - Link to v1: https://lore.kernel.org/r/20260714-qcom-bam-dma-vmid-ext-v1-0-cef87c57b7dc@oss.qualcomm.com

And a reason to drop review?

> ---
>  .../devicetree/bindings/dma/qcom,bam-dma.yaml       | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/dma/qcom,bam-dma.yaml b/Documentation/devicetree/bindings/dma/qcom,bam-dma.yaml
> index e72adc172af102d8f400044ea0dc32db6b2365be..1e4324799f2b3b8a9ebf9f084e457e66aad20d28 100644
> --- a/Documentation/devicetree/bindings/dma/qcom,bam-dma.yaml
> +++ b/Documentation/devicetree/bindings/dma/qcom,bam-dma.yaml
> @@ -50,6 +50,13 @@ properties:
>      minItems: 1
>      maxItems: 7
>  
> +  memory-region:
> +    maxItems: 1
> +    description:
> +      Phandle to a reserved-memory node compatible with restricted-dma-pool.
> +      The BAM DMA controller uses the pool for DMA allocations, including
> +      channel descriptor FIFOs.
> +
>    num-channels:
>      $ref: /schemas/types.yaml#/definitions/uint32
>      description:
> @@ -137,6 +144,20 @@ examples:
>              qcom,num-ees = <4>;
>              num-channels = <20>;
>              qcom,controlled-remotely;
> +            memory-region = <&bam_dmux_pool>;
> +        };
> +    };
> +
> +    reserved-memory {

No need for this.

Best regards,
Krzysztof
Re: [PATCH v2] dt-bindings: dma: qcom,bam-dma: Allow memory-region property
Posted by Vishnu Santhosh 3 days, 10 hours ago
On 20-09-2026 04:02 pm, Krzysztof Kozlowski wrote:
> On Sun, Sep 20, 2026 at 08:03:05AM +0530, Vishnu Santhosh wrote:
>> Some Qualcomm SoCs, such as Shikra, run the modem in a separate security
>> domain, preventing it from accessing BAM descriptor FIFOs allocated from
>> arbitrary host memory.
>>
>> Add an optional memory-region property to constrain DMA allocations made
>> by the BAM DMA controller to a restricted DMA pool. Access permissions
>> for the remote execution environment are managed separately.
>>
>> Co-developed-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com>
>> Signed-off-by: Deepak Kumar Singh <deepak.singh@oss.qualcomm.com>
>> Signed-off-by: Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com>
>> ---
>> Changes in v2:
>> - Replace the qcom,vmid property and BAM DMA driver SCM assignment with
>>    the standard memory-region restricted DMA pool mechanism.
>> - Rely on generic DMA handling to constrain descriptor FIFO allocations
>>    to the restricted pool.
>> - Drop the Shikra-specific BAM compatible and all BAM DMA driver changes.
>> - Link to v1: https://lore.kernel.org/r/20260714-qcom-bam-dma-vmid-ext-v1-0-cef87c57b7dc@oss.qualcomm.com
> And a reason to drop review?

The binding was substantially redesigned in v2, so I did not carry Rob's Reviewed-by.
I will explicitly mention that in the v2 changelog in next revision.

>
>> ---
>>   .../devicetree/bindings/dma/qcom,bam-dma.yaml       | 21 +++++++++++++++++++++
>>   1 file changed, 21 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/dma/qcom,bam-dma.yaml b/Documentation/devicetree/bindings/dma/qcom,bam-dma.yaml
>> index e72adc172af102d8f400044ea0dc32db6b2365be..1e4324799f2b3b8a9ebf9f084e457e66aad20d28 100644
>> --- a/Documentation/devicetree/bindings/dma/qcom,bam-dma.yaml
>> +++ b/Documentation/devicetree/bindings/dma/qcom,bam-dma.yaml
>> @@ -50,6 +50,13 @@ properties:
>>       minItems: 1
>>       maxItems: 7
>>   
>> +  memory-region:
>> +    maxItems: 1
>> +    description:
>> +      Phandle to a reserved-memory node compatible with restricted-dma-pool.
>> +      The BAM DMA controller uses the pool for DMA allocations, including
>> +      channel descriptor FIFOs.
>> +
>>     num-channels:
>>       $ref: /schemas/types.yaml#/definitions/uint32
>>       description:
>> @@ -137,6 +144,20 @@ examples:
>>               qcom,num-ees = <4>;
>>               num-channels = <20>;
>>               qcom,controlled-remotely;
>> +            memory-region = <&bam_dmux_pool>;
>> +        };
>> +    };
>> +
>> +    reserved-memory {
> No need for this.
>
> Best regards,
> Krzysztof

Agreed. I will drop the changes to the example in v3.

Thanks,
Vishnu