Repository navigation
Conversation
lgirdwood
force-pushed
the
topic/zn-rtos-cache-shared
branch
from
December 3, 2026 12:08
274d0fa to
3f05bf2
Compare
On Zephyr, rtos/panic.h includes <zephyr/kernel.h>, so code that includes it for assert() also gets __ASSERT() and __ASSERT_NO_MSG(). Include the <zephyr/sys/__assert.h> stub from the host rtos/panic.h, so that shared code can switch to the Zephyr macros without new includes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
On Zephyr, assert() is defined as __ASSERT_NO_MSG(). The host builds now have the Zephyr assert macros too, so use __ASSERT_NO_MSG() directly in the audio code. No lines are added or removed, so __LINE__ in verbose asserts does not change. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
On Zephyr, assert() is defined as __ASSERT_NO_MSG(). The host builds now have the Zephyr assert macros too, so use __ASSERT_NO_MSG() directly in the shared headers. No lines are added or removed, so __LINE__ in verbose asserts does not change. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
On Zephyr, assert() is defined as __ASSERT_NO_MSG(). The host builds now have the Zephyr assert macros too, so use __ASSERT_NO_MSG() directly in the IPC code. No lines are added or removed, so __LINE__ in verbose asserts does not change. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
On Zephyr, assert() is defined as __ASSERT_NO_MSG(). The host builds now have the Zephyr assert macros too, so use __ASSERT_NO_MSG() directly in the library, DMA driver and sample code. No lines are added or removed, so __LINE__ in verbose asserts does not change. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The coherent API debug check macros still used assert(): the address alias and core checks, and the host versions of the sleep and atomic context checks. Use __ASSERT_NO_MSG() like the rest of the header. The Zephyr and host versions of the context checks stay separate, so that no lines move and __LINE__ in verbose asserts does not change. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
On Zephyr, rtos/cache.h includes <zephyr/cache.h>, so code that includes it for the SOF cache wrappers can also call the Zephyr cache API. Include the <zephyr/cache.h> stub from the host rtos/cache.h too, so that shared code can switch to the Zephyr calls without new includes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
dcache_writeback_region(), dcache_invalidate_region() and dcache_writeback_invalidate_region() are inline wrappers of sys_cache_data_flush_range(), sys_cache_data_invd_range() and sys_cache_data_flush_and_invd_range(). The host builds have a <zephyr/cache.h> stub now, so call the Zephyr functions directly in the coherent API and the audio buffers. The coherent API and the ring buffer pass real __sparse_cache pointers, which get a __sparse_force cast. The other callers cast their pointers to __sparse_cache only to match the wrapper prototypes; that cast becomes a plain (void *). The ring buffer wrap-around calls no longer fit on two lines, so they compute the length of the first part once. That also fixes a comment that said "writeback" in the invalidate function. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Call sys_cache_data_flush_range() and sys_cache_data_invd_range() directly instead of the SOF dcache_writeback_region() and dcache_invalidate_region() wrappers in the remaining shared code: the mailbox, the IPC handlers and logging, the IPC gateway copier, the module adapter, the notifier, the dummy DMA driver and the host library memory map. The callers cast their pointers to __sparse_cache only to match the wrapper prototypes; that cast becomes a plain (void *). No lines are added or removed. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
lgirdwood
force-pushed
the
topic/zn-rtos-cache-shared
branch
from
December 4, 2026 13:08
3f05bf2 to
3c33c5b
Compare
Member
Author
|
Lets reflow this after #11597 is merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Call the Zephyr cache API directly in the shared code. Part of #11517 (step 2). Depends on #11597 (they touch the same mailbox lines); the first six commits here are that PR. It uses the host
<zephyr/cache.h>stub from #11583.dcache_writeback_region(),dcache_invalidate_region()anddcache_writeback_invalidate_region()are inline wrappers ofsys_cache_data_flush_range(),sys_cache_data_invd_range()andsys_cache_data_flush_and_invd_range(). The kernel-only callers switch in #11571; this PR switches the code that also builds on the host.Patches
posix: the hostrtos/cache.hincludes the<zephyr/cache.h>stub, as Zephyr'srtos/cache.hdoes, so callers need no new includes.audio, coherent: the coherent API and the audio buffers (audio_stream.h,comp_buffer.c,ring_buffer.c).__sparse_cachepointers, which get a__sparse_forcecast.treewide: the mailbox, the IPC handlers and logging, the IPC gateway copier, the module adapter, the notifier, the dummy DMA driver and the host library memory map. No lines are added or removed.Callers that cast their pointers to
__sparse_cacheonly to match the wrapper prototypes now cast to a plain(void *).Not in this PR
uncache_to_cache()and friends: on cAVS they use their own address alias arithmetic.Functional change
None. With one inline function less, GCC allocates registers and lays out branches differently in some callers.
Testing
coherent.handaudio_stream.h. The PTL disassembly was compared function by function: register allocation and branch layout differ, and the ring buffer computes its wrap-around length once (4 instructions fewer inring_buffer_commit_buffer()andring_buffer_get_data()).host-testbench.sh) pass all 19 component tests.🤖 Generated with Claude Code