mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 15:31:22 +01:00
lib: sbi_ecall_legacy: Use SBI v0.2 encoding for "all harts"
This simplifies the logic so that sbi_hsm_hart_interruptible_mask() is only called from one place (sbi_ipi_send_many()). A minor functional change is that the legacy functions can now affect more than XLEN harts when targeting all harts. Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:

committed by
Anup Patel

parent
7f5fa9f9a4
commit
633e7cbd50
@@ -14,7 +14,6 @@
|
||||
#include <sbi/sbi_ecall.h>
|
||||
#include <sbi/sbi_ecall_interface.h>
|
||||
#include <sbi/sbi_error.h>
|
||||
#include <sbi/sbi_hsm.h>
|
||||
#include <sbi/sbi_ipi.h>
|
||||
#include <sbi/sbi_platform.h>
|
||||
#include <sbi/sbi_system.h>
|
||||
@@ -24,7 +23,7 @@
|
||||
#include <sbi/sbi_unpriv.h>
|
||||
#include <sbi/sbi_hart.h>
|
||||
|
||||
static bool sbi_load_hart_mask_unpriv(ulong *pmask, ulong *hmask,
|
||||
static bool sbi_load_hart_mask_unpriv(ulong *pmask, ulong *hmask, ulong *hbase,
|
||||
struct sbi_trap_info *uptrap)
|
||||
{
|
||||
ulong mask = 0;
|
||||
@@ -33,9 +32,9 @@ static bool sbi_load_hart_mask_unpriv(ulong *pmask, ulong *hmask,
|
||||
mask = sbi_load_ulong(pmask, uptrap);
|
||||
if (uptrap->cause)
|
||||
return false;
|
||||
*hbase = 0;
|
||||
} else {
|
||||
sbi_hsm_hart_interruptible_mask(sbi_domain_thishart_ptr(),
|
||||
0, &mask);
|
||||
*hbase = -1UL;
|
||||
}
|
||||
*hmask = mask;
|
||||
|
||||
@@ -50,7 +49,7 @@ static int sbi_ecall_legacy_handler(unsigned long extid, unsigned long funcid,
|
||||
struct sbi_tlb_info tlb_info;
|
||||
u32 source_hart = current_hartid();
|
||||
struct sbi_trap_info trap = {0};
|
||||
ulong hmask = 0;
|
||||
ulong hmask, hbase;
|
||||
|
||||
switch (extid) {
|
||||
case SBI_EXT_0_1_SET_TIMER:
|
||||
@@ -71,8 +70,8 @@ static int sbi_ecall_legacy_handler(unsigned long extid, unsigned long funcid,
|
||||
break;
|
||||
case SBI_EXT_0_1_SEND_IPI:
|
||||
if (sbi_load_hart_mask_unpriv((ulong *)regs->a0,
|
||||
&hmask, &trap)) {
|
||||
ret = sbi_ipi_send_smode(hmask, 0);
|
||||
&hmask, &hbase, &trap)) {
|
||||
ret = sbi_ipi_send_smode(hmask, hbase);
|
||||
} else {
|
||||
sbi_trap_redirect(regs, &trap);
|
||||
out->skip_regs_update = true;
|
||||
@@ -80,10 +79,10 @@ static int sbi_ecall_legacy_handler(unsigned long extid, unsigned long funcid,
|
||||
break;
|
||||
case SBI_EXT_0_1_REMOTE_FENCE_I:
|
||||
if (sbi_load_hart_mask_unpriv((ulong *)regs->a0,
|
||||
&hmask, &trap)) {
|
||||
&hmask, &hbase, &trap)) {
|
||||
SBI_TLB_INFO_INIT(&tlb_info, 0, 0, 0, 0,
|
||||
SBI_TLB_FENCE_I, source_hart);
|
||||
ret = sbi_tlb_request(hmask, 0, &tlb_info);
|
||||
ret = sbi_tlb_request(hmask, hbase, &tlb_info);
|
||||
} else {
|
||||
sbi_trap_redirect(regs, &trap);
|
||||
out->skip_regs_update = true;
|
||||
@@ -91,10 +90,10 @@ static int sbi_ecall_legacy_handler(unsigned long extid, unsigned long funcid,
|
||||
break;
|
||||
case SBI_EXT_0_1_REMOTE_SFENCE_VMA:
|
||||
if (sbi_load_hart_mask_unpriv((ulong *)regs->a0,
|
||||
&hmask, &trap)) {
|
||||
&hmask, &hbase, &trap)) {
|
||||
SBI_TLB_INFO_INIT(&tlb_info, regs->a1, regs->a2, 0, 0,
|
||||
SBI_TLB_SFENCE_VMA, source_hart);
|
||||
ret = sbi_tlb_request(hmask, 0, &tlb_info);
|
||||
ret = sbi_tlb_request(hmask, hbase, &tlb_info);
|
||||
} else {
|
||||
sbi_trap_redirect(regs, &trap);
|
||||
out->skip_regs_update = true;
|
||||
@@ -102,12 +101,12 @@ static int sbi_ecall_legacy_handler(unsigned long extid, unsigned long funcid,
|
||||
break;
|
||||
case SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID:
|
||||
if (sbi_load_hart_mask_unpriv((ulong *)regs->a0,
|
||||
&hmask, &trap)) {
|
||||
&hmask, &hbase, &trap)) {
|
||||
SBI_TLB_INFO_INIT(&tlb_info, regs->a1,
|
||||
regs->a2, regs->a3, 0,
|
||||
SBI_TLB_SFENCE_VMA_ASID,
|
||||
source_hart);
|
||||
ret = sbi_tlb_request(hmask, 0, &tlb_info);
|
||||
ret = sbi_tlb_request(hmask, hbase, &tlb_info);
|
||||
} else {
|
||||
sbi_trap_redirect(regs, &trap);
|
||||
out->skip_regs_update = true;
|
||||
|
Reference in New Issue
Block a user