Skip to content

Enable per-region CMA DMA-BUF heaps for audio ML offload - #1363

Open
qti-sbojja wants to merge 3 commits into
qualcomm-linux:qcom-6.18.yfrom
qti-sbojja:dma_support
Open

qti-sbojja wants to merge 3 commits into
qualcomm-linux:qcom-6.18.yfrom
qti-sbojja:dma_support

Conversation

@qti-sbojja

@qti-sbojja qti-sbojja commented Oct 29, 2026 •

Copy link
Copy Markdown

Backports the upstream per-region CMA DMA-BUF heap support (heap registration rework + one heap per CMA reserved region) and enables CONFIG_DMA_CMA in qcom.config so the DMA-BUF heap configs can be selected. Enables allocating from a dedicated CMA region for the audio ML offload use case.

CRs-Fixed: 4727557

The CMA heap instantiation was initially developed by having the
contiguous DMA code call into the CMA heap to create a new instance
every time a reserved memory area is probed.

Turning the CMA heap into a module would create a dependency of the
kernel on a module, which doesn't work.

Let's turn the logic around and do the opposite: store all the reserved
memory CMA regions into the contiguous DMA code, and provide an iterator
for the heap to use when it probes.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/20260331-dma-buf-heaps-as-modules-v4-1-e18fda504419@kernel.org
…egion

Aside from the main CMA region, it can be useful to allow userspace to
allocate from the other CMA reserved regions.

Indeed, those regions can have specific properties that can be useful to
a specific us-case.

For example, one of them platform I've been with has ECC enabled on the
entire memory but for a specific region. Using that region to allocate
framebuffers can be particular beneficial because enabling the ECC has a
performance and memory footprint cost.

Thus, exposing these regions as heaps user-space can allocate from and
import wherever needed allows to cover that use-case.

For now, only shared-dma-pools regions with the reusable property (ie,
backed by CMA) are supported, but eventually we'll want to support other
DMA pools types.

Since we collected all the CMA regions created during boot, we can
simply iterate over all of them to create the heaps.

This has a weird interaction with the recent work on the CMA name, in
particular the backward compatibility code created by commit
854acbe ("dma-buf: heaps: Give default CMA heap a fixed name").

Indeed, the old name was either 'reserved', or the name of the
reserved-memory region device tree node if the linux,cma-default
property was set.

In both these cases, we have now collected this region during boot, and
we're using the same name. So we're now largely redundant with the
code to handle backward compatibility code, and we can thus remove it
and the associated Kconfig option.

Reviewed-by: T.J. Mercier <tjmercier@google.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://lore.kernel.org/r/20251013-dma-buf-ecc-heap-v8-5-04ce150ea3d9@kernel.org
Enable CONFIG_DMA_CMA as a dependency to allow the DMA-BUF heap
configs (DMABUF_HEAPS, DMABUF_HEAPS_CMA, DMABUF_HEAPS_SYSTEM) to
be selected in qcom.config.

Link: qualcomm-linux/kernel-topics#1452
Signed-off-by: Bibek Kumar Patro <bibek.patro@oss.qualcomm.com>
@qswat-orbit-external

Copy link
Copy Markdown

Merge Check Failed: CR Not Eligible for Merge

CR 4613255 is not eligible for merge.

The parent software image for kernel.qli.2.0 is not development complete.

Entity: kernel.qli.2.0
CR: 4613255
Reason: CR_CANNOT_MERGE

Please ensure the CR passes both CCT (ComponentChangeTasks) and ICT (Integration Change Tasks) validations.

@qswat-orbit-external

Copy link
Copy Markdown

Merge Check Failed: CR Not Eligible for Merge

CR 4727557 is not eligible for merge.

The parent software image for kernel.qli.2.0 is not development complete.

Entity: kernel.qli.2.0
CR: 4727557
Reason: CR_CANNOT_MERGE

Please ensure the CR passes both CCT (ComponentChangeTasks) and ICT (Integration Change Tasks) validations.

@qlijarvis

Copy link
Copy Markdown

PR #1363 — validate-patch

PR: #1363

Verdict Issues Detailed Report
❌ 0 Full report

