change(cache): split stop/start (suspend) from freeze/unfreeze#116
Draft
erhankur wants to merge 1 commit into
Draft
change(cache): split stop/start (suspend) from freeze/unfreeze#116erhankur wants to merge 1 commit into
erhankur wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR separates cache “stop/start” (suspend/resume semantics that may preserve/restore autoload state) from “freeze/unfreeze” (pipeline freeze semantics), and updates MMU mapping code to use freeze/unfreeze to avoid ROM freeze-disable hangs when the cache pipeline is still busy.
Changes:
- Add new public/internal APIs:
stub_*_cache_freeze()/stub_*_cache_unfreeze()with a weak fallback to stop/start. - Update several RISC-V targets (c2/c3/c5/c6/c61/h2/h21/h4) to use ROM
Cache_Suspend_*/Cache_Resume_*for stop/start and to drain AUTOLOAD/PRELOAD before unfreezing. - Switch
src/mmu.cto use freeze/unfreeze around temporary MMU remaps.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/target/esp32h4/src/cache.c | Stop/start now uses ROM suspend/resume; adds explicit freeze/unfreeze and drains autoload/preload before unfreeze. |
| src/target/esp32h4/include/soc/cache_reg.h | Adds AUTOLOAD_DONE and PRELOAD_* register/bit definitions used by the new drain logic. |
| src/target/esp32h21/src/cache.c | Stop/start now uses ROM suspend/resume; adds freeze/unfreeze and drains autoload/preload before unfreeze. |
| src/target/esp32h21/include/soc/cache_reg.h | Adds AUTOLOAD_DONE/PRELOAD_DONE bit definitions for drain logic. |
| src/target/esp32h2/src/cache.c | Stop/start now uses ROM suspend/resume; adds freeze/unfreeze and drains autoload/preload before unfreeze. |
| src/target/esp32h2/include/soc/ext_mem_reg.h | Adds EXTMEM preload/autoload DONE bits/register definitions for drain logic. |
| src/target/esp32c61/src/cache.c | Stop/start now uses ROM suspend/resume; adds freeze/unfreeze and drains autoload/preload before unfreeze. |
| src/target/esp32c61/include/soc/cache_reg.h | Adds AUTOLOAD_DONE/PRELOAD_DONE definitions for drain logic. |
| src/target/esp32c6/src/cache.c | Stop/start now uses ROM suspend/resume; adds freeze/unfreeze and drains autoload/preload before unfreeze. |
| src/target/esp32c6/include/soc/ext_mem_reg.h | Adds EXTMEM preload/autoload DONE bits/register definitions for drain logic. |
| src/target/esp32c5/src/cache.c | Stop/start now uses ROM suspend/resume; adds freeze/unfreeze and drains autoload/preload before unfreeze. |
| src/target/esp32c5/include/soc/cache_reg.h | Adds AUTOLOAD_DONE/PRELOAD_DONE definitions for drain logic. |
| src/target/esp32c3/src/cache.c | Stop/start now uses ROM suspend/resume; adds freeze/unfreeze and drains autoload/preload before unfreeze. |
| src/target/esp32c3/include/soc/ext_mem_reg.h | Adds ICACHE autoload/preload DONE definitions for drain logic. |
| src/target/esp32c2/src/cache.c | Stop/start now uses ROM suspend/resume; adds freeze/unfreeze but skips autoload/preload drain. |
| src/target/common/src/cache.c | Adds weak default implementations of freeze/unfreeze that fall back to stop/start. |
| src/target/base/include/target/cache.h | Extends internal target cache API with freeze/unfreeze declarations. |
| src/mmu.c | Uses cache freeze/unfreeze instead of stop/start during temporary MMU remaps. |
| src/cache.c | Adds public wrappers stub_lib_cache_freeze/unfreeze(). |
| include/esp-stub-lib/cache.h | Adds public declarations/docs for stub_lib_cache_freeze/unfreeze(). |
| example/stub_main.c | Adds simple smoke calls for the new cache freeze/unfreeze API. |
Collaborator
|
seems like this can explain the random-looking issues we had with c5, thanks for figuring this out @erhankur ! Could you add a comment on when to use stop/start (suspend/resume) and when freeze/unfreeze instead? |
39518b9 to
2986e8e
Compare
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.
No description provided.