Skip to content

FROMLIST: misc: fastrpc: map ADSP remote heap into remoteproc IOMMU domain#1443

Open
Anandu Krishnan E (quic-anane) wants to merge 1 commit into
qualcomm-linux:tech/mm/fastrpcfrom
quic-anane:rmeoteheap_kvm
Open

FROMLIST: misc: fastrpc: map ADSP remote heap into remoteproc IOMMU domain#1443
Anandu Krishnan E (quic-anane) wants to merge 1 commit into
qualcomm-linux:tech/mm/fastrpcfrom
quic-anane:rmeoteheap_kvm

Conversation

@quic-anane

@quic-anane Anandu Krishnan E (quic-anane) commented Jul 1, 2026

Copy link
Copy Markdown

When the remoteproc has an IOMMU (kernel running at EL2 without a separate hypervisor), memory carveouts must be explicitly mapped into the remoteproc's IOMMU domain so the DSP can access them. Without this mapping the DSP triggers an SMMU translation fault when accessing the remote heap carveout used for audio PD static process creation.

Add has_iommu to fastrpc_channel_ctx, set from the "iommus" property of the remoteproc DT node. When set, map the ADSP remote heap carveout into the remoteproc's IOMMU domain using an identity mapping (IOVA == PA) via iommu_map(), and skip qcom_scm_assign_mem() which is only needed when a separate hypervisor manages inter-VM memory access control.

Introduce fastrpc_remote_heap_map() and fastrpc_remote_heap_unmap() helpers to encapsulate the IOMMU domain lookup and map/unmap.

Link: https://lore.kernel.org/all/20260618-audio_fix_clean_v3-v1-1-ec1ee66fe455@oss.qualcomm.com/
Signed-off-by: Anandu Krishnan E anandu.e@oss.qualcomm.com
CRs-Fixed: 4564170

@qcomlnxci qcomlnxci requested review from a team, Chenna Kesava Raju (Chennak-quic) and Ekansh Gupta (ekanshibu) and removed request for a team July 1, 2026 04:46
@ekanshibu

Copy link
Copy Markdown

remove empty line b/w Link: and Signed-off-by tag

…omain

When the remoteproc has an IOMMU (kernel running at EL2 without a
separate hypervisor), memory carveouts must be explicitly mapped into
the remoteproc's IOMMU domain so the DSP can access them.  Without
this mapping the DSP triggers an SMMU translation fault when accessing
the remote heap carveout used for audio PD static process creation.

Add has_iommu to fastrpc_channel_ctx, set from the "iommus" property
of the remoteproc DT node.  When set, map the ADSP remote heap
carveout into the remoteproc's IOMMU domain using an identity mapping
(IOVA == PA) via iommu_map(), and skip qcom_scm_assign_mem() which is
only needed when a separate hypervisor manages inter-VM memory access
control.

Introduce fastrpc_remote_heap_map() and fastrpc_remote_heap_unmap()
helpers to encapsulate the IOMMU domain lookup and map/unmap.

Link: https://lore.kernel.org/all/20260618-audio_fix_clean_v3-v1-1-ec1ee66fe455@oss.qualcomm.com/
Signed-off-by: Anandu Krishnan E <anandu.e@oss.qualcomm.com>
@qswat-orbit-external

Copy link
Copy Markdown

Merge Check Failed: No Component Found

Configuration Error: No component found for branch 'tech/mm/fastrpc'.

There is no component associated with the provided branch in Polaris. Please verify the branch configuration.

Branch: tech/mm/fastrpc

@qcomlnxci qcomlnxci requested a review from a team July 1, 2026 04:54
@qlijarvis

Copy link
Copy Markdown

🔨 Build Failure Analysis — PR #1443

PR: #1443
Build run: https://github.com/qualcomm-linux/kernel-config/actions/runs/28494448606

# Error File:Line PR-introduced? Root Cause
1 Merge conflicts during integration Multiple files (drivers/misc/fastrpc.c, include/uapi/misc/fastrpc.h, and 30+ others) No Pre-existing integration conflicts with other topic branches already merged into the baseline
2 Incorrect iommu_map() API signature drivers/misc/fastrpc.c:2564 Yes PR uses 6-parameter iommu_map() with GFP_KERNEL flag, but kernel v5.15+ only accepts 5 parameters

Verdict

The build failed due to merge conflicts during integration (not PR-introduced). However, the PR contains 1 compilation error that would surface once conflicts are resolved: incorrect iommu_map() API usage.

📎 Detailed analysis: Full report

@qlijarvis

Copy link
Copy Markdown

🔨 Build Failure Analysis — PR #1443

PR: #1443
Build run: https://github.com/qualcomm-linux/kernel-config/actions/runs/28494448606

