All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: dts: qcom: hawi: Add memory-region for audio PD
@ 2026-10-21 11:45 Ekansh Gupta
  2026-10-21 11:51 ` Konrad Dybcio
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ekansh Gupta @ 2026-10-21 11:45 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Abel Vesa, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Bharath Kumar, Chenna Kesava Raju, linux-arm-msm, devicetree,
	linux-kernel, Ekansh Gupta

Reserve memory region for audio PD dynamic loading and remote heap
requirements. Add the required VMID list for memory ownership
transfers.

Signed-off-by: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>
---
 arch/arm64/boot/dts/qcom/hawi.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/hawi.dtsi b/arch/arm64/boot/dts/qcom/hawi.dtsi
index 6b0a0ff0faa4..80cb00eccdf1 100644
--- a/arch/arm64/boot/dts/qcom/hawi.dtsi
+++ b/arch/arm64/boot/dts/qcom/hawi.dtsi
@@ -12,6 +12,7 @@
 #include <dt-bindings/clock/qcom,kaanapali-gxclkctl.h>
 #include <dt-bindings/clock/qcom,rpmh.h>
 #include <dt-bindings/dma/qcom-gpi.h>
+#include <dt-bindings/firmware/qcom,scm.h>
 #include <dt-bindings/interconnect/qcom,hawi-rpmh.h>
 #include <dt-bindings/interconnect/qcom,icc.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
@@ -441,6 +442,14 @@ mpss_crashdump_overlay_mem: mpss-crashdump-overlay@bd500000 {
 			reg = <0x0 0xbd500000 0x0 0xf00000>;
 			no-map;
 		};
+
+		adsp_rpc_remote_heap_mem: adsp-rpc-remote-heap {
+			compatible = "shared-dma-pool";
+			alloc-ranges = <0x0 0x0 0x1 0x0>;
+			no-map;
+			alignment = <0x0 0x400000>;
+			size = <0x0 0x800000>;
+		};
 	};
 
 	smp2p-adsp {
@@ -3781,6 +3790,9 @@ fastrpc {
 					compatible = "qcom,hawi-fastrpc", "qcom,kaanapali-fastrpc";
 					qcom,glink-channels = "fastrpcglink-apps-dsp";
 					label = "adsp";
+					memory-region = <&adsp_rpc_remote_heap_mem>;
+					qcom,vmids = <QCOM_SCM_VMID_LPASS
+						      QCOM_SCM_VMID_ADSP_HEAP>;
 					#address-cells = <1>;
 					#size-cells = <0>;
 

---
base-commit: 8f7df005a7564bd7ffa75da9c3085d5b996f1e16
change-id: 20261021-hawi-rh-408b29ebb555

Best regards,
-- 
Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] arm64: dts: qcom: hawi: Add memory-region for audio PD
  2026-10-21 11:45 [PATCH] arm64: dts: qcom: hawi: Add memory-region for audio PD Ekansh Gupta
@ 2026-10-21 11:51 ` Konrad Dybcio
  2026-10-21 12:02 ` sashiko-bot
  2026-10-21 12:04 ` Abel Vesa
  2 siblings, 0 replies; 4+ messages in thread
From: Konrad Dybcio @ 2026-10-21 11:51 UTC (permalink / raw)
  To: Ekansh Gupta, Bjorn Andersson, Konrad Dybcio, Abel Vesa,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: Bharath Kumar, Chenna Kesava Raju, linux-arm-msm, devicetree,
	linux-kernel