Final Summary

  1. Lore link present:

    • Commit 1/3: Yes — https://lore.kernel.org/r/20260331-dma-buf-heaps-as-modules-v4-1-e18fda504419@kernel.org
    • Commit 2/3: Yes — https://lore.kernel.org/r/20251013-dma-buf-ecc-heap-v8-5-04ce150ea3d9@kernel.org
    • Commit 3/3: No — QCLINUX: prefix; no lore link expected or required
  2. Lore link matches PR commits:

    • Commit 1/3: No — PR commit omits 2 of 4 files changed by the lore patch (missing drivers/dma-buf/heaps/cma_heap.c and include/linux/dma-buf/heaps/cma.h deletion)
    • Commit 2/3: Partial — file present but context differs; missing prerequisite patches from the 5-patch series
    • Commit 3/3: N/A — no lore link to compare against
  3. Upstream patch status:

    • Commit 1/3: ✅ ACKed — Applied to dma-mapping-for-next by Marek Szyprowski; available in stable branch
    • Commit 2/3: ✅ ACKed — Merged to drm-misc-next by Sumit Semwal
    • Commit 3/3: N/A — vendor-only change, not posted upstream
  4. PR present in qcom-next/topics: Partial - 2/3 commit(s) only have partial integration evidence

    • Commit 1/3: Partial — subject or partial tree evidence found, but full change not verified
    • Commit 2/3: Partial — subject or partial tree evidence found, but full change not verified
    • Commit 3/3: Yes — exact patch-id match at acb0ed1b15f3a1666927b9a7946347db07767a00 in qcom-next
Verdict: ❌ — click to expand

🔍 Patch Validation

PR: #1363 - "FROMGIT: dma: contiguous: Turn heap registration logic around" + 2 more commits
Upstream commits:


Commit 1/3: FROMGIT: dma: contiguous: Turn heap registration logic around

Lore link: https://lore.kernel.org/r/20260331-dma-buf-heaps-as-modules-v4-1-e18fda504419@kernel.org

Commit Message

Check Status Note
Subject matches upstream ✅ Subject matches lore patch v4 1/8 (with FROMGIT: prefix added)
Body preserves rationale ✅ Body text identical to lore patch
Fixes tag present/correct N/A No Fixes tag in upstream or PR
Authorship preserved ✅ From: Maxime Ripard <mripard@kernel.org> matches lore author
Backport note N/A FROMGIT: prefix used (not BACKPORT:)
Signed-off-by chain ✅ Both Signed-off-by: lines present and match lore

Diff

File Status Notes
drivers/dma-buf/heaps/cma_heap.c ❌ MISSING Lore patch modifies this file; PR commit does not include it
include/linux/dma-buf/heaps/cma.h ❌ MISSING Lore patch deletes this file; PR commit does not include the deletion
include/linux/dma-map-ops.h ⚠️ PARTIAL File present in PR but context differs (different base tree)
kernel/dma/contiguous.c ⚠️ PARTIAL File present in PR but context differs (different base tree)

Upstream Patch Status

Community verdict: ✅ ACKed — Applied to dma-mapping-for-next branch by Marek Szyprowski. Lore thread shows: "Applied again patches 1-5 to my dma-mapping-for-next branch." Also available in stable branch: https://web.git.kernel.org/pub/scm/linux/kernel/git/mszyprowski/linux.git/log/?h=dma-contig-for-7.1-modules-prep-v4

Integration Presence

Per integration_presence_report.md: partial — subject or partial tree evidence found in qcom-next/topics, but full change was not verified.


Commit 2/3: FROMGIT: dma-buf: heaps: cma: Create CMA heap for each CMA reserved region

Lore link: https://lore.kernel.org/r/20251013-dma-buf-ecc-heap-v8-5-04ce150ea3d9@kernel.org

Commit Message

Check Status Note
Subject matches upstream ✅ Subject matches lore patch v8 5/5 (with FROMGIT: prefix added)
Body preserves rationale ✅ Body text identical to lore patch
Fixes tag present/correct N/A No Fixes tag in upstream or PR
Authorship preserved ✅ From: Maxime Ripard <mripard@kernel.org> matches lore author
Backport note N/A FROMGIT: prefix used (not BACKPORT:)
Signed-off-by chain ✅ Both Signed-off-by: lines present; Reviewed-by: tag present

Diff

File Status Notes
drivers/dma-buf/heaps/cma_heap.c ⚠️ REVIEW File present; context differs due to missing prerequisite patches

Upstream Patch Status

Community verdict: ✅ ACKed — Merged to drm-misc-next by Sumit Semwal. Lore thread shows: "Thank you; it's merged to drm-misc-next now."

