Skip to content

Conversation

AFOliveira
Copy link
Contributor

@AFOliveira AFOliveira commented Oct 14, 2025

Add support for the RISC-V Smcsrind extension, which provides access to iCSRs through the MISELECT and MIREG registers.

Changes:

  • Added CONFIG_RISCV_ISA_EXT_SMCSRIND Kconfig option
  • Implemented 4 helper functions for indirect CSR access:
    • csr_indirect_read/write - basic access
    • csr_indirect_set/clear - bit manipulation
  • Defined 7 CSR registers (MISELECT, MIREG, MIREG2-6)

This is a CSR-only extension that does not require any compiler support or march flags. The helper functions compile to standard CSR instructions and work with any toolchain that supports Zicsr.

Primary use case: RISC-V AIA (Advanced Interrupt Architecture) uses indirect CSRs to access IMSIC (Incoming MSI Controller) registers. Relates to upstreaming AIA as described in #82487.

Add support for the RISC-V Smcsrind extension, which provides
indirect access to CSRs through the MISELECT and MIREG registers.

Changes:
- Added CONFIG_RISCV_ISA_EXT_SMCSRIND Kconfig option
- Implemented 4 helper functions for indirect CSR access:
  * icsr_read/write - basic access
  * icsr_read_set/clear - bit manipulation
- Defined 7 CSR registers (MISELECT, MIREG, MIREG2-6)

This is a CSR-only extension that does not require any compiler
support or march flags. The helper functions compile to standard
CSR instructions and work with any toolchain that supports Zicsr.

Primary use case: RISC-V AIA (Advanced Interrupt Architecture)
uses indirect CSRs to access IMSIC (Incoming MSI Controller)
registers.

Signed-off-by: Afonso Oliveira <[email protected]>
@AFOliveira
Copy link
Contributor Author

Thanks for the review @ruuddw. All the changes requested are addressed!

@AFOliveira AFOliveira requested a review from ruuddw October 16, 2025 17:53
@sonarqubecloud
Copy link

@AFOliveira
Copy link
Contributor Author

@kgugala @fkokosinski @tgorochowik Just a friendly ping :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Architectures area: RISCV RISCV Architecture (32-bit & 64-bit)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants