Skip to content

kernel: use the Zephyr cache pointer API - #11623

Draft
lgirdwood wants to merge 1 commit into
thesofproject:mainfrom
lgirdwood:topic/zn-rtos-cacheptr-kernel
Draft

lgirdwood wants to merge 1 commit into
thesofproject:mainfrom
lgirdwood:topic/zn-rtos-cacheptr-kernel

Conversation

@lgirdwood

Copy link
Copy Markdown
Member

Use the Zephyr cache pointer API instead of the SOF cache alias helpers in the kernel code. Part of #11517 (step 2).

Changes

  • cache_to_uncache() → sys_cache_uncached_ptr_get() in the telemetry and IPC code.
  • is_cached() → sys_cache_is_ptr_cached() in the IDC message asserts, and is_cached() is removed: it has no other users.

Why this is the same on cAVS

On ACE, cache_to_uncache() was already an alias of sys_cache_uncached_ptr_get(). On cAVS, SOF cleared address bit 29 itself. Zephyr now supports the cAVS memory aliases too (CONFIG_CACHE_HAS_MIRRORED_MEMORY_REGIONS), with cached and uncached regions 5 and 4, which only differ in that bit, so it computes the same address. is_cached() tested address bit 29, while Zephyr tests that the address is in the cached region; for the SRAM addresses of the IDC messages the two agree.

Not in this PR

User code, including the platform mailbox helpers and coherent.h, keeps the SOF helpers, so their cAVS implementation stays for now.

Functional change

None.

Testing

Tested as a stack of the four Wave D PRs on main 73a7797 (this PR does not depend on the others):

  • Builds: every commit built incrementally and the tip from scratch, for tgl, tgl-h, mtl, lnl, ptl, wcl, nvl, nvl-s, imx8, imx8x, imx8m, imx8m_cm7, imx8ulp, imx93, imx95, qemu_xtensa, qemu_xtensa_mmu, native_sim, and the PTL userspace, LL-userspace and LLEXT, MTL LLEXT, TGL/PTL debug-stream and TGL/MTL/LNL/PTL CI overlay configurations.
  • Objects: every object hashed with the debug sections stripped and compared commit by commit. No object changes, apart from the objects that embed the git version: the cAVS (TGL) code is identical too.
  • Platforms that already fail on main (acp_6_0, acp_7_0, acp_7_x, mt8186, mt8188, mt8195, mt8196, mt8365, phyboard): same error sets, and the same header dependencies.
  • Cadence xt-clang: MTL, PTL and NVL compile.
  • Host: the host library builds, and ZTest passes 38 of 38, run as in CI.
  • checkpatch: one note, a line ending with ( in telemetry.c, which was already there.

🤖 Generated with Claude Code

Kernel code uses the native Zephyr API. cache_to_uncache() and
is_cached() are SOF helpers for the cached and uncached aliases of the
Intel ADSP memory. On ACE, cache_to_uncache() is already an alias of
sys_cache_uncached_ptr_get(). On cAVS, SOF clears address bit 29 itself,
and Zephyr now does the same: the cAVS cached and uncached regions are
5 and 4 (CONFIG_INTEL_ADSP_CACHED_REGION, _UNCACHED_REGION), which only
differ in that bit.

Call sys_cache_uncached_ptr_get() in the telemetry and IPC code, and
sys_cache_is_ptr_cached() in the IDC message asserts. is_cached() tested
address bit 29; Zephyr tests that the address is in the cached region,
which is the same for the SRAM addresses of the IDC messages. Remove
is_cached(), which has no other users.

The user code, including the platform mailbox helpers, keeps the SOF
helpers.

No functional change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
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.

2 participants