lib: Implement sfence.vma correctly.

Currently, OpenSBI doesn't distinguish between sfence.vma
and sfence.vm asid calls. Moreover, it ignores the page
ranges and just flush entire TLB everytime.

Fix the sfence implementation by keeping all the tlb flush
info in scratch area.

The relevant Linux kernel code was added by
https://patchwork.kernel.org/project/linux-riscv/list/?series=89695

However, this patch is backward compatible with older version kernel
that doesn't have the above patches as well.

Fixes #87
Signed-off-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
Atish Patra
2019-03-09 12:57:20 -08:00
committed by Anup Patel
parent 508a27204c
commit 90cb4917b5
6 changed files with 106 additions and 16 deletions

View File

@@ -15,12 +15,23 @@
#define SBI_IPI_EVENT_SOFT 0x1
#define SBI_IPI_EVENT_FENCE_I 0x2
#define SBI_IPI_EVENT_SFENCE_VMA 0x4
#define SBI_IPI_EVENT_HALT 0x8
#define SBI_IPI_EVENT_SFENCE_VMA_ASID 0x8
#define SBI_IPI_EVENT_HALT 0x10
struct sbi_scratch;
struct sbi_ipi_data {
unsigned long ipi_type;
};
struct sbi_tlb_info {
unsigned long start;
unsigned long size;
unsigned long asid;
};
int sbi_ipi_send_many(struct sbi_scratch *scratch,
ulong *pmask, u32 event);
ulong *pmask, u32 event, void *data);
void sbi_ipi_clear_smode(struct sbi_scratch *scratch);