This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Implement CSR mseccfg for spec Smepmp
Needs ReviewPublic

Authored by QuarticCat on Aug 27 2021, 2:58 AM.

Details

Summary

This revision implements CSR mseccfg for RISCV according to the specification of version 0.9.4.

Diff Detail

Unit TestsFailed

Event Timeline

QuarticCat created this revision.Aug 27 2021, 2:58 AM
QuarticCat requested review of this revision.Aug 27 2021, 2:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 27 2021, 2:59 AM

Commit message is missing an m from mseccfg.

The name also concerns me, "security config" is extremely broad, so it's not clear it applies specifically to PMP things and it could get confused with other security-related extensions.

llvm/lib/Target/RISCV/RISCVSystemOperands.td
254

The definitions here are grouped in the same way that they are in the privileged spec. Is the intent that these CSRs will be part of the same group as the existing PMP registers in the table in the CSR Listings section of the spec (table 2.5 in my build from earlier this year)?

QuarticCat retitled this revision from [RISCV] Implement CSR seccfg for spec Smepmp to [RISCV] Implement CSR mseccfg for spec Smepmp.Aug 27 2021, 2:28 PM
QuarticCat edited the summary of this revision. (Show Details)
QuarticCat added inline comments.Aug 30 2021, 1:14 AM
llvm/lib/Target/RISCV/RISCVSystemOperands.td
254

I emailed Nick Kossifidis, here is the response:

Initialy mseccfg was in the same group with the rest of PMP registers (pmpcfg/pmpaddr) but later on, during review, the address was re-assigned and since it's a single allocation it doesn't belong to any of the groups on that table. I don't know if there is a plan to introduce a new group for small allocations in the future but I can ask if you want.

asb added a comment.Sep 2 2021, 5:10 AM

Only minor comment is that if the CSR isn't in the mainline privileged specification, it would be worth adding a comment in RISCVSystemOperands.td explaining where it's defined.