riscv-isa-manual icon indicating copy to clipboard operation
riscv-isa-manual copied to clipboard

Add draft of RNMI spec

Open aswaterman opened this issue 3 years ago • 6 comments

This isn't yet complete, and in particular the inability to directly manipulate the rnmie bit may be a deficiency. (As it stands, it's impossible to perform the standard pattern of save state; enable interrupts; do something; disable interrupts; restore state. The open question is whether or not this is important to provide for RNMIs, vs. always requiring RNMI handlers to execute with RNMIs masked.)

aswaterman avatar Nov 09 '21 02:11 aswaterman

Does the RNMI handlre have to be able to distinguish between U and VU, S andd VS modes (which would require 3bits of mode), or can the V bit just be retained from the source of the interrupt? This leaves unsaid wheter all the other bit in mstatus woud just be used by nmstatus.

Also, you say "Traps in the RNMI handler can only be resumed if they occur while the handler was servicing an interrupt that occurred outside of machine-mode." which could ve interpreted as "Traps in the RNMI handler can only be resumed if they occur while the handler was servicing *(*an interrupt that occurred outside of machine-mode )." or "Traps in the RNMI handler can only be resumed if *(*they occur while the handler was servicing an interrupt that occurred) outside of machine-mode)."

The former sound more obvious,( and grammatica)l, but you have to think a bit to determine whether the exception source was outside of machine mode, or that the handler is outside of machine mode. It's kind of a long sentence, and breaking it up may make it more clear.

On Mon, Nov 8, 2021 at 6:41 PM Andrew Waterman @.***> wrote:

This isn't yet complete, and in particular the inability to directly manipulate the rnmie bit may be a deficiency. (As it stands, it's impossible to perform the standard pattern of save state; enable interrupts; do something; disable interrupts; restore state. The open question is whether or not this is important to provide for RNMIs, vs. always requiring RNMI handlers to execute with RNMIs masked.)

You can view, comment on, or merge this pull request online at:

https://github.com/riscv/riscv-isa-manual/pull/766 Commit Summary

File Changes

(5 files https://github.com/riscv/riscv-isa-manual/pull/766/files)

Patch Links:

  • https://github.com/riscv/riscv-isa-manual/pull/766.patch
  • https://github.com/riscv/riscv-isa-manual/pull/766.diff

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/riscv/riscv-isa-manual/pull/766, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHPXVJT24OA7O3N6RFEJEDDULCC7FANCNFSM5HUFXGJQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

allenjbaum avatar Nov 09 '21 06:11 allenjbaum

@allenjbaum This spec is indeed missing an mnstatus.MPV field (it was written not considering the H extension).

aswaterman avatar Nov 09 '21 06:11 aswaterman

It isn't clear to me that it needs it; that was part of the question. RNMI transitions to M-mode, it can see HSTATUS.SPV and night use that. unless mstatus delegates. I'm not clear if that can work or not, as I don't understand the delegation rules for hypervisor mode.

On Mon, Nov 8, 2021 at 10:18 PM Andrew Waterman @.***> wrote:

@allenjbaum https://github.com/allenjbaum This spec is indeed missing an mnstatus.MPV field (it was written not considering the H extension).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/riscv/riscv-isa-manual/pull/766#issuecomment-963849651, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHPXVJXU4EWHODOYP253BKTULC4LBANCNFSM5HUFXGJQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

allenjbaum avatar Nov 09 '21 15:11 allenjbaum

It is needed; using hstatus.SPV doesn't work, either, because the NMI might occur during HS-mode trap entry, before the hypervisor has had a chance to save that field.

aswaterman avatar Nov 09 '21 19:11 aswaterman

Is mnstatus.NMIE a global enable or a local enable for purposes of deciding whether a WFI is allowed to sleep?

pdonahue-ventana avatar May 24 '22 00:05 pdonahue-ventana

It's meant to be analogous to mstatus.MIE (i.e., global).

aswaterman avatar May 24 '22 00:05 aswaterman

Manually merged via https://github.com/riscv/riscv-isa-manual/commit/869dcc608e11f9680e950bcb20a9b8294d2b82bd

aswaterman avatar Oct 05 '22 23:10 aswaterman