Fix Shikra q6apm DAI under KVM/EL2
Subsystems (9)
cover Fix Shikra q6apm DAI under KVM/EL2
Shikra's q6apm DAI is hosted on the modem DSP. In the hypervisor configuration its shared memory is assigned directly, but when Linux runs at EL2 it owns the apps SMMU and the audio stream must be described and mapped there. Using the normal translating domain causes context faults because the firmware consumes SID-tagged physical addresses.
Select an identity domain for the Shikra q6apm DAI. Also allow modem-domain q6apm DAIs carrying an IOMMU specifier to use the DMA/IOMMU path, while retaining SCM assignment for modem-domain DAIs without an IOMMU.
The series is ordered as follows:
1. Add the Shikra-specific q6apm DAI compatible to the binding.
2. Select an identity domain for that compatible.
3. Add the compatible to the Shikra q6apm DAI node.
4. Select SCM or IOMMU operation from the presence of an IOMMU stream.
The Shikra EL2 overlay is expected to provide the q6apm DAI SMMU stream description. That overlay change is maintained separately from this series.
Validated on a Shikra EVK booted under KVM/EL2. The q6apm DAI probes through the IOMMU path without the previous SCM/IOMMU mutual-exclusion failure, and playback and capture use the per-stream identity domain.
Mohit Sharma (4):
dt-bindings: sound: qcom,q6apm-dai: allow Shikra compatible
iommu: arm-smmu-qcom: use identity domain for Shikra q6apm DAI
arm64: dts: qcom: shikra: add q6apm DAI compatible
ASoC: qcom: q6apm-dai: allow the mDSP IOMMU path
.../devicetree/bindings/sound/qcom,q6apm-dai.yaml | 6 +++++- arch/arm64/boot/dts/qcom/shikra.dtsi | 3 ++- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 1 + sound/soc/qcom/qdsp6/q6apm-dai.c | 9 ++------- 4 files changed, 10 insertions(+), 9 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/4 dt-bindings: sound: qcom,q6apm-dai: allow Shikra compatible
Shikra's q6apm DAI needs a SoC-specific compatible so that the Qualcomm SMMU implementation can select the identity domain required by its firmware ABI. The ASoC driver continues to bind using the generic fallback compatible.
Allow the Shikra compatible followed by the existing generic compatible.
Documentation/devicetree/bindings/sound/qcom,q6apm-dai.yaml +5 -1
@@ -14,7 +14,11 @@ description: | properties: compatible: - const: qcom,q6apm-dais + oneOf: + - const: qcom,q6apm-dais + - items: + - const: qcom,shikra-q6apm-dais + - const: qcom,q6apm-dais iommus: minItems: 1
Signature · 1 line
2.34.1
Mark Brown
maintainerRe: [PATCH 1/4] dt-bindings: sound: qcom,q6apm-dai: allow Shikra compatible
Quoted 4 lines · Mohit Sharma
Shikra's q6apm DAI needs a SoC-specific compatible so that the Qualcomm SMMU implementation can select the identity domain required by its firmware ABI. The ASoC driver continues to bind using the generic fallback compatible.
Please submit patches using subject lines reflecting the style for the subsystem, this makes it easier for people to identify relevant patches. Look at what existing commits in the area you're changing are doing and make sure your subject lines visually resemble what they're doing. There's no need to resubmit to fix this alone.
PATCH 2/4 iommu: arm-smmu-qcom: use identity domain for Shikra q6apm DAI
In reply to Mohit SharmaShikra's q6apm DAI is hosted on the modem DSP under SMMU stream ID 0x1cc. Its firmware consumes the SID-tagged shared-memory addresses as physical addresses, so a translating domain leaves those addresses unmapped and causes context faults when Linux owns the SMMU under EL2.
Add the Shikra q6apm DAI compatible to the Qualcomm SMMU client match table. This selects an identity domain for this stream while retaining an SMMU mapping scoped to its own stream ID.
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +1 -0
@@ -435,6 +435,7 @@ static const struct of_device_id qcom_smmu_client_of_match[] __maybe_unused = { { .compatible = "qcom,sdm670-mdss" }, { .compatible = "qcom,sdm845-mdss" }, { .compatible = "qcom,sdm845-mss-pil" }, + { .compatible = "qcom,shikra-q6apm-dais" }, { .compatible = "qcom,sm6115-mdss" }, { .compatible = "qcom,sm6350-mdss" }, { .compatible = "qcom,sm6375-mdss" },
Signature · 1 line
2.34.1
PATCH 3/4 arm64: dts: qcom: shikra: add q6apm DAI compatible
In reply to Mohit SharmaAdd the Shikra-specific compatible to the q6apm DAI node while retaining the generic fallback used by the ASoC driver. The specific compatible lets arm-smmu-qcom select the identity domain required by the firmware ABI when the EL2 overlay describes this stream to the SMMU.
The EL2 stream description is part of the prerequisite Shikra EL2 overlay series.
arch/arm64/boot/dts/qcom/shikra.dtsi +2 -1
@@ -2983,7 +2983,8 @@ q6apmbedai: bedais { }; q6apmdai: dais { - compatible = "qcom,q6apm-dais"; + compatible = "qcom,shikra-q6apm-dais", + "qcom,q6apm-dais"; memory-region = <&audio_heap_mem &audio_mdsp_carveout_mem>; };
Signature · 1 line
2.34.1
PATCH 4/4 ASoC: qcom: q6apm-dai: allow the mDSP IOMMU path
In reply to Mohit SharmaThe q6apm DAI currently selects SCM buffer assignment solely from the GPR domain. This prevents an mDSP-backed DAI from using an IOMMU, even when the device tree provides an iommus property for environments where the mDSP stream is routed through the apps SMMU.
Use the parsed stream ID to distinguish the two memory access models. An mDSP DAI without an IOMMU continues to use SCM-assigned buffers, while an mDSP DAI with an IOMMU follows the existing DMA/IOMMU path. This also avoids requiring SCM availability for the IOMMU configuration.
sound/soc/qcom/qdsp6/q6apm-dai.c +2 -7
@@ -1218,16 +1218,11 @@ static int q6apm_dai_probe(struct platform_device *pdev) pdata->sid = args.args[0 ] &SID_MASK_DEFAULT ;if (apm && apm->gdev && - apm->gdev->domain_id ==GPR_DOMAIN_ID_MODEM ) { + apm->gdev->domain_id ==GPR_DOMAIN_ID_MODEM && + pdata->sid <0 ) {if (!qcom_scm_is_available ())return -EPROBE_DEFER ; -if (pdata->sid >=0 ) { -dev_err (dev, -"iommus and mDSP SCM path are mutually exclusive\n" ); -return -EINVAL ; - } - pdata->use_scm_assign = true; rc = devm_add_action_or_reset(dev, q6apm_dai_scm_cleanup,
Signature · 1 line
2.34.1
v2 cover Fix Shikra q6apm DAI under KVM/EL2
In reply to Mohit SharmaShikra's q6apm DAI is hosted on the modem DSP. In the hypervisor configuration its shared memory is assigned directly, but when Linux runs at EL2 it owns the apps SMMU and the audio stream must be described and mapped there. Using the normal translating domain causes context faults because the firmware consumes SID-tagged physical addresses.
Shikra also retains its reserved-memory carveout as the backing pool for the audio DMA heap. The EL2 overlay adds an IOMMU description over the base DTB, so the resulting DAI node contains both memory-region and iommus. Allow both properties while continuing to require at least one.
Select an identity domain for the Shikra q6apm DAI. Also allow modem-domain q6apm DAIs carrying an IOMMU specifier to use the DMA/IOMMU path, while retaining SCM assignment for modem-domain DAIs without an IOMMU.
The series is ordered as follows:
1. Add the Shikra-specific compatible and allow both memory properties.
2. Select an identity domain for that compatible.
3. Add the compatible to the Shikra q6apm DAI node.
4. Select SCM or IOMMU operation from the presence of an IOMMU stream.
The Shikra EL2 overlay is expected to provide the q6apm DAI SMMU stream description. That overlay change is maintained separately from this series.
Validated on a Shikra EVK booted under KVM/EL2. The q6apm DAI probes through the IOMMU path without the previous SCM/IOMMU mutual-exclusion failure, and playback and capture use the per-stream identity domain.
Changes in v2:
- Follow the established subject-line style for each subsystem.
- Permit memory-region and iommus together for the Shikra EL2 audio path.
Mohit Sharma (4):
ASoC: dt-bindings: qcom,q6apm-dai: Add Shikra support iommu/arm-smmu-qcom: Use identity domain for Shikra q6apm DAI
arm64: dts: qcom: shikra: Add q6apm DAI compatible
ASoC: qcom: q6apm-dai: Allow the mDSP IOMMU path
.../devicetree/bindings/sound/qcom,q6apm-dai.yaml | 8 ++++++-- arch/arm64/boot/dts/qcom/shikra.dtsi | 3 ++- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 1 + sound/soc/qcom/qdsp6/q6apm-dai.c | 9 ++------- 4 files changed, 11 insertions(+), 10 deletions(-)
Signature · 1 line
2.34.1
PATCH v2 1/4 ASoC: dt-bindings: qcom,q6apm-dai: Add Shikra support
Shikra's q6apm DAI needs a SoC-specific compatible so that the Qualcomm SMMU implementation can select the identity domain required by its firmware ABI. The ASoC driver continues to bind using the generic fallback compatible.
Shikra uses a reserved-memory carveout as the backing pool for its audio DMA heap. When Linux runs under KVM/EL2, it also owns the apps SMMU and the EL2 overlay adds an iommus property to the DAI node. The resulting tree contains both memory-region and iommus, describing the allocation pool and the mDSP address translation respectively.
Allow the Shikra compatible followed by the existing generic compatible. Replace oneOf with anyOf so at least one memory description remains required while permitting both properties in the Shikra EL2 tree.
--- .../devicetree/bindings/sound/qcom,q6apm-dai.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/sound/qcom,q6apm-dai.yaml +6 -2
@@ -14,7 +14,11 @@ description: | properties: compatible: - const: qcom,q6apm-dais + oneOf: + - const: qcom,q6apm-dais + - items: + - const: qcom,shikra-q6apm-dais + - const: qcom,q6apm-dais iommus: minItems: 1
@@ -33,7 +37,7 @@ properties: required: - compatible -oneOf: +anyOf: - required: - iommus - required:
Signature · 1 line
2.34.1
PATCH v2 2/4 iommu/arm-smmu-qcom: Use identity domain for Shikra q6apm DAI
In reply to Mohit SharmaShikra's q6apm DAI is hosted on the modem DSP under SMMU stream ID 0x1cc. Its firmware consumes the SID-tagged shared-memory addresses as physical addresses, so a translating domain leaves those addresses unmapped and causes context faults when Linux owns the SMMU under EL2.
Add the Shikra q6apm DAI compatible to the Qualcomm SMMU client match table. This selects an identity domain for this stream while retaining an SMMU mapping scoped to its own stream ID.
--- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 1 + 1 file changed, 1 insertion(+)
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +1 -0
@@ -420,6 +420,7 @@ static const struct of_device_id qcom_smmu_client_of_match[] __maybe_unused = { { .compatible = "qcom,sdm670-mdss" }, { .compatible = "qcom,sdm845-mdss" }, { .compatible = "qcom,sdm845-mss-pil" }, + { .compatible = "qcom,shikra-q6apm-dais" }, { .compatible = "qcom,sm6115-mdss" }, { .compatible = "qcom,sm6350-mdss" }, { .compatible = "qcom,sm6375-mdss" },
Signature · 1 line
2.34.1
PATCH v2 3/4 arm64: dts: qcom: shikra: Add q6apm DAI compatible
In reply to Mohit SharmaAdd the Shikra-specific compatible to the q6apm DAI node while retaining the generic fallback used by the ASoC driver. The specific compatible lets arm-smmu-qcom select the identity domain required by the firmware ABI when the EL2 overlay describes this stream to the SMMU.
The EL2 stream description is part of the prerequisite Shikra EL2 overlay series.
--- arch/arm64/boot/dts/qcom/shikra.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/shikra.dtsi +2 -1
@@ -2358,7 +2358,8 @@ q6apmbedai: bedais { }; q6apmdai: dais { - compatible = "qcom,q6apm-dais"; + compatible = "qcom,shikra-q6apm-dais", + "qcom,q6apm-dais"; memory-region = <&audio_heap_mem &audio_mdsp_carveout_mem>; };
Signature · 1 line
2.34.1
PATCH v2 4/4 ASoC: qcom: q6apm-dai: Allow the mDSP IOMMU path
In reply to Mohit SharmaThe q6apm DAI currently selects SCM buffer assignment solely from the GPR domain. This prevents an mDSP-backed DAI from using an IOMMU, even when the device tree provides an iommus property for environments where the mDSP stream is routed through the apps SMMU.
Use the parsed stream ID to distinguish the two memory access models. An mDSP DAI without an IOMMU continues to use SCM-assigned buffers, while an mDSP DAI with an IOMMU follows the existing DMA/IOMMU path. This also avoids requiring SCM availability for the IOMMU configuration.
--- sound/soc/qcom/qdsp6/q6apm-dai.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
sound/soc/qcom/qdsp6/q6apm-dai.c +2 -7
@@ -1221,16 +1221,11 @@ static int q6apm_dai_probe(struct platform_device *pdev) }if (apm && apm->gdev && - apm->gdev->domain_id ==GPR_DOMAIN_ID_MODEM ) { + apm->gdev->domain_id ==GPR_DOMAIN_ID_MODEM && + pdata->sid <0 ) {if (!qcom_scm_is_available ())return -EPROBE_DEFER ; -if (pdata->sid >=0 ) { -dev_err (dev, -"iommus and mDSP SCM path are mutually exclusive\n" ); -return -EINVAL ; - } - pdata->use_scm_assign = true; rc = devm_add_action_or_reset(dev, q6apm_dai_scm_cleanup,
Signature · 1 line
2.34.1