diff options
author | Anup Patel <anup.patel@wdc.com> | 2020-12-29 13:51:06 +0530 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2021-01-07 09:53:19 +0530 |
commit | 12394a269b8b60e2d37b56afb2fa39fde6a3a4b8 (patch) | |
tree | 39e2d783172cf53f62c368d1daa0cfcc0d3502db /include | |
parent | b7df5e4392d34d8b8d5290d5b857676e672d4c96 (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 'include')
-rw-r--r-- | include/sbi/sbi_tlb.h | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/include/sbi/sbi_tlb.h b/include/sbi/sbi_tlb.h index 6ee64a9..48f1962 100644 --- a/include/sbi/sbi_tlb.h +++ b/include/sbi/sbi_tlb.h @@ -22,16 +22,6 @@ #define SBI_TLB_FIFO_NUM_ENTRIES 8 -enum sbi_tlb_info_types { - SBI_TLB_FLUSH_VMA, - SBI_TLB_FLUSH_VMA_ASID, - SBI_TLB_FLUSH_GVMA, - SBI_TLB_FLUSH_GVMA_VMID, - SBI_TLB_FLUSH_VVMA, - SBI_TLB_FLUSH_VVMA_ASID, - SBI_ITLB_FLUSH -}; - struct sbi_scratch; struct sbi_tlb_info { @@ -39,17 +29,25 @@ struct sbi_tlb_info { unsigned long size; unsigned long asid; unsigned long vmid; - unsigned long type; + void (*local_fn)(struct sbi_tlb_info *tinfo); struct sbi_hartmask smask; }; -#define SBI_TLB_INFO_INIT(__p, __start, __size, __asid, __vmid, __type, __src) \ +void sbi_tlb_local_hfence_vvma(struct sbi_tlb_info *tinfo); +void sbi_tlb_local_hfence_gvma(struct sbi_tlb_info *tinfo); +void sbi_tlb_local_sfence_vma(struct sbi_tlb_info *tinfo); +void sbi_tlb_local_hfence_vvma_asid(struct sbi_tlb_info *tinfo); +void sbi_tlb_local_hfence_gvma_vmid(struct sbi_tlb_info *tinfo); +void sbi_tlb_local_sfence_vma_asid(struct sbi_tlb_info *tinfo); +void sbi_tlb_local_fence_i(struct sbi_tlb_info *tinfo); + +#define SBI_TLB_INFO_INIT(__p, __start, __size, __asid, __vmid, __lfn, __src) \ do { \ (__p)->start = (__start); \ (__p)->size = (__size); \ (__p)->asid = (__asid); \ (__p)->vmid = (__vmid); \ - (__p)->type = (__type); \ + (__p)->local_fn = (__lfn); \ SBI_HARTMASK_INIT_EXCEPT(&(__p)->smask, (__src)); \ } while (0) |