Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] Add aarch64 and riscv dcache manage #210

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ZR233
Copy link
Contributor

@ZR233 ZR233 commented Dec 9, 2024

Add dcache invalidate flush api.

@equation314
Copy link
Member

Currently flush_dcache_line and flush_icache_all have been implemented in axhal/src/arch/aarch64/mod.rs.

Could you abstract a unified set of icache and dcache management APIs? And clarify the difference between flush and invalidate.

For example, these APIs might be like:

  • flush_dcache_line(op, addr)
  • flush_dcache_range(op, start, end)
  • flush_dcache_all(op)
  • flush_icache_line(op, addr)
  • flush_icache_range(op, start, end)
  • flush_icache_all(op)

Where op is one of Clean/Invalidate/CleanAndInvalidate.

@ZR233 ZR233 force-pushed the dcache branch 2 times, most recently from 9ecbac3 to ff2d468 Compare January 2, 2025 08:13
modules/axhal/src/arch/aarch64/cache.rs Outdated Show resolved Hide resolved
/// Performs a cache operation on a cache level.
/// https://developer.arm.com/documentation/ddi0601/2024-12/AArch64-Instructions/DC-CISW--Data-or-unified-Cache-line-Clean-and-Invalidate-by-Set-Way
#[inline]
fn dcache_level(op: CacheOp, level: u64) {
Copy link
Member

Choose a reason for hiding this comment

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

Flushing the entire D-cache is hardly ever used, so we will not implement it to avoid this cumbersome function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

before enable mmu we need to flush all cache, or will cause error. tested on phytium.

modules/axhal/src/arch/aarch64/cache.rs Outdated Show resolved Hide resolved
@ZR233 ZR233 force-pushed the dcache branch 2 times, most recently from 135901d to 46e0bf1 Compare January 3, 2025 01:32
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