# Error File:Line PR-introduced? Root Cause
1 Merge conflict (content) drivers/misc/fastrpc.c Yes PR modifies fastrpc.c which conflicts with concurrent changes in qcom-next baseline
2 Merge conflict (content) include/uapi/misc/fastrpc.h Yes PR's changes to fastrpc UAPI conflict with baseline updates
3-100 98 additional merge conflicts Various files No Pre-existing conflicts in qcom-next baseline unrelated to this PR's fastrpc changes

Verdict

This is NOT a compilation failure. The build failed during the pre-merge integration step when automerge attempted to merge PR branch topic/tech/mm/fastrpc with baseline qcom-next. 2 of 100 merge conflicts are directly related to this PR's changes to fastrpc driver; the remaining 98 conflicts are pre-existing integration issues in the baseline that prevent any PR from building until resolved.

📎 Detailed analysis: Full report

@qlijarvis

Copy link
Copy Markdown

PR #1443 — validate-patch

PR: #1443

Verdict Issues Detailed Report
⚠️ 2 Full report

Final Summary

  1. Lore link present: Yes — Link tag points to https://lore.kernel.org/all/20260618-audio_fix_clean_v3-v1-1-ec1ee66fe455@oss.qualcomm.com/
  2. Lore link matches PR commits: Cannot verify — Network access restricted; unable to fetch upstream patch for comparison
  3. Upstream patch status: In review — FROMLIST prefix indicates patch posted to mailing list but not yet merged upstream (future-dated lore link from 2026-06-18 suggests this is a forward-looking patch)
  4. PR present in qcom-next: No — git log search in /local/mnt/workspace/sgaud/Qgenie/image_pipeline/kernel found no matching commit by subject or author
Verdict: ⚠️ — click to expand

🔍 Patch Validation

PR: #1443
Title: FROMLIST: misc: fastrpc: map ADSP remote heap into remoteproc IOMMU domain
Upstream commit: https://lore.kernel.org/all/20260618-audio_fix_clean_v3-v1-1-ec1ee66fe455@oss.qualcomm.com/
Verdict: ⚠️ PARTIAL (cannot verify upstream match due to network restrictions)

Commit Message

Check Status Note
Subject matches upstream ⚠️ Cannot fetch upstream patch to verify (network restricted)
Body preserves rationale Comprehensive explanation of IOMMU mapping requirement and implementation
Fixes tag present/correct N/A No Fixes tag; appears to be new feature/fix without explicit regression reference
Authorship preserved Author: Anandu Krishnan E anandu.e@oss.qualcomm.com
Backport note (if applicable) N/A FROMLIST prefix indicates patch is from mailing list, not yet upstream

Diff

File Status Notes
drivers/misc/fastrpc.c Well-structured changes: adds IOMMU mapping helpers, conditional logic based on has_iommu flag

Code Quality Observations

Strengths:

  • Adds two well-encapsulated helper functions: fastrpc_remote_heap_map() and fastrpc_remote_heap_unmap()
  • Proper resource management with of_node_put() and put_device() calls
  • Conditional logic cleanly separates IOMMU path from hypervisor (SCM) path
  • Error handling includes proper cleanup on failure paths
  • New error label err_put_node: added for proper device tree node cleanup

Potential Issues:

  1. Memory leak in remove path: In fastrpc_rpmsg_remove(), when !err after qcom_scm_assign_mem(), the code frees remote_heap. However, if err != 0, the memory is never freed, creating a leak.
  2. Inconsistent cleanup: The probe path now has err_put_node: that doesn't free data->remote_heap on error, but the allocation happens before this label. If fastrpc_remote_heap_map() fails, the heap is freed inline, but other error paths after heap allocation may leak.
  3. Missing of_node_put in success path: After data->has_iommu = of_property_present(rproc_node, "iommus");, the code adds of_node_put(rproc_node); rproc_node = NULL; only after the SDSP/ADSP domain block. If domain_id is neither SDSP nor ADSP, rproc_node is never put.

Issues

Critical:

  • Resource leak in remove: If qcom_scm_assign_mem() fails in fastrpc_rpmsg_remove(), cctx->remote_heap is never freed, leaking memory.

Minor:

  • Potential of_node leak: If domain_id is not SDSP_DOMAIN_ID or ADSP_DOMAIN_ID, rproc_node obtained via of_get_parent(of_get_parent(rdev->of_node)) is never released with of_node_put().

Verdict

⚠️ Conditional approval with fixes needed

The patch implements a sound architectural approach to handle IOMMU-based memory mapping for fastrpc remote heaps. The core logic is correct and well-structured. However, there are resource management issues that should be addressed:

  1. In fastrpc_rpmsg_remove(), ensure cctx->remote_heap is freed even if qcom_scm_assign_mem() fails
  2. Ensure of_node_put(rproc_node) is called in all paths after rproc_node = of_get_parent(of_get_parent(rdev->of_node))

