Devicetree
 help / color / mirror / Atom feed
From: Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com>
To: sashiko-reviews@lists.linux.dev
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v3] arm64: dts: qcom: shikra: Add BAM-DMUX support
Date: Thu, 1 Oct 2026 21:15:29 +0530	[thread overview]
Message-ID: <4cd28b2d-421b-4665-9985-3612a6f2c99a@oss.qualcomm.com> (raw)
In-Reply-To: <20260920034535.9EC581F000FF@smtp.kernel.org>


On 20-09-2026 09:15 am, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> - [Critical] dts: qcom: bam_dmux_pool shares BAM DMA descriptors with untrusted modem
> - [High] dts: qcom: bam_dmux driver ignores qcom,vmid, leading to SMMU/XPU faults
> --
>
> commit 29cefe6f8087e49778891d714bb8fb329002f944
> Author: Vishnu Santhosh <vishnu.santhosh@oss.qualcomm.com>
>
> arm64: dts: qcom: shikra: Add BAM-DMUX support
>
> Add the SMSM state entries, BAM-DMUX node, and BAM DMA controller needed
> to provide modem data channels on Shikra. Reserve a 256 KiB restricted
> DMA pool and reference it from both the BAM-DMUX and BAM DMA nodes.
>
>> diff --git a/arch/arm64/boot/dts/qcom/shikra.dtsi b/arch/arm64/boot/dts/qcom/shikra.dtsi
>> index 92d22e3b6931c..4980c125b7e1a 100644
>> --- a/arch/arm64/boot/dts/qcom/shikra.dtsi
>> +++ b/arch/arm64/boot/dts/qcom/shikra.dtsi
>> @@ -352,6 +353,13 @@ reserved_memory: reserved-memory {
>>   		#size-cells = <2>;
>>   		ranges;
>>   
>> +		bam_dmux_pool: restricted-dma-pool {
>> +			compatible = "restricted-dma-pool";
>> +			size = <0x0 0x40000>;
>> +			alignment = <0x0 0x40000>;
>> +			alloc-ranges = <0x0 0x80000000 0x0 0x80000000>;
>> +		};
>> +
> [ ... ]
>
>> @@ -1866,6 +1891,20 @@ glink-edge {
>>   				qcom,remote-pid = <1>;
>>   				label = "mpss";
>>   			};
>> +
>> +			bam_dmux: bam-dmux {
>> +				compatible = "qcom,bam-dmux";
>> +				interrupt-parent = <&modem_smsm>;
>> +				interrupts = <1 IRQ_TYPE_EDGE_BOTH>,
>> +					     <11 IRQ_TYPE_EDGE_BOTH>;
>> +				interrupt-names = "pc", "pc-ack";
>> +				qcom,smem-states = <&apps_smsm 1>, <&apps_smsm 11>;
>> +				qcom,smem-state-names = "pc", "pc-ack";
>> +				dmas = <&bam_dmux_dma 4>, <&bam_dmux_dma 5>;
>> +				dma-names = "tx", "rx";
>> +				memory-region = <&bam_dmux_pool>;
>> +				qcom,vmid = <QCOM_SCM_VMID_NAV>;
> [Severity: High]
> Does the BAM-DMUX driver actually parse and use this property?
>
> The host BAM-DMUX driver (drivers/net/wwan/qcom_bam_dmux.c) does not appear to
> parse qcom,vmid or invoke the necessary Qualcomm SCM calls to configure the
> hardware memory protection.
>
> Will this cause SMMU or XPU memory protection faults when the modem attempts
> to read or write its buffers, since the driver fails to grant the modem the
> necessary access to the DMA pool?

The driver support is added by the prerequisite series and is in review:

https://lore.kernel.org/all/20260920-qcom-bam-dmux-vmid-ext-v2-0-ef5ca2178378@oss.qualcomm.com/

>
>> +			};
>>   		};
> [ ... ]
>
>> @@ -2026,6 +2065,18 @@ dispcc: clock-controller@5f00000 {
>>   			#power-domain-cells = <1>;
>>   		};
>>   
>> +		bam_dmux_dma: dma-controller@6044000 {
>> +			compatible = "qcom,bam-v1.7.0";
>> +			reg = <0x0 0x06044000 0x0 0x19000>;
>> +			interrupts = <GIC_SPI 74 IRQ_TYPE_EDGE_RISING 0>;
>> +			#dma-cells = <1>;
>> +			qcom,ee = <0>;
>> +			num-channels = <6>;
>> +			qcom,num-ees = <1>;
>> +			qcom,powered-remotely;
>> +			memory-region = <&bam_dmux_pool>;
> [Severity: Critical]
> Is it safe to share bam_dmux_pool between the modem and the BAM DMA
> descriptors?
>
> The commit message notes that this shared pool provides space for the BAM
> descriptor FIFOs. By linking this pool to the bam_dmux node above, the design
> aims to grant the untrusted modem access to the entire pool.
>
> Because the bam_dmux_dma controller uses physical addresses, if the modem
> overwrites the address field of a DMA descriptor within this shared pool, will
> the BAM DMA controller blindly execute DMA operations on the forged address?
>
> Could this allow a compromised modem to read or write arbitrary host memory?

No. On Shikra, A2 BAM memory accesses are checked by the xPU against the
permissions of the remote VMID, which is only granted access to the
restricted pool. A forged descriptor address outside the pool results in
an xPU violation. This is the same fault that occurs today when the
descriptor FIFOs or buffers are placed outside the pool.

Thanks,
Vishnu

>
>> +		};

      reply	other threads:[~2026-10-01 15:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-20  3:28 [PATCH v3] arm64: dts: qcom: shikra: Add BAM-DMUX support Vishnu Santhosh
2026-09-20  3:45 ` sashiko-bot
2026-10-01 15:45   ` Vishnu Santhosh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4cd28b2d-421b-4665-9985-3612a6f2c99a@oss.qualcomm.com \
    --to=vishnu.santhosh@oss.qualcomm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox