-
Notifications
You must be signed in to change notification settings - Fork 41
Description
Context
Controlling a machine engaged with rollups involves reading and writing to a bunch of different machine CSRs. The introduction of the send_cmio_response
simplified, but it is still complicated.
run
now returns the break_reason
, which simplifies it further. But now there are unnecessary redundancies that may cause confusion.
Possible solutions
At the moment, iflags
has fields PRV
and the X
, Y
, and H
flags.
PRV
really is something internal that the host should never mess with (the current machine privilege level).
Let's promote iflags.PRV
to its own full CSR iprv
. This will simplify the state-access implementations, since they won't have to do field manipulation there anymore.
X
, Y
, and H
, on the other hand, are things the host needs to look at and, in the case of Y
, change.
There is never a case in which more than one of these flags is set. They are always set via HTIF from the inside.
In the case of X
and Y
, the host will also need to look into htif.tohost
. This is because htif.tohost
contains the reason
for the yield and the amount of data written to tx_buffer
.
X
is set when the machine returns from an automatic yield. Let's remove X
altogether, since the machine run
already returns this as a break reason and X
is cleared automatically.
Y
when it returns from a manual yield.
H
when it is permanently halted.
Let's relocate Y
and H
to htif.tohost
. With some reorganization there, we can make this happen.
(This will also simplify HTIF implementation, since it won't need to change the iflags register anymore.)
Let's rename Y
to YM
to make the distinction obvious. It's not a generic yield flag, but rather a Manual Yield flag.
Perhaps we can be smart and use the device+cmd
fields together as "the flag", with a few changes to make them uniquely identify the halt and the manual yields.
There already are many WARL
CSRs that prevent certain bits from being changed.
htif.tohost
would be one of these. If H
is set, it would remain set forever. I think we can even use a write to htif.fromhost
to clear YM
, saving the need to modify htif.tohost
when returning from a manual yield.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status