Skip to content
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

[XIF] Too many instructions can execute after interrupt becomes pending and enabled #325

Open
Silabs-ArjanB opened this issue Nov 22, 2021 · 7 comments
Labels
Component:RTL For issues in the RTL (e.g. for files in the rtl directory) Type:Bug For bugs in any content (RTL, Documentation, etc.)

Comments

@Silabs-ArjanB
Copy link
Contributor

Version 1.12 of the Privileged Spec states:

After execution of each instruction in program order, if the conditions
for an interrupt trap are true, the trap occurs immediately,
before another instruction executes.

The CV32E40X (and CV32E40S) break this requirement in case mip is already set and an interrupt should be taken due to enabling it via a CSR write (mip, mie, mstatus, and mideleg) or xRET.

This should become part of the VPLAN as well and should be checked with formal techniques.

Possible fixes include:

  • Stall for specific CSR write - load/store/X itf combinations (xRET is likely not an issue thanks to its pipe flush)
  • Forwarding of relevant CSR bits into the interrupt logic
@Silabs-ArjanB Silabs-ArjanB added Component:RTL For issues in the RTL (e.g. for files in the rtl directory) Type:Bug For bugs in any content (RTL, Documentation, etc.) labels Nov 22, 2021
@Silabs-ArjanB Silabs-ArjanB changed the title Too many instructions can execite after interrupt becomes pending and enabled Too many instructions can execute after interrupt becomes pending and enabled Nov 22, 2021
@eroom1966
Copy link

We managed to reproduce this exact issue when we ran a test called "corev_rand_interrupt_0.elf"
I cannot recall how this was generated, but I am presuming from cv_regress ?

@silabs-oysteink
Copy link
Contributor

Does this also apply for enabling CLIC interrupts by writes to external CLIC? Or can we for CLIC only regard core internal CSRs that directly impact the decision (thresholds and levels for instance).

@Silabs-ArjanB
Copy link
Contributor Author

This is only about internal CSRs, not about memory mapped registers (although there is a separate issue about #507 as well that relates to regular stores).

@eroom1966
Copy link

@Silabs-ArjanB are these 2 last posts questions ?
If so, who are they intended for ?

@Silabs-ArjanB
Copy link
Contributor Author

@eroom1966 The post from Øystein was a question (I assume to me as I created this issue) and I answered it in the post below his question.

silabs-oysteink added a commit to silabs-oysteink/cv32e40x that referenced this issue Aug 25, 2022
Halting EX stage if a CSR write in WB may enable interrupts and at the same time there is an LSU instruction in EX. Fix implemented for both CLIC and basic interrupt mode.

Issue can still occur when X_EXT=1. Fixing this would also need several other fixes for the X-interface.

Signed-off-by: Oystein Knauserud <[email protected]>
@silabs-oysteink
Copy link
Contributor

PR #650 addresses this issue when X_EXT=0. If not using X_EXT, this issue should now be solved for both basic and CLIC modes.

With X_EXT=1, there are several other issues that is not directly related to this that would need to be fixed in order to have a working X-interface.

Silabs-ArjanB added a commit that referenced this issue Aug 25, 2022
@Silabs-ArjanB Silabs-ArjanB changed the title Too many instructions can execute after interrupt becomes pending and enabled [XIF] Too many instructions can execute after interrupt becomes pending and enabled Aug 25, 2022
@Silabs-ArjanB
Copy link
Contributor Author

Issue has been fixed for X_EXT = 0. The issue will remain open to look at it again once we start fixing the X interface (X_EXT = 1) (and therefore its title has been prefixed with [XIF]).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component:RTL For issues in the RTL (e.g. for files in the rtl directory) Type:Bug For bugs in any content (RTL, Documentation, etc.)
Projects
None yet
Development

No branches or pull requests

3 participants