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

cp15: optimize CP15_CleanAndFlushDCache #146

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

Conversation

asiekierka
Copy link
Contributor

@asiekierka asiekierka commented Nov 28, 2024

Appears to save up to ~5-6%. Can be benchmarked with https://github.com/asiekierka/nds-misc-tests/tree/main/cached-memory-performance

Not sure if this routine should be in ITCM or not, haven't tested the consequences - likewise the cache.c equivalent.

@asiekierka asiekierka force-pushed the feature/flush-dcache-optimize branch from c2c9977 to d5005f6 Compare November 28, 2024 21:30
source/arm9/system/cp15.s Outdated Show resolved Hide resolved
@asiekierka asiekierka force-pushed the feature/flush-dcache-optimize branch from d5005f6 to cea9891 Compare November 28, 2024 23:35
@lifehackerhansol
Copy link
Contributor

Sorry for hijacking the PR a bit; apparently the behaviour of the write buffer drain is wrong, according to section 4.8 of ARM946-PRDC-000592 5.0

From that doc it seems the drain should happen immediately before every flush in inner_loop.

Figured it'd be worth pinging here as the function in question is being modified in this PR.

@profi200
Copy link

The document is not exactly clear on whenever this is needed for both range and full cache operations. The examples only show the address variants (used in range flush). In this PR only the full cache flush got modified.

@asiekierka asiekierka force-pushed the feature/flush-dcache-optimize branch from 2c72431 to 01594b4 Compare November 29, 2024 20:22
@asiekierka asiekierka changed the title cp15: optimize CP15_CleanAndFlushDCache cp15: fix CP15_CleanAndFlushDCache errata Nov 29, 2024
@asiekierka asiekierka changed the title cp15: fix CP15_CleanAndFlushDCache errata cp15: optimize CP15_CleanAndFlushDCache Nov 29, 2024
@asiekierka asiekierka force-pushed the feature/flush-dcache-optimize branch from cea9891 to 0674f62 Compare November 29, 2024 21:07
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.

3 participants