Page MenuHomeFreeBSD

Fix SSTC extension support
ClosedPublic

Authored by br on May 17 2024, 8:19 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 27, 1:54 AM
Unknown Object (File)
Wed, Nov 26, 6:52 PM
Unknown Object (File)
Sat, Nov 22, 3:23 PM
Unknown Object (File)
Thu, Nov 13, 12:43 AM
Unknown Object (File)
Thu, Nov 6, 6:22 AM
Unknown Object (File)
Sun, Nov 2, 2:53 AM
Unknown Object (File)
Fri, Oct 31, 4:19 PM
Unknown Object (File)
Oct 17 2025, 9:00 PM
Subscribers

Details

Summary

Based on SSTC spec (1):

"If the stimecmp (supervisor-mode timer compare) register is implemented, STIP is read-only in mip and reflects the supervisor-level timer interrupt signal resulting from stimecmp. This timer interrupt signal is cleared by writing stimecmp with a value greater than the current time value."

This fixes operation in Spike with SSTC extension enabled, e.g.

$ spike --isa RV64IMAFDCH_zicntr_zihpm_sstc

[1]. https://tools.cloudbear.ru/docs/riscv-sstc-0.5.4-20211013.pdf

Test Plan

Tested in Spike only

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

br requested review of this revision.May 17 2024, 8:19 AM
br created this revision.
mhorne added inline comments.
sys/riscv/riscv/timer.c
147

We can rely on sign-extension or should it be -1UL?

This revision is now accepted and ready to land.May 17 2024, 2:19 PM

use UL suffix to not rely on sign-extension

This revision now requires review to proceed.May 17 2024, 10:29 PM
This revision is now accepted and ready to land.May 22 2024, 1:48 PM
This revision was automatically updated to reflect the committed changes.