Integration Presence

Per integration_presence_report.md: partial — subject or partial tree evidence found in qcom-next/topics, but full change was not verified.


Commit 3/3: QCLINUX: qcom.config: Enable DMA_CMA for DMA-BUF heap support

Lore link: N/A (QCLINUX: vendor-only commit)
GitHub link: qualcomm-linux/kernel-topics#1452

Commit Message

Check Status Note
Subject format ✅ QCLINUX: prefix correct for vendor-only change
Body describes change ✅ Clear rationale for enabling CONFIG_DMA_CMA
Authorship ✅ From: Bibek Kumar Patro <bibek.patro@oss.qualcomm.com>
Signed-off-by ✅ Present and matches author

Diff

File Status Notes
arch/arm64/configs/qcom.config ✅ Single-line config addition; straightforward vendor change

Integration Presence

Per integration_presence_report.md: present — exact patch-id match at acb0ed1b15f3a1666927b9a7946347db07767a00 in qcom-next.


Issues

Commit 1/3 — Critical content mismatch:

  1. Missing hunks: The lore patch v4 1/8 is part of an 8-patch series titled "dma-buf: heaps: Turn heaps into modules". The PR links to patch 1/8, but the PR commit only includes 2 of 4 files changed by that patch:

    • ❌ Missing: drivers/dma-buf/heaps/cma_heap.c modifications
    • ❌ Missing: include/linux/dma-buf/heaps/cma.h deletion
  2. Incomplete series: The lore series has 8 patches (v4 0/8 through v4 8/8). The PR only includes patch 1/8 (partially) and then jumps to a different series (v8 5/5 from a different posting). This creates a dependency gap — patch 1/8 depends on the other patches in the series to be functionally complete.

  3. Wrong lore link: The PR commit 1/3 links to the message-ID for patch 1/8, but the actual content in the PR does not match that patch. The PR appears to contain only a subset of the changes from the full v4 series, possibly cherry-picked from a later consolidated commit or a different revision.

Commit 2/3 — Context mismatch:

  1. Missing prerequisites: The lore patch v8 5/5 is the final patch in a 5-patch series. The PR does not include patches 1/5 through 4/5, which likely contain prerequisite changes that commit 2/3 depends on. The integration_presence_report.md confirms only "partial" integration evidence, suggesting the full series is not present.

Integration status:

  1. Partial integration: Per integration_presence_report.md, commits 1/3 and 2/3 show only "partial" evidence in qcom-next/topics (subject or partial tree evidence, but full change not verified). Only commit 3/3 (QCLINUX: vendor config) is confirmed present with exact patch-id match.

Verdict

❌ FAIL — Do not merge without correction.

Reason:
Commit 1/3 is incomplete — it links to lore patch v4 1/8 but omits 2 of 4 files changed by that patch (drivers/dma-buf/heaps/cma_heap.c and the deletion of include/linux/dma-buf/heaps/cma.h). This creates a broken backport that does not faithfully represent the upstream patch and will likely cause build or runtime issues.

Additionally, both commits 1/3 and 2/3 are part of multi-patch series (8 patches and 5 patches respectively) but the PR does not include the full series, creating dependency gaps.

Required fixes:

  1. For commit 1/3: Either:

    • (a) Include the full 8-patch series from the v4 posting (patches 1/8 through 8/8), or
    • (b) Update the lore link to point to a single consolidated commit that matches the actual PR content (if such a commit exists in a maintainer tree), or
    • (c) Split the PR into multiple commits that faithfully represent each patch in the series.
  2. For commit 2/3: Include the prerequisite patches 1/5 through 4/5 from the v8 series, or verify that those changes are already present in the target branch.

  3. Verify integration: Confirm that the full series (not just partial evidence) is present in qcom-next or the relevant topic branch before merging.


