Closed yichanfeng closed 1 year ago
@yichanfeng, I do not understand the scenario you describe. Software doesn't know what the external interrupt is until it reads *topei
(which it should also write at the same time to claim the interrupt). Only by reading *topei
does software learn the priority of the interrupt. So, what is this?:
If a hart asks IMSIC for the interrupt arbitration, leading a trap handler to a lower priority interrupt handling (e.g. IID=4)
I don't recognize that step, which you say precedes reading *topei
to claim the interrupt.
@jhauser-us Thanks for your reply.
Yes, SW doesn't know what the external interrupt is until it reads *topei.
I am asking if HW needs to retain the older value of non-zero *topei until SW reads its value in the trap handler when the following scenario occurs.
Your example is correct. A read of a *topi
or *topei
CSR always returns the most recent information available.
@jhauser-us
Thanks for your reply.
Hi @jhauser-us! I also have a question about topei. What should the expected or suggested behavior be when we read/write the topei while eidelivery=0? Should it assume that there are no valid external interrupts when eidelivery=0, causing the IMSIC to ignore the topei access and only read it as 0? Or should it retain its original behavior, allowing harts to read/write the topei, clean the highest priority eip pending bit, and only prevent the *EIP from being sent to harts?
An interrupt file's eidelivery
register has no effect on a *topei
register. See new issues #56 and #57.
Note the similarity also with what the AIA spec says about the *topi
CSRs:
The value of
mtopi
is not affected by the global interrupt enable MIE in CSRmstatus
.The value of
stopi
is not affected by the global interrupt enable SIE in CSRsstatus
.
@jhauser-us Thanks!
Hi,
I have one question about the *topei.
If a hart asks IMSIC for the interrupt arbitration, leading a trap handler to a lower priority interrupt handling (e.g. IID=4), the following scenario may occur:
A new MSI with the higher priority (e.g., ID = 1 has higher priority than previous *topei.IID = 4) updates the interrupt file of IMSIC before the software read the *topei and claim the interrupt in the trap handler.
What is the expected/suggested behavior (return the latest *topei with IID = 1 or return the served *topei with IID = 4)?
Thanks!