On 10/21/26 1:45 PM, Ekansh Gupta wrote:
> Reserve memory region for audio PD dynamic loading and remote heap
> requirements. Add the required VMID list for memory ownership
> transfers.
> 
> Signed-off-by: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>
> ---

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] arm64: dts: qcom: hawi: Add memory-region for audio PD
  2026-10-21 11:45 [PATCH] arm64: dts: qcom: hawi: Add memory-region for audio PD Ekansh Gupta
  2026-10-21 11:51 ` Konrad Dybcio
@ 2026-10-21 12:02 ` sashiko-bot
  2026-10-21 12:04 ` Abel Vesa
  2 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-10-21 12:02 UTC (permalink / raw)
  To: Ekansh Gupta; +Cc: devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] arm64: dts: qcom: hawi: shared-dma-pool on no-map adsp_rpc_remote_heap_mem
--

commit 6bed856021c0410b7dd893a52e0c7a1f5cb149f9
Author: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>

arm64: dts: qcom: hawi: Add memory-region for audio PD

This commit adds a reserved memory region for the audio protection domain
remote heap in arch/arm64/boot/dts/qcom/hawi.dtsi and associates it with
the adsp fastrpc node along with its target vmid list.

> diff --git a/arch/arm64/boot/dts/qcom/hawi.dtsi b/arch/arm64/boot/dts/qcom/hawi.dtsi
> index 6b0a0ff0faa45..80cb00eccdf15 100644
> --- a/arch/arm64/boot/dts/qcom/hawi.dtsi
> +++ b/arch/arm64/boot/dts/qcom/hawi.dtsi
[ ... ]
> @@ -441,6 +442,14 @@ mpss_crashdump_overlay_mem: mpss-crashdump-overlay@bd500000 {
>  			reg = <0x0 0xbd500000 0x0 0xf00000>;
>  			no-map;
>  		};
> +
> +		adsp_rpc_remote_heap_mem: adsp-rpc-remote-heap {
> +			compatible = "shared-dma-pool";
> +			alloc-ranges = <0x0 0x0 0x1 0x0>;
> +			no-map;
> +			alignment = <0x0 0x400000>;
> +			size = <0x0 0x800000>;
> +		};
>  	};

[Severity: High]
Should adsp_rpc_remote_heap_mem omit compatible = "shared-dma-pool" here?

Because adsp_rpc_remote_heap_mem combines compatible = "shared-dma-pool"
with no-map (and without reusable), early boot reservation via
fdt_scan_reserved_mem() -> __reserved_mem_alloc_size() ->
fdt_init_reserved_mem_node() -> __reserved_mem_init_node() rejects
rmem_cma_setup() and instead binds the region to rmem_dma_ops in
kernel/dma/coherent.c:rmem_dma_setup().

When the adsp fastrpc node (which sets memory-region =
<&adsp_rpc_remote_heap_mem> and qcom,vmids = <QCOM_SCM_VMID_LPASS
QCOM_SCM_VMID_ADSP_HEAP>) probes in
drivers/misc/fastrpc.c:fastrpc_rpmsg_probe(), it calls
devm_of_reserved_mem_device_init(rdev) before setting the device dma mask
and before transferring memory ownership:

drivers/misc/fastrpc.c:fastrpc_rpmsg_probe() {
	...
	if (devm_of_reserved_mem_device_init(rdev))
		dev_dbg(rdev, "no reserved DMA memory for FASTRPC\n");
	...
	err = fastrpc_init_reserved_mem(data, rdev, domain_id);
	...
	rdev->dma_mask = &data->dma_mask;
	dma_set_mask_and_coherent(rdev, DMA_BIT_MASK(32));
}

Calling devm_of_reserved_mem_device_init(rdev) invokes
kernel/dma/coherent.c:rmem_dma_device_init():

kernel/dma/coherent.c:rmem_dma_device_init() {
	struct dma_coherent_mem *mem = rmem->priv;

	if (!mem) {
		mem = dma_init_coherent_memory(rmem->base, rmem->base,
					       rmem->size, true);
		if (IS_ERR(mem))
			return PTR_ERR(mem);
		rmem->priv = mem;
	}

	/* Warn if the device potentially can't use the reserved memory */
	if (mem->device_base + rmem->size - 1 >
	    min_not_zero(dev->coherent_dma_mask, dev->bus_dma_limit))
		dev_warn(dev,
			 "reserved memory is beyond device's set DMA address range\n");

	return dma_assign_coherent_memory(dev, mem);
}

First, dma_init_coherent_memory() calls memremap(rmem->base, rmem->size,
MEMREMAP_WC), creating an active stage-1 virtual mapping in the host for
this no-map region. Immediately afterwards, fastrpc_init_reserved_mem()
revokes QCOM_SCM_VMID_HLOS permissions and assigns the entire region to
QCOM_SCM_VMID_LPASS and QCOM_SCM_VMID_ADSP_HEAP:

drivers/misc/fastrpc.c:fastrpc_init_reserved_mem() {
	...
	err = of_reserved_mem_region_to_resource(rdev->of_node, 0, &res);
	...
	if (domain_id == ADSP_DOMAIN_ID) {
		cctx->remote_heap_addr = res.start;
		cctx->remote_heap_size = resource_size(&res);
	}

	if (!cctx->vmcount)
		return 0;

	src_perms = BIT(QCOM_SCM_VMID_HLOS);
	return qcom_scm_assign_mem(res.start, resource_size(&res), &src_perms,
				  cctx->vmperms, cctx->vmcount);
}

Leaving a live host stage-1 MEMREMAP_WC mapping and attaching the region as
rdev->dma_mem after stage-2 access is removed from QCOM_SCM_VMID_HLOS can
trigger stage-2 faults on speculative host accesses or if coherent dma
allocations (such as fastrpc_remote_heap_alloc()) allocate from and memset()
rdev->dma_mem.

Second, because rdev->coherent_dma_mask and rdev->bus_dma_limit are still 0
when devm_of_reserved_mem_device_init(rdev) runs, rmem_dma_device_init()
unconditionally logs a dev_warn() on every boot.

Since commit 9e47ad9c562e ("misc: fastrpc: Allocate entire reserved memory
for Audio PD in probe"), fastrpc retrieves the audio protection domain
region directly via of_reserved_mem_region_to_resource() rather than
dma_alloc_coherent(). Dynamic no-map carveouts with size, alignment, and
alloc-ranges are allocated by __reserved_mem_alloc_size() without needing
compatible = "shared-dma-pool" (matching the static no-map
adsp_rpc_remote_heap_mem nodes in hamoa.dtsi, lemans.dtsi, and monaco.dtsi).

Could compatible = "shared-dma-pool" be dropped from
adsp_rpc_remote_heap_mem so the region remains an unmapped carveout?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261021-hawi-rh-v1-1-401143c22401@oss.qualcomm.com?part=1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] arm64: dts: qcom: hawi: Add memory-region for audio PD
  2026-10-21 11:45 [PATCH] arm64: dts: qcom: hawi: Add memory-region for audio PD Ekansh Gupta
  2026-10-21 11:51 ` Konrad Dybcio
  2026-10-21 12:02 ` sashiko-bot
@ 2026-10-21 12:04 ` Abel Vesa
  2 siblings, 0 replies; 4+ messages in thread
From: Abel Vesa @ 2026-10-21 12:04 UTC (permalink / raw)
  To: Ekansh Gupta
  Cc: Bjorn Andersson, Konrad Dybcio, Abel Vesa, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Bharath Kumar,
	Chenna Kesava Raju, linux-arm-msm, devicetree, linux-kernel

On 26-10-21 17:15:02, Ekansh Gupta wrote:
> Reserve memory region for audio PD dynamic loading and remote heap
> requirements. Add the required VMID list for memory ownership
> transfers.
> 
> Signed-off-by: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>

Reviewed-by: Abel Vesa <abel.vesa@oss.qualcomm.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-21 12:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-21 11:45 [PATCH] arm64: dts: qcom: hawi: Add memory-region for audio PD Ekansh Gupta
2026-10-21 11:51 ` Konrad Dybcio
2026-10-21 12:02 ` sashiko-bot
2026-10-21 12:04 ` Abel Vesa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.