summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAtish Patra <[email protected]>2022-04-25 23:29:22 -0700
committerAnup Patel <[email protected]>2022-04-28 11:45:21 +0530
commitd62f6da062ad0fcc3bdc042a3f3b200d91d18afd (patch)
treec26f03e59440fd15c0b6639633645dcd45114b76 /include
parent4035ae94be802a68f8e8408a84b77f531d59416b (diff)
lib: sbi: Implement Sstc extension
Recently, Sstc extension was ratified. It defines stimecmp which allows the supervisor mode to directly update the timecmp value without the need of the SBI call. The hardware also can inject the S-mode timer interrupt direclty to the supervisor without going through the M-mode. To maintain backward compatibility with the older software, SBI call now uses stimecmp directly if the hardware supports. Implement the Sstc extension. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]>
Diffstat (limited to 'include')
-rw-r--r--include/sbi/riscv_encoding.h4
-rw-r--r--include/sbi/sbi_hart.h4
2 files changed, 7 insertions, 1 deletions
diff --git a/include/sbi/riscv_encoding.h b/include/sbi/riscv_encoding.h
index a9772a67..7cfbaced 100644
--- a/include/sbi/riscv_encoding.h
+++ b/include/sbi/riscv_encoding.h
@@ -324,6 +324,10 @@
#define CSR_STVAL 0x143
#define CSR_SIP 0x144
+/* Sstc extension */
+#define CSR_STIMECMP 0x14D
+#define CSR_STIMECMPH 0x15D
+
/* Supervisor Protection and Translation */
#define CSR_SATP 0x180
diff --git a/include/sbi/sbi_hart.h b/include/sbi/sbi_hart.h
index be3ad9fa..1d093742 100644
--- a/include/sbi/sbi_hart.h
+++ b/include/sbi/sbi_hart.h
@@ -30,9 +30,11 @@ enum sbi_hart_features {
SBI_HART_HAS_MENVCFG = (1 << 6),
/** HART has mstateen CSR **/
SBI_HART_HAS_SMSTATEEN = (1 << 7),
+ /** HART has SSTC extension implemented in hardware */
+ SBI_HART_HAS_SSTC = (1 << 8),
/** Last index of Hart features*/
- SBI_HART_HAS_LAST_FEATURE = SBI_HART_HAS_SMSTATEEN,
+ SBI_HART_HAS_LAST_FEATURE = SBI_HART_HAS_SSTC,
};
struct sbi_scratch;