-
Notifications
You must be signed in to change notification settings - Fork 925
AIA: Implement Smaia/Ssaia extension #1635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
62c78b2
to
88d616f
Compare
a9a619e
to
a379dd1
Compare
2354478
to
ae57784
Compare
2a56593
to
75b448e
Compare
4d594ea
to
88c443c
Compare
4f0b843
to
9e02c6d
Compare
All bytes of the supervisor-level iprio array are read-only 0s, and stopi.IPRIO is always 1 whenever stopi is not 0.
…and hviprio2h CSRs)
AIA introduces the concept of inaccessible CSR, where accessing from M-mode or HS-mode raises an illegal instruction exception, but doing so from VS-mode or VU-mode raises a virtual instruction exception. Without IMSIC, mtopei and stopei do not exist. In contrast, vstopei is an inaccessible CSR even without IMSIC, i.e., exits and is HS-qualified. In summary, accessing stopei from M-mode or HS-mode (v=0) raises illegal instruction, and accessing stopei (actually vstopei) from VS-mode or VU-mode (v=1) raises virtual instruction.
The pair hvictl.IID=9 and hvictl.IPRIO=0 generally represent no interrupt in hvictl. While zeroing also signifies no interrupt, this intermediate commit in the AIA series aims to explicitly state the absence of an interrupt condition to prevent confusion in subsequent intermediate commits.
…al_permission_csr_t
… or siph) from VS-mode when hvictl.VTI=1
…ph) from VS-mode when hvictl.VTI=1
If hvictl.VTI=0, vstopi returns information about the highest-priority pending-and-enabled major interrupt indicated by vsip and vsie. If hvictl.VTI=1, vstopi return information about a supervisor extenal interrupt if bit 9 is one in both vsip and vsie.
If hvictl.VTI=1, there are two interrupt candidates for VS level. One is a supervisor extenal interrupt if bit 9 is one in both vsip and vsie. The other one is specified by hvictl.IID if hvictl.IID is not 9. The hvictl.DPR determines the priority order between two interrupts.
If hvictl.IPRIOM=1, vstopi.IPRIO indicates the priority of the highest-priority interrupt if vstopi is nonzero. For a supervisor external interrupt, vstopi.IPRIO is hvictl.IPRIO if hvictl.IID=9 and hvictl.IPRIO!=0; otherwise, vstopi.IPRIO is 255. For other interrupts under hvictl.VTI=1, vstopi.IPRIO is 0 if hvictl.iprio=0 and hvictl.dpr=0; vstopi.IPRIO is hvictl.iprio if hvictl.iprio!=0; vstopi.IPRIO is 255 if hvictl.iprio=0 and hvictl.dpr=1. For other interrupts under hvictl.VTI=0, vstopi.IPRIO is 255 (lowest priority). That is because other interrupts have the same priority value 0 due to hviprio1=hviprio2=0. In other words, the hvictl.IPRIO of other interrupts is determined by the default priority, which is lower than the SEI with the lowest priority value 255.
… in mideleg remain 0s (interrupt filtering) The modification is backward compatible because mvien is implicitly 0 without AIA.
An interrupt is pending at VS level if and only if vstopi is not 0. The modification is backward compatible because hvictl is implicitly 0 without AIA.
… hviprio[12](h), and supervisor-level iprio array
…, (v)sieh, hidelegh, and hviph
@aswaterman @jerryz123 It has been months. I give this PR a rebase. Can someone review this PR? |
The CI shows some issues with the jtag scan and fetching registers. I need help understanding the message. |
I don’t have time to do a good job reviewing such a large PR this week. I’d like to help, but it might be a while before I can spare the time. |
Hi @YenHaoChen, |
Yes. Please do any thing you want with this PR. I am no longer on this project. |
This PR aims to provide a minimal required (recommended) implementation for the AIA extension. There is no APLIC/IMSIC device in this PR. The hstatus.VGEIN is read-only 0. The ipiro arrays and hviprio1/hviprio2 are also read-only 0. The AIA specification allows these behaviors. Nevertheless, I am willing to provide enhancements for these features if desired.