* [PATCH v3] dt-bindings: dma: qcom,bam-dma: Allow memory-region property @ 2026-10-21 5:52 Vishnu Santhosh 2026-10-22 14:01 ` Rob Herring 0 siblings, 1 reply; 6+ messages in thread From: Vishnu Santhosh @ 2026-10-21 5:52 UTC (permalink / raw) To: Vinod Koul, Frank Li, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Andy Gross, Bjorn Andersson Cc: linux-arm-msm, dmaengine, devicetree, linux-kernel, Deepak Kumar Singh, Vishnu Santhosh 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 v3: - Drop the example changes (Krzysztof) - Link to v2: https://lore.kernel.org/r/20260920-qcom-bam-dma-vmid-ext-v2-1-4dbbff0e57c8@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. - Drop Rob's Reviewed-by, as the binding was substantially redesigned. - Link to v1: https://lore.kernel.org/r/20260714-qcom-bam-dma-vmid-ext-v1-0-cef87c57b7dc@oss.qualcomm.com --- Documentation/devicetree/bindings/dma/qcom,bam-dma.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/dma/qcom,bam-dma.yaml b/Documentation/devicetree/bindings/dma/qcom,bam-dma.yaml index e72adc172af102d8f400044ea0dc32db6b2365be..b7b348bf6ae2feba32ecaf17ca8696817a1ada4a 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: --- base-commit: 2c455ddca7827ad8fa3a64fdbf5a60efb928b46a change-id: 20260714-qcom-bam-dma-vmid-ext-8a3bd3c5c00e Best regards, -- Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com> ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3] dt-bindings: dma: qcom,bam-dma: Allow memory-region property 2026-10-21 5:52 [PATCH v3] dt-bindings: dma: qcom,bam-dma: Allow memory-region property Vishnu Santhosh @ 2026-10-22 14:01 ` Rob Herring 2026-10-23 6:35 ` Vishnu Santhosh 0 siblings, 1 reply; 6+ messages in thread From: Rob Herring @ 2026-10-22 14:01 UTC (permalink / raw) To: Vishnu Santhosh Cc: Vinod Koul, Frank Li, Krzysztof Kozlowski, Conor Dooley, Andy Gross, Bjorn Andersson, linux-arm-msm, dmaengine, devicetree, linux-kernel, Deepak Kumar Singh On Wed, Oct 21, 2026 at 11:22:35AM +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. dma-ranges is normally how address restrictions for a device are defined. Why can't that be used here? Rob ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3] dt-bindings: dma: qcom,bam-dma: Allow memory-region property 2026-10-22 14:01 ` Rob Herring @ 2026-10-23 6:35 ` Vishnu Santhosh 2026-10-26 13:05 ` Rob Herring 0 siblings, 1 reply; 6+ messages in thread From: Vishnu Santhosh @ 2026-10-23 6:35 UTC (permalink / raw) To: Rob Herring Cc: Vinod Koul, Frank Li, Krzysztof Kozlowski, Conor Dooley, Andy Gross, Bjorn Andersson, linux-arm-msm, dmaengine, devicetree, linux-kernel, Deepak Kumar Singh On 22-10-2026 07:31 pm, Rob Herring wrote: > On Wed, Oct 21, 2026 at 11:22:35AM +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. > dma-ranges is normally how address restrictions for a device are > defined. Why can't that be used here? > > Rob The constraint here is access permission, not addressing. The modem can only access a carve-out that is assigned to it through SCM. The soc bus on Shikra already has an identity dma-ranges covering 64GB [1], so there is no addressing limitation to describe. dma-ranges does not reserve memory, so allocations would still come from the general page allocator, outside the assigned carve-out, and modem accesses to them trigger an XPU violation. It also applies to every device on the bus. The A2 BAM on Shikra is not behind an IOMMU. restricted-dma-pool provides a dedicated, per-device region, which is the setup it was introduced for no IOMMU, with firmware restricting device accesses to specific regions [2]. Stephan suggested this approach on v1 of the BAM-DMUX series [3]. The BAM DMA controller and BAM-DMUX reference the same pool, so a single assignment covers both the descriptor FIFOs and the data buffers. [1] https://elixir.bootlin.com/linux/v7.3-rc7/source/arch/arm64/boot/dts/qcom/shikra.dtsi#L508 [2] https://lwn.net/Articles/841916/ [3] https://lore.kernel.org/all/an27PVxkCpD09xSR@linaro.org/ Vishnu ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3] dt-bindings: dma: qcom,bam-dma: Allow memory-region property 2026-10-23 6:35 ` Vishnu Santhosh @ 2026-10-26 13:05 ` Rob Herring 2026-10-27 6:22 ` Vishnu Santhosh 0 siblings, 1 reply; 6+ messages in thread From: Rob Herring @ 2026-10-26 13:05 UTC (permalink / raw) To: Vishnu Santhosh Cc: Vinod Koul, Frank Li, Krzysztof Kozlowski, Conor Dooley, Andy Gross, Bjorn Andersson, linux-arm-msm, dmaengine, devicetree, linux-kernel, Deepak Kumar Singh On Fri, Oct 23, 2026 at 12:05:50PM +0530, Vishnu Santhosh wrote: > > On 22-10-2026 07:31 pm, Rob Herring wrote: > > On Wed, Oct 21, 2026 at 11:22:35AM +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. > > dma-ranges is normally how address restrictions for a device are > > defined. Why can't that be used here? > > > > Rob > > The constraint here is access permission, not addressing. The modem can > only access a carve-out that is assigned to it through SCM. The reason for the constraint doesn't really matter. > The soc bus on Shikra already has an identity dma-ranges covering > 64GB [1], so there is no addressing limitation to describe. dma-ranges > does not reserve memory, so allocations would still come from the > general page allocator, outside the assigned carve-out, and modem > accesses to them trigger an XPU violation. It also applies to every > device on the bus. It's a bit awkward that dma-ranges needs to be in a parent node. So you would need to put the device in its own bus node. But if dma-ranges is in place, DMA allocations will only come from within that range. > The A2 BAM on Shikra is not behind an IOMMU. restricted-dma-pool > provides a dedicated, per-device region, which is the setup it was > introduced for no IOMMU, with firmware restricting device accesses to > specific regions [2]. Stephan suggested this approach on v1 of the > BAM-DMUX series [3]. The BAM DMA controller and BAM-DMUX reference the > same pool, so a single assignment covers both the descriptor FIFOs and > the data buffers. I suppose that since the memory region is dynamic, 'memory-region' makes sense here. If firmware determined the address of the region, I'd probably feel differently. Rob ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3] dt-bindings: dma: qcom,bam-dma: Allow memory-region property 2026-10-26 13:05 ` Rob Herring @ 2026-10-27 6:22 ` Vishnu Santhosh 2026-11-19 5:48 ` Vishnu Santhosh 0 siblings, 1 reply; 6+ messages in thread From: Vishnu Santhosh @ 2026-10-27 6:22 UTC (permalink / raw) To: Rob Herring Cc: Vinod Koul, Frank Li, Krzysztof Kozlowski, Conor Dooley, Andy Gross, Bjorn Andersson, linux-arm-msm, dmaengine, devicetree, linux-kernel, Deepak Kumar Singh On 26-10-2026 06:35 pm, Rob Herring wrote: > On Fri, Oct 23, 2026 at 12:05:50PM +0530, Vishnu Santhosh wrote: >> On 22-10-2026 07:31 pm, Rob Herring wrote: >>> On Wed, Oct 21, 2026 at 11:22:35AM +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. >>> dma-ranges is normally how address restrictions for a device are >>> defined. Why can't that be used here? >>> >>> Rob >> The constraint here is access permission, not addressing. The modem can >> only access a carve-out that is assigned to it through SCM. > The reason for the constraint doesn't really matter. Ok, understood. > >> The soc bus on Shikra already has an identity dma-ranges covering >> 64GB [1], so there is no addressing limitation to describe. dma-ranges >> does not reserve memory, so allocations would still come from the >> general page allocator, outside the assigned carve-out, and modem >> accesses to them trigger an XPU violation. It also applies to every >> device on the bus. > It's a bit awkward that dma-ranges needs to be in a parent node. So you > would need to put the device in its own bus node. But if dma-ranges is > in place, DMA allocations will only come from within that range. Thanks for the correction. > > >> The A2 BAM on Shikra is not behind an IOMMU. restricted-dma-pool >> provides a dedicated, per-device region, which is the setup it was >> introduced for no IOMMU, with firmware restricting device accesses to >> specific regions [2]. Stephan suggested this approach on v1 of the >> BAM-DMUX series [3]. The BAM DMA controller and BAM-DMUX reference the >> same pool, so a single assignment covers both the descriptor FIFOs and >> the data buffers. > I suppose that since the memory region is dynamic, 'memory-region' makes > sense here. If firmware determined the address of the region, I'd > probably feel differently. Yes, the region is dynamic. Thanks for the review. Vishnu ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3] dt-bindings: dma: qcom,bam-dma: Allow memory-region property 2026-10-27 6:22 ` Vishnu Santhosh @ 2026-11-19 5:48 ` Vishnu Santhosh 0 siblings, 0 replies; 6+ messages in thread From: Vishnu Santhosh @ 2026-11-19 5:48 UTC (permalink / raw) To: Rob Herring Cc: Vinod Koul, Frank Li, Krzysztof Kozlowski, Conor Dooley, Andy Gross, Bjorn Andersson, linux-arm-msm, dmaengine, devicetree, linux-kernel, Deepak Kumar Singh Hi Rob, On 27-10-2026 11:52 am, Vishnu Santhosh wrote: > > On 26-10-2026 06:35 pm, Rob Herring wrote: >> On Fri, Oct 23, 2026 at 12:05:50PM +0530, Vishnu Santhosh wrote: >>> On 22-10-2026 07:31 pm, Rob Herring wrote: >>>> On Wed, Oct 21, 2026 at 11:22:35AM +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. >>>> dma-ranges is normally how address restrictions for a device are >>>> defined. Why can't that be used here? >>>> >>>> Rob >>> The constraint here is access permission, not addressing. The modem can >>> only access a carve-out that is assigned to it through SCM. >> The reason for the constraint doesn't really matter. > > Ok, understood. > >> >>> The soc bus on Shikra already has an identity dma-ranges covering >>> 64GB [1], so there is no addressing limitation to describe. dma-ranges >>> does not reserve memory, so allocations would still come from the >>> general page allocator, outside the assigned carve-out, and modem >>> accesses to them trigger an XPU violation. It also applies to every >>> device on the bus. >> It's a bit awkward that dma-ranges needs to be in a parent node. So you >> would need to put the device in its own bus node. But if dma-ranges is >> in place, DMA allocations will only come from within that range. > > Thanks for the correction. > >> >> >>> The A2 BAM on Shikra is not behind an IOMMU. restricted-dma-pool >>> provides a dedicated, per-device region, which is the setup it was >>> introduced for no IOMMU, with firmware restricting device accesses to >>> specific regions [2]. Stephan suggested this approach on v1 of the >>> BAM-DMUX series [3]. The BAM DMA controller and BAM-DMUX reference the >>> same pool, so a single assignment covers both the descriptor FIFOs and >>> the data buffers. >> I suppose that since the memory region is dynamic, 'memory-region' makes >> sense here. If firmware determined the address of the region, I'd >> probably feel differently. > > Yes, the region is dynamic. Thanks for the review. > > Gentle ping. Are you fine with this binding going in as is, or would you like any changes? Thanks, Vishnu ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-19 5:48 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-10-21 5:52 [PATCH v3] dt-bindings: dma: qcom,bam-dma: Allow memory-region property Vishnu Santhosh 2026-10-22 14:01 ` Rob Herring 2026-10-23 6:35 ` Vishnu Santhosh 2026-10-26 13:05 ` Rob Herring 2026-10-27 6:22 ` Vishnu Santhosh 2026-11-19 5:48 ` Vishnu Santhosh
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox