[PATCH v2 0/3] ASoC: qcom: enable audio on stage-2 protected DSPs (mDSP)
Ajay Kumar Nandam <[email protected]>
| Newsgroups | gmane.linux.ports.arm.msm,gmane.linux.sound,gmane.linux.drivers.devicetree,gmane.linux.kernel |
|---|---|
| Message-ID | <[email protected]> |
On platforms such as Qualcomm Shikra, audio is served by the modem DSP (mDSP) rather than the ADSP. The mDSP runs in a stage-2 protected context and cannot use the SMMU, so the PCM buffers it consumes must live in reserved-memory carveouts that are handed to the consumer VMIDs via a hypervisor (SCM) memory assignment. This series adds that access model to the q6apm DAI driver and its binding, alongside the existing stage-1/SMMU (iommus) path, which is left untouched. The two access models are mutually exclusive: a node carries either iommus (stage-1) or qcom,vmids (stage-2), enforced in both the binding (oneOf) and the driver. This supersedes all prior postings. The v1 was sent as multiple independent series (VMID binding + driver, memory-region binding + DTS, and a standalone carveout patch). Per review feedback from Mark Brown [1] and Srinivas Kandagatla [2][3] the binding and driver patches are now consolidated into a single series so they can be reviewed and merged together. Prior versions: v1 (VMID binding + driver + GPR domain): https://lore.kernel.org/all/[email protected]/ v1 (memory-region binding + DTS): https://lore.kernel.org/all/[email protected]/ v2 (carveout SCM assignment, standalone): https://lore.kernel.org/all/[email protected]/ [1] https://lore.kernel.org/all/[email protected]/ [2] https://lore.kernel.org/all/[email protected]/ [3] https://lore.kernel.org/all/[email protected]/ Changes since v1: - Consolidate all three independent series (VMID binding + driver, memory-region binding, carveout assignment) into a single 3-patch series, as requested by Mark Brown [1] and Srinivas Kandagatla [2][3]. - binding: combine qcom,vmids property, memory-region, oneOf constraint, and dependentRequired into one binding patch since all changes go to the same YAML file. - binding: rename DT property from qcom,vmid (singular) to qcom,vmids (plural) and expand the description to explain VMIDs, the hardware access model, and which platforms require this (Krzysztof [4][5], Srinivas [2]). - binding: make iommus and qcom,vmids mutually exclusive via oneOf rather than keeping iommus unconditionally required (Krzysztof [4]). - binding: correct the qcom,vmids description - SCM assignment replaces the buffer's owners with the supplied set, so the driver adds HLOS to the destination itself; reword to say so instead of "HLOS is always retained". - binding: add uniqueItems to qcom,vmids. - binding: add ranges to the reserved-memory example node. - binding: fix qcom,vmids example from two separate cells to a single uint32 array. - binding: make the qcom,vmids example self-contained by including the reserved-memory nodes the memory-region phandles point at. - binding: document that all listed VMIDs and HLOS receive read-write access. - driver (patch 2): merge SCM VMID assignment and carveout buffer allocation into a single bisect-safe patch. Move dest_domain stamping from every packet-allocation call site into the send helpers (q6apm_send_cmd_sync, audioreach_graph_send_cmd_sync, q6prm_send_cmd_sync) and the four async data-path sends. This centralizes domain routing at the send layer and avoids threading a dest_domain parameter through every alloc helper. Suggested by Srinivas Kandagatla. - driver: rewrite commit messages to clearly state the problem, the platform, and why it fails without the fix (Srinivas [3]). - driver: move SCM assign/unassign to probe/remove lifecycle matching upstream patterns (rmtfs_mem, qcom_q6v5_pas) instead of per-stream open/close. - driver: guard the reserved-memory per-stream buffer size against size_t underflow when the pool is smaller than Q6APM_POOL_MAX_STREAMS * POS_BUFFER_BYTES. - driver: bounds-check num_carveouts against Q6APM_MAX_CARVEOUTS before recording a runtime PCM carveout. - driver: track SCM carveouts per-PCM and reclaim only the freed PCM's region in pcm_free, instead of unassigning every region; this also stops num_carveouts growing unbounded across new/free cycles. - driver: log SCM unassign (reclaim-to-HLOS) failures and keep the region marked assigned so DSP-owned memory is never returned to the pool. - driver: reject qcom,vmids and iommus present together at probe. - driver: of_node_put() the iommus phandle args; checkpatch/style cleanups. - driver: remove dead runtime->dma_bytes assignment in open() for managed-buffer path. [4] https://lore.kernel.org/all/20260610-silver-pelican-of-agility-86fcbc@quoll/ [5] https://lore.kernel.org/all/20260622-whimsical-charming-seriema-dcec81@quoll/ --- Ajay Kumar Nandam (3): dt-bindings: sound: qcom,q6apm-dai: add stage-2 (SCM/VMID) access model ASoC: qcom: q6apm-dai: add VMID-based SCM assignment for mDSP buffers ASoC: qcom: qdsp6: generalize GPR service domain .../devicetree/bindings/sound/qcom,q6apm-dai.yaml | 72 +++- sound/soc/qcom/Kconfig | 1 + sound/soc/qcom/qdsp6/audioreach.c | 12 +- sound/soc/qcom/qdsp6/audioreach.h | 22 +- sound/soc/qcom/qdsp6/q6apm-dai.c | 373 +++++++++++++++++++-- sound/soc/qcom/qdsp6/q6apm.c | 8 +- sound/soc/qcom/qdsp6/q6apm.h | 2 +- sound/soc/qcom/qdsp6/q6prm.c | 2 + 8 files changed, 455 insertions(+), 37 deletions(-) --- base-commit: 3d5670d672ae08b8c534b7beed6f57c8b44e7b43 change-id: 20260825-a2a-shikra-vmid-v5-4975625a554a Best regards, -- Ajay Kumar Nandam <[email protected]>