-
Notifications
You must be signed in to change notification settings - Fork 53
Smivt: Including minor interrupt identity in HW-vectoring scenarios #635
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
Open
christian-herber-nxp
wants to merge
1
commit into
master
Choose a base branch
from
634-mcause-should-latch-the-major-and-minor-interrupt-id-in-case-of-a-vectored-interrupt
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,6 +66,7 @@ Graphics used are either explicitly available for free, are property of RISC-V I | |
| :scratchcswl: pass:q[``**__x__**scratchcswl``] | ||
| :epc: pass:q[``**__x__**epc``] | ||
| :cause: pass:q[``**__x__**cause``] | ||
| :xcause: pass:q[``xcause``] | ||
| :tval: pass:q[``**__x__**tval``] | ||
| :ip: pass:q[``**__x__**ip``] | ||
| :pistatus: pass:q[``**__x__**pistatus``] | ||
|
|
@@ -804,13 +805,15 @@ and then jumps to the masked address. | |
|
|
||
| [source] | ||
| ---- | ||
| Number Name Description | ||
| 0x305 mtvec M-mode Trap-handler base address / interrupt mode | ||
| (NEW) 0x307 mivt M-mode Interrupt-handler vector table base address | ||
| (NEW) 0x308 meivt M-mode External Interrupt-handler vector table base address | ||
| 0x105 stvec S-mode Trap-handler base address / interrupt mode | ||
| (NEW) 0x107 sivt S-mode Interrupt-handler vector table base address | ||
| (NEW) 0x108 seivt S-mode External Interrupt-handler vector table base address | ||
| Number Name Description | ||
| 0x342 mcause M-mode trap cause register | ||
| 0x305 mtvec M-mode Trap-handler base address / interrupt mode | ||
| (NEW) 0x307 mivt M-mode Interrupt-handler vector table base address | ||
| (NEW) 0x308 meivt M-mode External Interrupt-handler vector table base address | ||
| 0x142 scause M-mode trap cause register | ||
| 0x105 stvec S-mode Trap-handler base address / interrupt mode | ||
| (NEW) 0x107 sivt S-mode Interrupt-handler vector table base address | ||
| (NEW) 0x108 seivt S-mode External Interrupt-handler vector table base address | ||
| ---- | ||
|
|
||
| ==== New {xivt} and {xeivt} CSR | ||
|
|
@@ -839,7 +842,57 @@ Interrupt vector table mode is encoded as a new state in the | |
| existing {xtvec} WARL register, where {xtvec}.`mode` (the two | ||
| least-significant bits) is `11`. | ||
|
|
||
| ==== Smivt Changes to {xtvec} CSR Mode | ||
| ==== Changes to {xcause} CSR Exception Code | ||
|
|
||
| When taking a trap on an external interrupt, | ||
| it is important to capture the identity of the interrupt. | ||
| In interrupt vector table mode, | ||
| the exception code field is changed as follows: | ||
|
|
||
| The exception code field of {xcause} is changed to hold the Major and Minor Interrupt Identities. | ||
|
|
||
| NOTE: While a HW-vectored handler will typically only make use of the minor identity, | ||
| an OS may want to handle several interrupts with a common trampoline, | ||
| and therefore needs to know the major identity as well. | ||
|
|
||
| The major identity is held in bits 15:0 of the exception code field, | ||
| while the minor identity is held in bits XLEN-1:16 of the exception code field. | ||
| Together, the two identities form the full exception code, which is a WLRL field. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. needs to specify value of minor identity for major interrupts that are not external |
||
|
|
||
| The resulting format of {xcause} is as follows: | ||
|
|
||
| [bytefield] | ||
| ---- | ||
| (defattrs :plain [:plain {:font-family "M+ 1p Fallback" :font-size 24}]) | ||
| (def row-height 40) | ||
| (def row-header-fn nil) | ||
| (def left-margin 200) | ||
| (def right-margin 200) | ||
| (def boxes-per-row 32) | ||
|
|
||
| ;; ───────────────────────────────────────── | ||
| ;; Top row: Field boundaries (labels only) | ||
| ;; Boundaries at: XLEN-1 | 16 | 0 | ||
| (draw-box "XLEN-1" {:span 4 :borders {}}) | ||
| (draw-box "16" {:span 14 :borders {} :text-anchor "end"}) | ||
| (draw-box "0" {:span 14 :borders {} :text-anchor "end"}) | ||
|
|
||
| ;; ───────────────────────────────────────── | ||
| ;; Middle row: Field names | ||
| ;; Fields: Interrupt | Minor Interrupt Identity (WLRL) | Major Interrupt Identity (WLRL) | ||
| (draw-box "Interrupt" {:span 4}) | ||
| (draw-box "Minor Interrupt Identity (WLRL)" {:span 14 :text-anchor "middle"}) | ||
| (draw-box "Major Interrupt Identity (WLRL)" {:span 14 :text-anchor "middle"}) | ||
|
|
||
| ;; ───────────────────────────────────────── | ||
| ;; Bottom row: Field widths | ||
| ;; Widths: 1 | XLEN-17 | 16 | ||
| (draw-box "1" {:span 4 :borders {}}) | ||
| (draw-box "XLEN-17" {:span 14 :borders {} :text-anchor "middle"}) | ||
| (draw-box "16" {:span 14 :borders {} :text-anchor "middle"}) | ||
| ---- | ||
|
|
||
| ==== Changes to {xtvec} CSR Mode | ||
|
|
||
| The PC upon interrupt is changed as follows: | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restrict change to xtvec.mode = ivt