Final Summary

  1. Lore link present:

    • Commit 1/3: Yes — https://lore.kernel.org/r/20260331-dma-buf-heaps-as-modules-v4-1-e18fda504419@kernel.org
    • Commit 2/3: Yes — https://lore.kernel.org/r/20251013-dma-buf-ecc-heap-v8-5-04ce150ea3d9@kernel.org
    • Commit 3/3: No — QCLINUX: prefix; no lore link expected or required
  2. Lore link matches PR commits:

    • Commit 1/3: No — PR commit omits 2 of 4 files changed by the lore patch (missing drivers/dma-buf/heaps/cma_heap.c and include/linux/dma-buf/heaps/cma.h deletion)
    • Commit 2/3: Partial — file present but context differs; missing prerequisite patches from the 5-patch series
    • Commit 3/3: N/A — no lore link to compare against
  3. Upstream patch status:

    • Commit 1/3: ✅ ACKed — Applied to dma-mapping-for-next by Marek Szyprowski; available in stable branch
    • Commit 2/3: ✅ ACKed — Merged to drm-misc-next by Sumit Semwal
    • Commit 3/3: N/A — vendor-only change, not posted upstream
  4. PR present in qcom-next/topics:

    • Commit 1/3: Partial — subject or partial tree evidence found, but full change not verified
    • Commit 2/3: Partial — subject or partial tree evidence found, but full change not verified
    • Commit 3/3: Yes — exact patch-id match at acb0ed1b15f3a1666927b9a7946347db07767a00 in qcom-next

Deterministic Integration Presence

Integration Presence Report

This report is generated by Jarvis before validate-patch runs.
It is the authoritative source for whether PR changes are already present
in qcom-next or in the kernel topic branches.

Kernel repo: /local/mnt/workspace/sgaud/Qgenie/image_pipeline/kernel
qcom-next ref: c7896917e523946138ce654d4b6c1e33d5a8f4e5
topics remote: topics -> https://github.com/qualcomm-linux/kernel-topics
topics fetch: fetched

Commit Subject qcom-next topics Final
1/3 [PATCH 1/3] FROMGIT: dma: contiguous: Turn heap registration logic partial - subject or partial tree evidence found, but full change was not verified partial - subject or partial tree evidence found, but full change was not verified partial
2/3 [PATCH 2/3] FROMGIT: dma-buf: heaps: cma: Create CMA heap for each partial - subject or partial tree evidence found, but full change was not verified partial - subject or partial tree evidence found, but full change was not verified partial
3/3 [PATCH 3/3] QCLINUX: qcom.config: Enable DMA_CMA for DMA-BUF heap present - exact patch-id match at acb0ed1 skipped - not checked because qcom-next already contains the change present

Final Status

overall_status: PARTIAL
present_commits: 1/3
partial_commits: 2/3
missing_commits: 0/3
topics_checked_for_commits: 2/3
final_summary: PR present in qcom-next/topics: Partial - 2/3 commit(s) only have partial integration evidence

@qlijarvis

Copy link
Copy Markdown

PR #1363 — checker-log-analyzer

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

Checker Result Summary
Checker Result Summary
checkpatch ✅ All 3 commits passed with no style issues
dt-binding-check ⏭️ Skipped - no DT binding changes
dtb-check ⏭️ Skipped - no devicetree changes
sparse-check ✅ Passed - no sparse warnings
check-uapi-headers ✅ Passed - no UAPI changes
check-patch-compliance ❌ 3 failures: 2 content mismatches, 1 prefix rejection
tag-check ⚠️ Cannot determine target branch (network unavailable)

Detailed report: Full report

Checker analysis — click to expand

🤖 CI Checker Analysis (checker-log-analyzer)

PR: #1363 - Enable DMA_CMA for DMA-BUF heap support
Source: https://github.com/qualcomm-linux/kernel-config/actions/runs/40852494659

Checker Result Summary
checkpatch ✅ All 3 commits passed with no style issues
dt-binding-check ⏭️ Skipped - no DT binding changes
dtb-check ⏭️ Skipped - no devicetree changes
sparse-check ✅ Passed - no sparse warnings
check-uapi-headers ✅ Passed - no UAPI changes
check-patch-compliance ❌ 3 failures: 2 content mismatches, 1 prefix rejection
tag-check ⚠️ Cannot determine target branch (network unavailable)

❌ check-patch-compliance

Root cause: Two FROMGIT commits have content differences from their upstream links, and one QCLINUX commit is rejected by the checker.

Failure details:

Commit 1: 5fa7392e8bb3 - "FROMGIT: dma: contiguous: Turn heap registration logic around"

Checking commit: FROMGIT: dma: contiguous: Turn heap registration logic around
Change is different from the one mentioned in Link
Link: https://lore.kernel.org/r/20260331-dma-buf-heaps-as-modules-v4-1-e18fda504419@kernel.org

Commit 2: 013d33e4e647 - "FROMGIT: dma-buf: heaps: cma: Create CMA heap for each CMA reserved region"

