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 <apatel@ventanamicro.com>
This commit is contained in:
Anup Patel
2023-12-11 20:59:14 +05:30
committed by Anup Patel
parent cdebae2cc9
commit 3284bea833
19 changed files with 109 additions and 107 deletions

View File

@@ -20,6 +20,13 @@
struct sbi_trap_regs; struct sbi_trap_regs;
struct sbi_trap_info; 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 { struct sbi_ecall_extension {
/* head is used by the extension list */ /* head is used by the extension list */
struct sbi_dlist head; struct sbi_dlist head;
@@ -62,9 +69,8 @@ struct sbi_ecall_extension {
* never invoked with an invalid or unavailable extension ID. * never invoked with an invalid or unavailable extension ID.
*/ */
int (* handle)(unsigned long extid, unsigned long funcid, int (* handle)(unsigned long extid, unsigned long funcid,
const struct sbi_trap_regs *regs, struct sbi_trap_regs *regs,
unsigned long *out_val, struct sbi_ecall_return *out);
struct sbi_trap_info *out_trap);
}; };
u16 sbi_ecall_version_major(void); u16 sbi_ecall_version_major(void);

View File

@@ -50,7 +50,7 @@
#include <sbi/sbi_version.h> #include <sbi/sbi_version.h>
struct sbi_domain_memregion; struct sbi_domain_memregion;
struct sbi_trap_info; struct sbi_ecall_return;
struct sbi_trap_regs; struct sbi_trap_regs;
struct sbi_hart_features; struct sbi_hart_features;
@@ -137,9 +137,8 @@ struct sbi_platform_operations {
bool (*vendor_ext_check)(void); bool (*vendor_ext_check)(void);
/** platform specific SBI extension implementation provider */ /** platform specific SBI extension implementation provider */
int (*vendor_ext_provider)(long funcid, int (*vendor_ext_provider)(long funcid,
const struct sbi_trap_regs *regs, struct sbi_trap_regs *regs,
unsigned long *out_value, struct sbi_ecall_return *out);
struct sbi_trap_info *out_trap);
}; };
/** Platform default per-HART stack size for exception/interrupt handling */ /** 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( static inline int sbi_platform_vendor_ext_provider(
const struct sbi_platform *plat, const struct sbi_platform *plat,
long funcid, long funcid,
const struct sbi_trap_regs *regs, struct sbi_trap_regs *regs,
unsigned long *out_value, struct sbi_ecall_return *out)
struct sbi_trap_info *out_trap)
{ {
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, return sbi_platform_ops(plat)->vendor_ext_provider(funcid,
regs, regs, out);
out_value,
out_trap);
}
return SBI_ENOTSUPP; return SBI_ENOTSUPP;
} }

View File

@@ -101,14 +101,12 @@ int sbi_ecall_handler(struct sbi_trap_regs *regs)
struct sbi_ecall_extension *ext; struct sbi_ecall_extension *ext;
unsigned long extension_id = regs->a7; unsigned long extension_id = regs->a7;
unsigned long func_id = regs->a6; unsigned long func_id = regs->a6;
struct sbi_trap_info trap = {0}; struct sbi_ecall_return out = {0};
unsigned long out_val = 0;
bool is_0_1_spec = 0; bool is_0_1_spec = 0;
ext = sbi_ecall_find_extension(extension_id); ext = sbi_ecall_find_extension(extension_id);
if (ext && ext->handle) { if (ext && ext->handle) {
ret = ext->handle(extension_id, func_id, ret = ext->handle(extension_id, func_id, regs, &out);
regs, &out_val, &trap);
if (extension_id >= SBI_EXT_0_1_SET_TIMER && if (extension_id >= SBI_EXT_0_1_SET_TIMER &&
extension_id <= SBI_EXT_0_1_SHUTDOWN) extension_id <= SBI_EXT_0_1_SHUTDOWN)
is_0_1_spec = 1; is_0_1_spec = 1;
@@ -116,10 +114,7 @@ int sbi_ecall_handler(struct sbi_trap_regs *regs)
ret = SBI_ENOTSUPP; ret = SBI_ENOTSUPP;
} }
if (ret == SBI_ETRAP) { if (!out.skip_regs_update) {
trap.epc = regs->mepc;
sbi_trap_redirect(regs, &trap);
} else {
if (ret < SBI_LAST_ERR || if (ret < SBI_LAST_ERR ||
(extension_id != SBI_EXT_0_1_CONSOLE_GETCHAR && (extension_id != SBI_EXT_0_1_CONSOLE_GETCHAR &&
SBI_SUCCESS < ret)) { SBI_SUCCESS < ret)) {
@@ -140,7 +135,7 @@ int sbi_ecall_handler(struct sbi_trap_regs *regs)
regs->mepc += 4; regs->mepc += 4;
regs->a0 = ret; regs->a0 = ret;
if (!is_0_1_spec) if (!is_0_1_spec)
regs->a1 = out_val; regs->a1 = out.value;
} }
return 0; return 0;

View File

@@ -33,37 +33,36 @@ static int sbi_ecall_base_probe(unsigned long extid, unsigned long *out_val)
} }
static int sbi_ecall_base_handler(unsigned long extid, unsigned long funcid, static int sbi_ecall_base_handler(unsigned long extid, unsigned long funcid,
const struct sbi_trap_regs *regs, struct sbi_trap_regs *regs,
unsigned long *out_val, struct sbi_ecall_return *out)
struct sbi_trap_info *out_trap)
{ {
int ret = 0; int ret = 0;
switch (funcid) { switch (funcid) {
case SBI_EXT_BASE_GET_SPEC_VERSION: case SBI_EXT_BASE_GET_SPEC_VERSION:
*out_val = (SBI_ECALL_VERSION_MAJOR << out->value = (SBI_ECALL_VERSION_MAJOR <<
SBI_SPEC_VERSION_MAJOR_OFFSET) & SBI_SPEC_VERSION_MAJOR_OFFSET) &
(SBI_SPEC_VERSION_MAJOR_MASK << (SBI_SPEC_VERSION_MAJOR_MASK <<
SBI_SPEC_VERSION_MAJOR_OFFSET); SBI_SPEC_VERSION_MAJOR_OFFSET);
*out_val = *out_val | SBI_ECALL_VERSION_MINOR; out->value = out->value | SBI_ECALL_VERSION_MINOR;
break; break;
case SBI_EXT_BASE_GET_IMP_ID: case SBI_EXT_BASE_GET_IMP_ID:
*out_val = sbi_ecall_get_impid(); out->value = sbi_ecall_get_impid();
break; break;
case SBI_EXT_BASE_GET_IMP_VERSION: case SBI_EXT_BASE_GET_IMP_VERSION:
*out_val = OPENSBI_VERSION; out->value = OPENSBI_VERSION;
break; break;
case SBI_EXT_BASE_GET_MVENDORID: case SBI_EXT_BASE_GET_MVENDORID:
*out_val = csr_read(CSR_MVENDORID); out->value = csr_read(CSR_MVENDORID);
break; break;
case SBI_EXT_BASE_GET_MARCHID: case SBI_EXT_BASE_GET_MARCHID:
*out_val = csr_read(CSR_MARCHID); out->value = csr_read(CSR_MARCHID);
break; break;
case SBI_EXT_BASE_GET_MIMPID: case SBI_EXT_BASE_GET_MIMPID:
*out_val = csr_read(CSR_MIMPID); out->value = csr_read(CSR_MIMPID);
break; break;
case SBI_EXT_BASE_PROBE_EXT: case SBI_EXT_BASE_PROBE_EXT:
ret = sbi_ecall_base_probe(regs->a0, out_val); ret = sbi_ecall_base_probe(regs->a0, &out->value);
break; break;
default: default:
ret = SBI_ENOTSUPP; ret = SBI_ENOTSUPP;

View File

@@ -12,9 +12,8 @@
#include <sbi/sbi_cppc.h> #include <sbi/sbi_cppc.h>
static int sbi_ecall_cppc_handler(unsigned long extid, unsigned long funcid, static int sbi_ecall_cppc_handler(unsigned long extid, unsigned long funcid,
const struct sbi_trap_regs *regs, struct sbi_trap_regs *regs,
unsigned long *out_val, struct sbi_ecall_return *out)
struct sbi_trap_info *out_trap)
{ {
int ret = 0; int ret = 0;
uint64_t temp; uint64_t temp;
@@ -22,14 +21,14 @@ static int sbi_ecall_cppc_handler(unsigned long extid, unsigned long funcid,
switch (funcid) { switch (funcid) {
case SBI_EXT_CPPC_READ: case SBI_EXT_CPPC_READ:
ret = sbi_cppc_read(regs->a0, &temp); ret = sbi_cppc_read(regs->a0, &temp);
*out_val = temp; out->value = temp;
break; break;
case SBI_EXT_CPPC_READ_HI: case SBI_EXT_CPPC_READ_HI:
#if __riscv_xlen == 32 #if __riscv_xlen == 32
ret = sbi_cppc_read(regs->a0, &temp); ret = sbi_cppc_read(regs->a0, &temp);
*out_val = temp >> 32; out->value = temp >> 32;
#else #else
*out_val = 0; out->value = 0;
#endif #endif
break; break;
case SBI_EXT_CPPC_WRITE: case SBI_EXT_CPPC_WRITE:
@@ -38,7 +37,7 @@ static int sbi_ecall_cppc_handler(unsigned long extid, unsigned long funcid,
case SBI_EXT_CPPC_PROBE: case SBI_EXT_CPPC_PROBE:
ret = sbi_cppc_probe(regs->a0); ret = sbi_cppc_probe(regs->a0);
if (ret >= 0) { if (ret >= 0) {
*out_val = ret; out->value = ret;
ret = 0; ret = 0;
} }
break; break;

View File

@@ -17,9 +17,8 @@
#include <sbi/sbi_hart.h> #include <sbi/sbi_hart.h>
static int sbi_ecall_dbcn_handler(unsigned long extid, unsigned long funcid, static int sbi_ecall_dbcn_handler(unsigned long extid, unsigned long funcid,
const struct sbi_trap_regs *regs, struct sbi_trap_regs *regs,
unsigned long *out_val, struct sbi_ecall_return *out)
struct sbi_trap_info *out_trap)
{ {
ulong smode = (csr_read(CSR_MSTATUS) & MSTATUS_MPP) >> ulong smode = (csr_read(CSR_MSTATUS) & MSTATUS_MPP) >>
MSTATUS_MPP_SHIFT; MSTATUS_MPP_SHIFT;
@@ -49,9 +48,9 @@ static int sbi_ecall_dbcn_handler(unsigned long extid, unsigned long funcid,
return SBI_ERR_INVALID_PARAM; return SBI_ERR_INVALID_PARAM;
sbi_hart_map_saddr(regs->a1, regs->a0); sbi_hart_map_saddr(regs->a1, regs->a0);
if (funcid == SBI_EXT_DBCN_CONSOLE_WRITE) if (funcid == SBI_EXT_DBCN_CONSOLE_WRITE)
*out_val = sbi_nputs((const char *)regs->a1, regs->a0); out->value = sbi_nputs((const char *)regs->a1, regs->a0);
else else
*out_val = sbi_ngets((char *)regs->a1, regs->a0); out->value = sbi_ngets((char *)regs->a1, regs->a0);
sbi_hart_unmap_saddr(); sbi_hart_unmap_saddr();
return 0; return 0;
case SBI_EXT_DBCN_CONSOLE_WRITE_BYTE: case SBI_EXT_DBCN_CONSOLE_WRITE_BYTE:

View File

@@ -17,9 +17,8 @@
#include <sbi/riscv_asm.h> #include <sbi/riscv_asm.h>
static int sbi_ecall_hsm_handler(unsigned long extid, unsigned long funcid, static int sbi_ecall_hsm_handler(unsigned long extid, unsigned long funcid,
const struct sbi_trap_regs *regs, struct sbi_trap_regs *regs,
unsigned long *out_val, struct sbi_ecall_return *out)
struct sbi_trap_info *out_trap)
{ {
int ret = 0; int ret = 0;
struct sbi_scratch *scratch = sbi_scratch_thishart_ptr(); struct sbi_scratch *scratch = sbi_scratch_thishart_ptr();
@@ -47,7 +46,7 @@ static int sbi_ecall_hsm_handler(unsigned long extid, unsigned long funcid,
} }
if (ret >= 0) { if (ret >= 0) {
*out_val = ret; out->value = ret;
ret = 0; ret = 0;
} }

View File

@@ -15,9 +15,8 @@
#include <sbi/sbi_ipi.h> #include <sbi/sbi_ipi.h>
static int sbi_ecall_ipi_handler(unsigned long extid, unsigned long funcid, static int sbi_ecall_ipi_handler(unsigned long extid, unsigned long funcid,
const struct sbi_trap_regs *regs, struct sbi_trap_regs *regs,
unsigned long *out_val, struct sbi_ecall_return *out)
struct sbi_trap_info *out_trap)
{ {
int ret = 0; int ret = 0;

View File

@@ -43,13 +43,13 @@ static int sbi_load_hart_mask_unpriv(ulong *pmask, ulong *hmask,
} }
static int sbi_ecall_legacy_handler(unsigned long extid, unsigned long funcid, static int sbi_ecall_legacy_handler(unsigned long extid, unsigned long funcid,
const struct sbi_trap_regs *regs, struct sbi_trap_regs *regs,
unsigned long *out_val, struct sbi_ecall_return *out)
struct sbi_trap_info *out_trap)
{ {
int ret = 0; int ret = 0;
struct sbi_tlb_info tlb_info; struct sbi_tlb_info tlb_info;
u32 source_hart = current_hartid(); u32 source_hart = current_hartid();
struct sbi_trap_info trap = {0};
ulong hmask = 0; ulong hmask = 0;
switch (extid) { switch (extid) {
@@ -71,37 +71,58 @@ static int sbi_ecall_legacy_handler(unsigned long extid, unsigned long funcid,
break; break;
case SBI_EXT_0_1_SEND_IPI: case SBI_EXT_0_1_SEND_IPI:
ret = sbi_load_hart_mask_unpriv((ulong *)regs->a0, ret = sbi_load_hart_mask_unpriv((ulong *)regs->a0,
&hmask, out_trap); &hmask, &trap);
if (ret != SBI_ETRAP) if (ret != SBI_ETRAP) {
ret = sbi_ipi_send_smode(hmask, 0); ret = sbi_ipi_send_smode(hmask, 0);
} else {
ret = 0;
trap.epc = regs->mepc;
sbi_trap_redirect(regs, &trap);
out->skip_regs_update = true;
}
break; break;
case SBI_EXT_0_1_REMOTE_FENCE_I: case SBI_EXT_0_1_REMOTE_FENCE_I:
ret = sbi_load_hart_mask_unpriv((ulong *)regs->a0, ret = sbi_load_hart_mask_unpriv((ulong *)regs->a0,
&hmask, out_trap); &hmask, &trap);
if (ret != SBI_ETRAP) { if (ret != SBI_ETRAP) {
SBI_TLB_INFO_INIT(&tlb_info, 0, 0, 0, 0, SBI_TLB_INFO_INIT(&tlb_info, 0, 0, 0, 0,
SBI_TLB_FENCE_I, source_hart); SBI_TLB_FENCE_I, source_hart);
ret = sbi_tlb_request(hmask, 0, &tlb_info); ret = sbi_tlb_request(hmask, 0, &tlb_info);
} else {
ret = 0;
trap.epc = regs->mepc;
sbi_trap_redirect(regs, &trap);
out->skip_regs_update = true;
} }
break; break;
case SBI_EXT_0_1_REMOTE_SFENCE_VMA: case SBI_EXT_0_1_REMOTE_SFENCE_VMA:
ret = sbi_load_hart_mask_unpriv((ulong *)regs->a0, ret = sbi_load_hart_mask_unpriv((ulong *)regs->a0,
&hmask, out_trap); &hmask, &trap);
if (ret != SBI_ETRAP) { if (ret != SBI_ETRAP) {
SBI_TLB_INFO_INIT(&tlb_info, regs->a1, regs->a2, 0, 0, SBI_TLB_INFO_INIT(&tlb_info, regs->a1, regs->a2, 0, 0,
SBI_TLB_SFENCE_VMA, source_hart); SBI_TLB_SFENCE_VMA, source_hart);
ret = sbi_tlb_request(hmask, 0, &tlb_info); ret = sbi_tlb_request(hmask, 0, &tlb_info);
} else {
ret = 0;
trap.epc = regs->mepc;
sbi_trap_redirect(regs, &trap);
out->skip_regs_update = true;
} }
break; break;
case SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID: case SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID:
ret = sbi_load_hart_mask_unpriv((ulong *)regs->a0, ret = sbi_load_hart_mask_unpriv((ulong *)regs->a0,
&hmask, out_trap); &hmask, &trap);
if (ret != SBI_ETRAP) { if (ret != SBI_ETRAP) {
SBI_TLB_INFO_INIT(&tlb_info, regs->a1, SBI_TLB_INFO_INIT(&tlb_info, regs->a1,
regs->a2, regs->a3, 0, regs->a2, regs->a3, 0,
SBI_TLB_SFENCE_VMA_ASID, SBI_TLB_SFENCE_VMA_ASID,
source_hart); source_hart);
ret = sbi_tlb_request(hmask, 0, &tlb_info); ret = sbi_tlb_request(hmask, 0, &tlb_info);
} else {
ret = 0;
trap.epc = regs->mepc;
sbi_trap_redirect(regs, &trap);
out->skip_regs_update = true;
} }
break; break;
case SBI_EXT_0_1_SHUTDOWN: case SBI_EXT_0_1_SHUTDOWN:

View File

@@ -18,9 +18,8 @@
#include <sbi/riscv_asm.h> #include <sbi/riscv_asm.h>
static int sbi_ecall_pmu_handler(unsigned long extid, unsigned long funcid, static int sbi_ecall_pmu_handler(unsigned long extid, unsigned long funcid,
const struct sbi_trap_regs *regs, struct sbi_trap_regs *regs,
unsigned long *out_val, struct sbi_ecall_return *out)
struct sbi_trap_info *out_trap)
{ {
int ret = 0; int ret = 0;
uint64_t temp; uint64_t temp;
@@ -29,12 +28,12 @@ static int sbi_ecall_pmu_handler(unsigned long extid, unsigned long funcid,
case SBI_EXT_PMU_NUM_COUNTERS: case SBI_EXT_PMU_NUM_COUNTERS:
ret = sbi_pmu_num_ctr(); ret = sbi_pmu_num_ctr();
if (ret >= 0) { if (ret >= 0) {
*out_val = ret; out->value = ret;
ret = 0; ret = 0;
} }
break; break;
case SBI_EXT_PMU_COUNTER_GET_INFO: case SBI_EXT_PMU_COUNTER_GET_INFO:
ret = sbi_pmu_ctr_get_info(regs->a0, out_val); ret = sbi_pmu_ctr_get_info(regs->a0, &out->value);
break; break;
case SBI_EXT_PMU_COUNTER_CFG_MATCH: case SBI_EXT_PMU_COUNTER_CFG_MATCH:
#if __riscv_xlen == 32 #if __riscv_xlen == 32
@@ -45,21 +44,21 @@ static int sbi_ecall_pmu_handler(unsigned long extid, unsigned long funcid,
ret = sbi_pmu_ctr_cfg_match(regs->a0, regs->a1, regs->a2, ret = sbi_pmu_ctr_cfg_match(regs->a0, regs->a1, regs->a2,
regs->a3, temp); regs->a3, temp);
if (ret >= 0) { if (ret >= 0) {
*out_val = ret; out->value = ret;
ret = 0; ret = 0;
} }
break; break;
case SBI_EXT_PMU_COUNTER_FW_READ: case SBI_EXT_PMU_COUNTER_FW_READ:
ret = sbi_pmu_ctr_fw_read(regs->a0, &temp); ret = sbi_pmu_ctr_fw_read(regs->a0, &temp);
*out_val = temp; out->value = temp;
break; break;
case SBI_EXT_PMU_COUNTER_FW_READ_HI: case SBI_EXT_PMU_COUNTER_FW_READ_HI:
#if __riscv_xlen == 32 #if __riscv_xlen == 32
ret = sbi_pmu_ctr_fw_read(regs->a0, &temp); ret = sbi_pmu_ctr_fw_read(regs->a0, &temp);
*out_val = temp >> 32; out->value = temp >> 32;
#else #else
*out_val = 0; out->value = 0;
#endif #endif
break; break;
case SBI_EXT_PMU_COUNTER_START: case SBI_EXT_PMU_COUNTER_START:

View File

@@ -16,9 +16,8 @@
#include <sbi/sbi_tlb.h> #include <sbi/sbi_tlb.h>
static int sbi_ecall_rfence_handler(unsigned long extid, unsigned long funcid, static int sbi_ecall_rfence_handler(unsigned long extid, unsigned long funcid,
const struct sbi_trap_regs *regs, struct sbi_trap_regs *regs,
unsigned long *out_val, struct sbi_ecall_return *out)
struct sbi_trap_info *out_trap)
{ {
int ret = 0; int ret = 0;
unsigned long vmid; unsigned long vmid;

View File

@@ -15,9 +15,8 @@
#include <sbi/sbi_system.h> #include <sbi/sbi_system.h>
static int sbi_ecall_srst_handler(unsigned long extid, unsigned long funcid, static int sbi_ecall_srst_handler(unsigned long extid, unsigned long funcid,
const struct sbi_trap_regs *regs, struct sbi_trap_regs *regs,
unsigned long *out_val, struct sbi_ecall_return *out)
struct sbi_trap_info *out_trap)
{ {
if (funcid == SBI_EXT_SRST_RESET) { if (funcid == SBI_EXT_SRST_RESET) {
if ((((u32)-1U) <= ((u64)regs->a0)) || if ((((u32)-1U) <= ((u64)regs->a0)) ||

View File

@@ -6,9 +6,8 @@
#include <sbi/sbi_system.h> #include <sbi/sbi_system.h>
static int sbi_ecall_susp_handler(unsigned long extid, unsigned long funcid, static int sbi_ecall_susp_handler(unsigned long extid, unsigned long funcid,
const struct sbi_trap_regs *regs, struct sbi_trap_regs *regs,
unsigned long *out_val, struct sbi_ecall_return *out)
struct sbi_trap_info *out_trap)
{ {
int ret = SBI_ENOTSUPP; int ret = SBI_ENOTSUPP;
@@ -16,7 +15,7 @@ static int sbi_ecall_susp_handler(unsigned long extid, unsigned long funcid,
ret = sbi_system_suspend(regs->a0, regs->a1, regs->a2); ret = sbi_system_suspend(regs->a0, regs->a1, regs->a2);
if (ret >= 0) { if (ret >= 0) {
*out_val = ret; out->value = ret;
ret = 0; ret = 0;
} }

View File

@@ -15,9 +15,8 @@
#include <sbi/sbi_timer.h> #include <sbi/sbi_timer.h>
static int sbi_ecall_time_handler(unsigned long extid, unsigned long funcid, static int sbi_ecall_time_handler(unsigned long extid, unsigned long funcid,
const struct sbi_trap_regs *regs, struct sbi_trap_regs *regs,
unsigned long *out_val, struct sbi_ecall_return *out)
struct sbi_trap_info *out_trap)
{ {
int ret = 0; int ret = 0;

View File

@@ -23,13 +23,11 @@ static inline unsigned long sbi_ecall_vendor_id(void)
} }
static int sbi_ecall_vendor_handler(unsigned long extid, unsigned long funcid, static int sbi_ecall_vendor_handler(unsigned long extid, unsigned long funcid,
const struct sbi_trap_regs *regs, struct sbi_trap_regs *regs,
unsigned long *out_val, struct sbi_ecall_return *out)
struct sbi_trap_info *out_trap)
{ {
return sbi_platform_vendor_ext_provider(sbi_platform_thishart_ptr(), return sbi_platform_vendor_ext_provider(sbi_platform_thishart_ptr(),
funcid, regs, funcid, regs, out);
out_val, out_trap);
} }
struct sbi_ecall_extension ecall_vendor; struct sbi_ecall_extension ecall_vendor;

View File

@@ -33,14 +33,13 @@ static bool andes45_apply_iocp_sw_workaround(void)
} }
int andes_sbi_vendor_ext_provider(long funcid, int andes_sbi_vendor_ext_provider(long funcid,
const struct sbi_trap_regs *regs, struct sbi_trap_regs *regs,
unsigned long *out_value, struct sbi_ecall_return *out,
struct sbi_trap_info *out_trap,
const struct fdt_match *match) const struct fdt_match *match)
{ {
switch (funcid) { switch (funcid) {
case SBI_EXT_ANDES_IOCP_SW_WORKAROUND: case SBI_EXT_ANDES_IOCP_SW_WORKAROUND:
*out_value = andes45_apply_iocp_sw_workaround(); out->value = andes45_apply_iocp_sw_workaround();
break; break;
default: default:

View File

@@ -3,13 +3,13 @@
#ifndef _RISCV_ANDES_SBI_H #ifndef _RISCV_ANDES_SBI_H
#define _RISCV_ANDES_SBI_H #define _RISCV_ANDES_SBI_H
#include <sbi/sbi_ecall.h>
#include <sbi/sbi_trap.h> #include <sbi/sbi_trap.h>
#include <sbi_utils/fdt/fdt_helper.h> #include <sbi_utils/fdt/fdt_helper.h>
int andes_sbi_vendor_ext_provider(long funcid, int andes_sbi_vendor_ext_provider(long funcid,
const struct sbi_trap_regs *regs, struct sbi_trap_regs *regs,
unsigned long *out_value, struct sbi_ecall_return *out,
struct sbi_trap_info *out_trap,
const struct fdt_match *match); const struct fdt_match *match);
#endif /* _RISCV_ANDES_SBI_H */ #endif /* _RISCV_ANDES_SBI_H */