Final Summary

  1. Lore link present: Yes — Link tag points to https://lore.kernel.org/all/20260618-audio_fix_clean_v3-v1-1-ec1ee66fe455@oss.qualcomm.com/
  2. Lore link matches PR commits: Cannot verify — Network access restricted; unable to fetch upstream patch for comparison
  3. Upstream patch status: In review — FROMLIST prefix indicates patch posted to mailing list but not yet merged upstream (future-dated lore link from 2026-06-18 suggests this is a forward-looking patch)
  4. PR present in qcom-next: No — git log search in /local/mnt/workspace/sgaud/Qgenie/image_pipeline/kernel found no matching commit by subject or author

@qlijarvis

Copy link
Copy Markdown

PR #1443 — checker-log-analyzer

PR: #1443
Checker run: https://github.com/qualcomm-linux/kernel-config/actions/runs/28494448714

Checker Result Summary
Checker Result Summary
checkpatch ⏭️ Did not run - CI setup failure
dt-binding-check ⏭️ Did not run - CI setup failure
dtb-check ⏭️ Did not run - CI setup failure
sparse-check ⏭️ Did not run - CI setup failure
check-uapi-headers ⏭️ Did not run - CI setup failure
check-patch-compliance ⏭️ Did not run - CI setup failure
tag-check N/A Not applicable - CI setup failure
qcom-next-check N/A Not applicable - CI setup failure

Detailed report: Full report

Checker analysis — click to expand

🤖 CI Checker Analysis (checker-log-analyzer)

PR: #1443 - FROMLIST: misc: fastrpc: map ADSP remote heap into remoteproc
Source: https://github.com/qualcomm-linux/kernel-config/actions/runs/28494448714

Checker Result Summary
checkpatch ⏭️ Did not run - CI setup failure
dt-binding-check ⏭️ Did not run - CI setup failure
dtb-check ⏭️ Did not run - CI setup failure
sparse-check ⏭️ Did not run - CI setup failure
check-uapi-headers ⏭️ Did not run - CI setup failure
check-patch-compliance ⏭️ Did not run - CI setup failure
tag-check N/A Not applicable - CI setup failure
qcom-next-check N/A Not applicable - CI setup failure

❌ CI Infrastructure Failure

Root cause: Git merge setup failed with "refusing to merge unrelated histories" when attempting to merge PR #1443 into the base branch tech/mm/fastrpc.

Failure details:

2026-07-01T05:10:49.2461986Z fatal: refusing to merge unrelated histories
2026-07-01T05:10:49.3518375Z Merge failed, manual merge
...
2026-07-01T05:11:10.0825434Z fatal: refusing to merge unrelated histories
2026-07-01T05:11:10.1917440Z Merge failed or conflicts detected. Aborting merge.
2026-07-01T05:11:10.1956891Z ##[error]Process completed with exit code 3.

The CI workflow attempted to:

  1. Merge the base branch topic/tech/mm/fastrpc into an integration branch
  2. Then merge PR FROMLIST: misc: fastrpc: map ADSP remote heap into remoteproc IOMMU domain #1443 on top

Both merge operations failed with "refusing to merge unrelated histories", which typically occurs when:

  • The base branch and integration baseline have no common ancestor
  • The PR branch and base branch have divergent histories with no shared commits
  • Git repository initialization or remote configuration is incorrect

Fix: This is a CI infrastructure/configuration issue, not a code quality problem. The patch itself was never evaluated by any checker.

Required actions:

  1. Verify base branch configuration: Ensure tech/mm/fastrpc exists and is properly configured in the kernel-topics repository
  2. Check PR branch history: Verify PR FROMLIST: misc: fastrpc: map ADSP remote heap into remoteproc IOMMU domain #1443's branch shares a common ancestor with the base branch
  3. Re-run CI: Once the branch configuration is corrected, re-trigger the checker workflow
  4. Alternative: If the branches genuinely have unrelated histories, the CI workflow may need --allow-unrelated-histories flag

Reproduce locally:

# Clone the repos
git clone https://github.com/qualcomm-linux/kernel.git
cd kernel
git remote add topic https://github.com/qualcomm-linux/kernel-topics.git
git fetch topic

# Try to merge the base branch
git checkout -b test-merge <baseline-commit>
git merge topic/tech/mm/fastrpc

# If that succeeds, try merging the PR
git fetch topic pull/1443/head:pr-1443
git merge pr-1443

Verdict

CI infrastructure failure - no code quality checks were performed. This is not a code issue but a Git repository configuration problem that prevented all checkers from running. The PR needs the base branch configuration to be fixed, then CI must be re-run to get actual checker results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants