EDK2_00_09 - CMO support

About

A cache-block management instruction performs one of the following operations, relative to the copy of a given
cache block allocated in a given cache:
• An invalidate operation deallocates the copy of the cache block
• A clean operation performs a write transfer to another cache or to memory if the data in the copy of the
cache block have been modified by a store operation
• A flush operation atomically performs a clean operation followed by an invalidate operation

Implementation (In EDK2):

EDK2 requires several Cache Management constructs to ensure secure image loading and
other functionalities. Current RV implements fence.i based method to partly manage
such cache operations. RV international has recently added support for CMO and this
work relates to adding that to the edk2 so that RV platforms which support this functionality
can leverage it in edk2.

Adding code to support Cache Management Operations (CMO) defined by RV spec https://github.com/riscv/riscv-CMOs Notes: 1. CMO only supports block based Operations. Meaning complete cache flush/invd/clean Operations are not available 2. Current implementation uses ifence instructions but it maybe platform specific. Many platforms may not support cache Operations based on fence.i 3. For now adding CMO on top of fence.i as it is not supposed to have any adverse effect on CMO operation. 4. This requires support for GCC12.2 onwards.

Status

26-Sept:



Dependency

GCC12 (In EDK2 CI)


Development

COMPLETED

URL: https://github.com/rivosinc/edk2/tree/dev_rv_cmo_v3

Development Timeline

Q3 2023


Upstreaming

COMPLETED

URL: 

Upstream version

Contacts

Dhaval Sharma (Rivos)

Updates

  • Project reported as priority for 2H23