aboutsummaryrefslogtreecommitdiff
path: root/lib/sbi/sbi_ecall_legacy.c
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2020-12-29 13:51:06 +0530
committerAnup Patel <anup@brainfault.org>2021-01-07 09:53:19 +0530
commit12394a269b8b60e2d37b56afb2fa39fde6a3a4b8 (patch)
tree39e2d783172cf53f62c368d1daa0cfcc0d3502db /lib/sbi/sbi_ecall_legacy.c
parentb7df5e4392d34d8b8d5290d5b857676e672d4c96 (diff)
lib: sbi: Allow custom local TLB flush function
Currently, we have fixed TLB flush types supported by the remote TLB library. This approach is not flexible and does not allow custom local TLB flush function. For example, after updating PMP entries on a set of HARTs at runtime, we have to flush TLB on these HARTs as well. To support custom local TLB flush function, we replace the "type" field of "struct sbi_tlb_info" with a local TLB flush function pointer. We also provide definitions of standard TLB flush operations (such as fence_i, sfence.vma, hfence.vvma, hfence.gvma, etc). Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'lib/sbi/sbi_ecall_legacy.c')
-rw-r--r--lib/sbi/sbi_ecall_legacy.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/sbi/sbi_ecall_legacy.c b/lib/sbi/sbi_ecall_legacy.c
index 8afeb00..1a7fe26 100644
--- a/lib/sbi/sbi_ecall_legacy.c
+++ b/lib/sbi/sbi_ecall_legacy.c
@@ -80,7 +80,8 @@ static int sbi_ecall_legacy_handler(unsigned long extid, unsigned long funcid,
&hmask, out_trap);
if (ret != SBI_ETRAP) {
SBI_TLB_INFO_INIT(&tlb_info, 0, 0, 0, 0,
- SBI_ITLB_FLUSH, source_hart);
+ sbi_tlb_local_fence_i,
+ source_hart);
ret = sbi_tlb_request(hmask, 0, &tlb_info);
}
break;
@@ -89,7 +90,8 @@ static int sbi_ecall_legacy_handler(unsigned long extid, unsigned long funcid,
&hmask, out_trap);
if (ret != SBI_ETRAP) {
SBI_TLB_INFO_INIT(&tlb_info, regs->a1, regs->a2, 0, 0,
- SBI_TLB_FLUSH_VMA, source_hart);
+ sbi_tlb_local_sfence_vma,
+ source_hart);
ret = sbi_tlb_request(hmask, 0, &tlb_info);
}
break;
@@ -99,7 +101,8 @@ static int sbi_ecall_legacy_handler(unsigned long extid, unsigned long funcid,
if (ret != SBI_ETRAP) {
SBI_TLB_INFO_INIT(&tlb_info, regs->a1,
regs->a2, regs->a3, 0,
- SBI_TLB_FLUSH_VMA_ASID, source_hart);
+ sbi_tlb_local_sfence_vma_asid,
+ source_hart);
ret = sbi_tlb_request(hmask, 0, &tlb_info);
}
break;