lowRISC / opentitan

OpenTitan: Open source silicon root of trust
https://www.opentitan.org
Apache License 2.0
2.56k stars 764 forks source link

[rv_timer] Align interrupt behavior with privileged spec #18918

Open a-will opened 1 year ago

a-will commented 1 year ago

Description

The interrupt currently is cleared for any write to mtimecmp, but this was a misinterpretation of the spec. Ensure the interrupt is asserted as long as mtime is greater than or equal to mtimecmp, with no glitching.

While implementing this change, take advantage of the expanded interrupt capabilities, and convert the rv_timer interrupt to the Status type to avoid awkward latching behavior.

From https://github.com/lowRISC/opentitan/issues/18400#issuecomment-1590249373

a-will commented 1 year ago

Without this fix, software will likely need to ensure the interrupts are not enabled while modifying mtimecmp (to avoid spurious interrupts while performing the multiple writes to update the value).

msfschaffner commented 1 year ago

CC @GregAC @rswarbrick

We may want to align this with the spec for PROD.

andreaskurth commented 6 months ago

Assigning @GregAC to please take a look and propose a resolution -- feel free to delegate the implementation ofc

vogelpi commented 4 months ago

Moving to Backlog.