Checking commit: FROMGIT: dma-buf: heaps: cma: Create CMA heap for each CMA reserved region
Change is different from the one mentioned in Link
Link: https://lore.kernel.org/r/20251013-dma-buf-ecc-heap-v8-5-04ce150ea3d9@kernel.org

Commit 3: fc090ce06141 - "QCLINUX: qcom.config: Enable DMA_CMA for DMA-BUF heap support"

Checking commit: QCLINUX: qcom.config: Enable DMA_CMA for DMA-BUF heap support
Commit summary does not start with a required prefix

Analysis:

  1. Commits 1 & 2 (Content mismatch): The FROMGIT: commits have differences from their upstream lore links. This could be due to:

    • Context line differences (false positive)
    • Legitimate adaptations for the target kernel version
    • Missing or extra hunks
    • The patches may be from a future date (2026-07-17) that doesn't exist yet in the referenced lore threads
  2. Commit 3 (Prefix rejection): The QCLINUX: prefix is not in the allowed list for check-patch-compliance. This checker only accepts: FROMLIST:, FROMGIT:, UPSTREAM:, BACKPORT:. This is a known limitation of the checker for vendor-only commits.

Fix:

For commits 1 & 2:

# Fetch the upstream patches and compare
b4 am --single-message -C -l -3 https://lore.kernel.org/r/20260331-dma-buf-heaps-as-modules-v4-1-e18fda504419@kernel.org -o /tmp/commit1
b4 am --single-message -C -l -3 https://lore.kernel.org/r/20251013-dma-buf-ecc-heap-v8-5-04ce150ea3d9@kernel.org -o /tmp/commit2

# Compare the actual diff content (ignoring context)
git format-patch -1 5fa7392e8bb3 --stdout | awk '/^diff/,/^--$/' | grep -E '^[+-][^+-]' > /tmp/pr_commit1.diff
awk '/^diff/,/^--$/' /tmp/commit1/*.mbx | grep -E '^[+-][^+-]' > /tmp/upstream_commit1.diff
diff /tmp/pr_commit1.diff /tmp/upstream_commit1.diff

# If differences are legitimate adaptations, document them in the commit message
# If differences are context-only, this is a false positive
# If there are missing/extra hunks, fix the patch

For commit 3:
The QCLINUX: prefix failure is expected behavior. This is a vendor-only config change with no upstream equivalent. The checker will always fail for QCLINUX: and PENDING: prefixes because they are not in the allowed upstream-linkable prefix list.

Options:

  • Accept this as a known limitation (recommended for vendor-only changes)
  • If this change should be upstreamed, post it to LKML and change prefix to FROMLIST: with a proper lore link
  • If merging to qcom-next or qcom-next-staging, this check would not apply

Reproduce locally:

# For content mismatch verification
cd /path/to/kernel
../kernel-checkers/check-patch-compliance.sh --base 5cb134383ee6 --head fc090ce06141

# Manual b4 fetch for each commit
b4 am --single-message -C -l -3 <lore-link> -o /tmp/out

⚠️ tag-check (Unable to verify)

Status: Cannot determine target branch due to network unavailability.

Context: The tag-check applies to all branches except qcom-next and qcom-next-staging. All three commits in this PR have valid prefix tags:

  • Commit 1: FROMGIT: ✅
  • Commit 2: FROMGIT: ✅
  • Commit 3: QCLINUX: ✅

Action required: Verify the target branch:

gh pr view 1363 --repo qualcomm-linux/kernel --json baseRefName -q .baseRefName
  • If target is qcom-next or qcom-next-staging → tag-check is N/A (skipped)
  • If target is any other branch → tag-check PASSES (all commits have valid prefixes)

Verdict

2 blockers require attention:

  1. Content mismatch (commits 1 & 2): Verify whether the differences from upstream are legitimate adaptations or errors. The lore links reference dates in 2026 which may indicate the patches are not yet available upstream, or the dates in the commit messages are incorrect.

  2. QCLINUX prefix rejection (commit 3): This is a known checker limitation for vendor-only commits. If this PR targets a branch other than qcom-next/qcom-next-staging, this failure is expected and can be accepted as-is for vendor-only config changes.

Recommendation: Investigate the content mismatch for commits 1 & 2. If the differences are legitimate adaptations or the upstream patches are not yet available, document this in the PR description. The QCLINUX prefix failure can be accepted as a known limitation for vendor-only changes.

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.

4 participants