Skip to content

fix: invalidate dcache when PMP permissions change - #70

Open
KnightGOKU wants to merge 1 commit into
XUANTIE-RV:mainfrom
KnightGOKU:fix/openc910-pmp-cache-op-permission
Open

KnightGOKU wants to merge 1 commit into
XUANTIE-RV:mainfrom
KnightGOKU:fix/openc910-pmp-cache-op-permission

Conversation

@KnightGOKU

Copy link
Copy Markdown

Fixes #58

Summary

PMP permission changes can leave stale data in the D-cache and in the MCDATA registers, allowing cache-index reads to expose data that is no longer accessible through normal loads.

Changes

  • Trigger a D-cache invalidation on every PMP CSR update.
  • Clear the MCDATA0/MCDATA1 latches when PMP permissions change.
  • Allow PMP-triggered invalidation requests to be queued while the ICC state machine is busy.

Validation

Verilator block-level tests pass for:

  • PMP-triggered D-cache invalidation
  • MCDATA clearing after a PMP update
  • Invalidation requests arriving while ICC is busy

The patch is limited to the cache diagnostic and PMP-update paths. The invalidation is conservative and may flush the D-cache after each PMP CSR write.

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.

Cache-index reads can recover data after locked PMP blocks normal loads

1 participant