From 3284bea83368de2ced244d5b2b0eaeaae812a08d Mon Sep 17 00:00:00 2001 From: Anup Patel Date: Mon, 11 Dec 2023 20:59:14 +0530 Subject: lib: sbi: Allow ecall handlers to directly update register state Some of the upcoming SBI extensions (such as SSE) will directly update register state so improve the prototype of ecall handler to accommodate this. Further, this flexibility allows us to push the trap redirection from sbi_ecall_handler() to the sbi_ecall_legacy_handler(). Signed-off-by: Anup Patel --- include/sbi/sbi_ecall.h | 12 +++++++++--- include/sbi/sbi_platform.h | 19 +++++++------------ 2 files changed, 16 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/include/sbi/sbi_ecall.h b/include/sbi/sbi_ecall.h index 027213cb..0bf42d16 100644 --- a/include/sbi/sbi_ecall.h +++ b/include/sbi/sbi_ecall.h @@ -20,6 +20,13 @@ struct sbi_trap_regs; struct sbi_trap_info; +struct sbi_ecall_return { + /* Return flag to skip register update */ + bool skip_regs_update; + /* Return value */ + unsigned long value; +}; + struct sbi_ecall_extension { /* head is used by the extension list */ struct sbi_dlist head; @@ -62,9 +69,8 @@ struct sbi_ecall_extension { * never invoked with an invalid or unavailable extension ID. */ int (* handle)(unsigned long extid, unsigned long funcid, - const struct sbi_trap_regs *regs, - unsigned long *out_val, - struct sbi_trap_info *out_trap); + struct sbi_trap_regs *regs, + struct sbi_ecall_return *out); }; u16 sbi_ecall_version_major(void); diff --git a/include/sbi/sbi_platform.h b/include/sbi/sbi_platform.h index 58b9069d..2fb33e16 100644 --- a/include/sbi/sbi_platform.h +++ b/include/sbi/sbi_platform.h @@ -50,7 +50,7 @@ #include struct sbi_domain_memregion; -struct sbi_trap_info; +struct sbi_ecall_return; struct sbi_trap_regs; struct sbi_hart_features; @@ -137,9 +137,8 @@ struct sbi_platform_operations { bool (*vendor_ext_check)(void); /** platform specific SBI extension implementation provider */ int (*vendor_ext_provider)(long funcid, - const struct sbi_trap_regs *regs, - unsigned long *out_value, - struct sbi_trap_info *out_trap); + struct sbi_trap_regs *regs, + struct sbi_ecall_return *out); }; /** Platform default per-HART stack size for exception/interrupt handling */ @@ -666,16 +665,12 @@ static inline bool sbi_platform_vendor_ext_check( static inline int sbi_platform_vendor_ext_provider( const struct sbi_platform *plat, long funcid, - const struct sbi_trap_regs *regs, - unsigned long *out_value, - struct sbi_trap_info *out_trap) + struct sbi_trap_regs *regs, + struct sbi_ecall_return *out) { - if (plat && sbi_platform_ops(plat)->vendor_ext_provider) { + if (plat && sbi_platform_ops(plat)->vendor_ext_provider) return sbi_platform_ops(plat)->vendor_ext_provider(funcid, - regs, - out_value, - out_trap); - } + regs, out); return SBI_ENOTSUPP; } -- cgit v1.3.1