Skip to content

RISC-V: architecture lacks cache management implementation #93708

@AFOliveira

Description

@AFOliveira

Is your feature request related to a problem? Please describe.

RISC-V architecture in Zephyr does not provide implementations for cache management functions (arch_dcache_, arch_icache_), causing build failures when boards declare cache support via CONFIG_CPU_HAS_ICACHE/CONFIG_CPU_HAS_DCACHE and tests attempt to use cache management APIs.

Describe the solution you'd like

Implement RISC-V cache management functions. RISC-V has standardized cache management through the Zicbom (Cache Block Management Operations) extension, which provides instructions like:

cbo.clean - Clean cache line
cbo.flush - Flush cache line
cbo.inval - Invalidate cache line

The implementation would need to:

Create arch/riscv/core/cache.c (or add inline implementations to headers)
Implement all required arch_cache_ functions
Use Zicbom instructions where available, with appropriate feature detection
Handle cases where Zicbom is not available

Describe alternatives you've considered

No response

Metadata

Metadata

Labels

Feature RequestA request for a new featurearea: RISCVRISCV Architecture (32-bit & 64-bit)

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions