Skip to content

Commit

Permalink
lib: Invalid all tlb entries to workaroud c920 bug
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaoguang Xing <[email protected]>
  • Loading branch information
xingxg2022 committed Aug 29, 2024
1 parent 14a44c3 commit e19f4d1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/sbi/sbi_tlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ static void sbi_tlb_local_hfence_gvma(struct sbi_tlb_info *tinfo)

static void sbi_tlb_local_sfence_vma(struct sbi_tlb_info *tinfo)
{
#ifndef CONFIG_THEAD_C9XX_ERRATA_JTLB
unsigned long start = tinfo->start;
unsigned long size = tinfo->size;
unsigned long i;
Expand All @@ -96,6 +97,10 @@ static void sbi_tlb_local_sfence_vma(struct sbi_tlb_info *tinfo)
: "r"(start + i)
: "memory");
}
#else
sbi_pmu_ctr_incr_fw(SBI_PMU_FW_SFENCE_VMA_RCVD);
tlb_flush_all();
#endif
}

static void sbi_tlb_local_hfence_vvma_asid(struct sbi_tlb_info *tinfo)
Expand Down Expand Up @@ -161,7 +166,7 @@ static void sbi_tlb_local_sfence_vma_asid(struct sbi_tlb_info *tinfo)
return;
}

#if 0
#ifndef CONFIG_THEAD_C9XX_ERRATA_JTLB
for (i = 0; i < size; i += PAGE_SIZE) {
__asm__ __volatile__("sfence.vma %0, %1"
:
Expand Down
2 changes: 2 additions & 0 deletions platform/generic/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ config PLATFORM_SOPHGO_SG2042

config PLATFORM_SOPHGO_SG2044
bool "Sophgo sg2044 support"
select THEAD_C9XX_ERRATA
select THEAD_C9XX_ERRATA_JTLB
select THEAD_C9XX_PMU
default n

Expand Down
4 changes: 4 additions & 0 deletions platform/generic/thead/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ config THEAD_C9XX_PMU
config THEAD_C9XX_ERRATA
bool "T-HEAD c9xx errata support"
default n

config THEAD_C9XX_ERRATA_JTLB
bool "T-HEAD c9xx errata(JTLB) support"
default n

0 comments on commit e19f4d1

Please sign in to comment.