Skip to content

Conversation

@kv2019i
Copy link
Collaborator

@kv2019i kv2019i commented Sep 24, 2025

Use Zephyr native cache interface instead of legacy rtos/cache.h. This ensures audio code is using interfaces that supports use from user-space (if enabled at build time).

Copilot AI review requested due to automatic review settings September 24, 2025 18:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the audio subsystem to use Zephyr's native cache interface instead of the legacy rtos/cache.h. This change ensures the audio code can work in user-space contexts when enabled at build time.

Key changes include:

  • Replacing legacy dcache_* functions with sys_cache_data_* equivalents
  • Updating header includes to use zephyr/cache.h instead of rtos/cache.h
  • Converting dcache_writeback_region to sys_cache_data_flush_range and dcache_invalidate_region to sys_cache_data_invd_range

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/include/sof/audio/audio_stream.h Updates cache writeback calls in audio_stream_writeback function
src/audio/copier/copier_ipcgtw.c Adds zephyr/cache.h include and converts cache invalidate calls
src/audio/buffers/ring_buffer.c Adds zephyr/cache.h include and updates all cache operations in ring buffer functions
src/audio/buffers/comp_buffer.c Replaces rtos/cache.h with zephyr/cache.h and updates buffer_zero function

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

dcache_writeback_region((__sparse_force void __sparse_cache *)buffer->addr,
tail_size);
sys_cache_data_flush_range((__sparse_force void __sparse_cache *)buffer->addr,
tail_size);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we replace "rtos/cache.h" in this file too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

D'oh, missed that. V2 uploaded to fix this.

Use Zephyr native cache interface instead of legacy rtos/cache.h.
This ensures audio code is using interfaces that supports use from
user-space (if enabled at build time).

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
@kv2019i kv2019i force-pushed the 202509-audio-zcache branch from 059f903 to b8e2456 Compare September 25, 2025 09:24
Copy link
Contributor

@tmleman tmleman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kv2019i kv2019i merged commit f78acf4 into thesofproject:main Sep 26, 2025
28 of 45 checks passed
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.

5 participants