View File

@@ -10,6 +10,7 @@
#ifndef __PLATFORM_OVERRIDE_H__ #ifndef __PLATFORM_OVERRIDE_H__
#define __PLATFORM_OVERRIDE_H__ #define __PLATFORM_OVERRIDE_H__
#include <sbi/sbi_ecall.h>
#include <sbi/sbi_hart.h> #include <sbi/sbi_hart.h>
#include <sbi/sbi_types.h> #include <sbi/sbi_types.h>
#include <sbi/sbi_trap.h> #include <sbi/sbi_trap.h>
@@ -30,9 +31,8 @@ struct platform_override {
int (*pmu_init)(const struct fdt_match *match); int (*pmu_init)(const struct fdt_match *match);
void (*fw_init)(void *fdt, const struct fdt_match *match); void (*fw_init)(void *fdt, const struct fdt_match *match);
int (*vendor_ext_provider)(long funcid, int (*vendor_ext_provider)(long funcid,
const struct sbi_trap_regs *regs, struct sbi_trap_regs *regs,
unsigned long *out_value, struct sbi_ecall_return *out,
struct sbi_trap_info *out_trap,
const struct fdt_match *match); const struct fdt_match *match);
}; };

View File

@@ -203,12 +203,10 @@ static bool generic_vendor_ext_check(void)
} }
static int generic_vendor_ext_provider(long funcid, static int generic_vendor_ext_provider(long funcid,
const struct sbi_trap_regs *regs, struct sbi_trap_regs *regs,
unsigned long *out_value, struct sbi_ecall_return *out)
struct sbi_trap_info *out_trap)
{ {
return generic_plat->vendor_ext_provider(funcid, regs, return generic_plat->vendor_ext_provider(funcid, regs, out,
out_value, out_trap,
generic_plat_match); generic_plat_match);
} }