mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2026-09-08 18:21:29 +01:00
lib: sbi: Allow platforms to override local TLB operations
Some T-Head based processors, for example the Sophgo SG2044, have a JTLB errata that requires special handling of certain TLB maintenance instructions (sfence.vma). Introduce a sbi_tlb_local_operations structure so platforms can provide custom local TLB flush implementations. Use it to implement the JTLB workaround on affected SoCs (currently Sophgo SG2044). Signed-off-by: Xiang W <wangxiang@iscas.ac.cn> Signed-off-by: Han Gao <gaohan@iscas.ac.cn> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20260617112925.1144190-2-wangxiang@iscas.ac.cn Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
@@ -54,6 +54,37 @@ do { \
|
||||
|
||||
#define SBI_TLB_INFO_SIZE sizeof(struct sbi_tlb_info)
|
||||
|
||||
/** Collection of Local TLB operations */
|
||||
struct sbi_tlb_local_operations {
|
||||
/** Local fence.i */
|
||||
void (*local_fence_i)(struct sbi_tlb_info *tinfo);
|
||||
|
||||
/** Local supervisor-mode TLB flush */
|
||||
void (*local_sfence_vma)(struct sbi_tlb_info *tinfo);
|
||||
|
||||
/** Local supervisor-mode TLB flush with ASID */
|
||||
void (*local_sfence_vma_asid)(struct sbi_tlb_info *tinfo);
|
||||
|
||||
/** Local G-stage TLB flush for a specific VMID */
|
||||
void (*local_hfence_gvma_vmid)(struct sbi_tlb_info *tinfo);
|
||||
|
||||
/** Local G-stage TLB flush */
|
||||
void (*local_hfence_gvma)(struct sbi_tlb_info *tinfo);
|
||||
|
||||
/** Local VS-stage TLB flush with ASID */
|
||||
void (*local_hfence_vvma_asid)(struct sbi_tlb_info *tinfo);
|
||||
|
||||
/** Local VS-stage TLB flush */
|
||||
void (*local_hfence_vvma)(struct sbi_tlb_info *tinfo);
|
||||
};
|
||||
|
||||
/** Get the local TLB operations */
|
||||
const struct sbi_tlb_local_operations *sbi_tlb_get_local_operations(void);
|
||||
|
||||
/** Set the local TLB operations */
|
||||
void sbi_tlb_set_local_operations(
|
||||
const struct sbi_tlb_local_operations *ops);
|
||||
|
||||
void __sbi_sfence_vma_all();
|
||||
|
||||
int sbi_tlb_request(ulong hmask, ulong hbase, struct sbi_tlb_info *tinfo);
|
||||
|
||||
Reference in New Issue
Block a user