Linux_SDK_V1.0.2

This commit is contained in:
thead_admin
2022-11-22 15:53:45 +08:00
parent c0919a898e
commit aad6533a3b
2 changed files with 14 additions and 2 deletions

View File

@@ -14,7 +14,7 @@
#include <sbi/sbi_scratch.h>
#include <sbi/sbi_string.h>
u32 last_hartid_having_scratch = SBI_HARTMASK_MAX_BITS;
u32 last_hartid_having_scratch = SBI_HARTMASK_MAX_BITS - 1;
struct sbi_scratch *hartid_to_scratch_table[SBI_HARTMASK_MAX_BITS] = { 0 };
static spinlock_t extra_lock = SPIN_LOCK_INITIALIZER;
@@ -74,7 +74,7 @@ done:
spin_unlock(&extra_lock);
if (ret) {
for (i = 0; i < sbi_scratch_last_hartid(); i++) {
for (i = 0; i <= sbi_scratch_last_hartid(); i++) {
rscratch = sbi_hartid_to_scratch(i);
if (!rscratch)
continue;

View File

@@ -29,7 +29,11 @@ static unsigned long tlb_range_flush_limit;
static void sbi_tlb_flush_all(void)
{
#ifdef FW_NO_SFENCE_VMA
csr_write(0x9c3, 1 << 26);
#else
__asm__ __volatile("sfence.vma");
#endif
}
void sbi_tlb_local_hfence_vvma(struct sbi_tlb_info *tinfo)
@@ -73,6 +77,9 @@ void sbi_tlb_local_hfence_gvma(struct sbi_tlb_info *tinfo)
void sbi_tlb_local_sfence_vma(struct sbi_tlb_info *tinfo)
{
#ifdef FW_NO_SFENCE_VMA
csr_write(0x9c3, 1 << 26);
#else
unsigned long start = tinfo->start;
unsigned long size = tinfo->size;
unsigned long i;
@@ -88,6 +95,7 @@ void sbi_tlb_local_sfence_vma(struct sbi_tlb_info *tinfo)
: "r"(start + i)
: "memory");
}
#endif
}
void sbi_tlb_local_hfence_vvma_asid(struct sbi_tlb_info *tinfo)
@@ -143,6 +151,9 @@ void sbi_tlb_local_hfence_gvma_vmid(struct sbi_tlb_info *tinfo)
void sbi_tlb_local_sfence_vma_asid(struct sbi_tlb_info *tinfo)
{
#ifdef FW_NO_SFENCE_VMA
csr_write(0x9c3, 1 << 26);
#else
unsigned long start = tinfo->start;
unsigned long size = tinfo->size;
unsigned long asid = tinfo->asid;
@@ -168,6 +179,7 @@ void sbi_tlb_local_sfence_vma_asid(struct sbi_tlb_info *tinfo)
: "r"(start + i), "r"(asid)
: "memory");
}
#endif
}
void sbi_tlb_local_fence_i(struct sbi_tlb_info *tinfo)