summaryrefslogtreecommitdiff
path: root/include/sbi/riscv_asm.h
diff options
context:
space:
mode:
authorAtish Patra <atish.patra@wdc.com>2019-03-09 23:57:20 +0300
committerAnup Patel <anup@brainfault.org>2019-03-12 19:37:25 +0300
commit90cb4917b584b07df3e4037a3b660e9ac28e3384 (patch)
tree4b4905f9c70c5909d2b642255d542b71fb700710 /include/sbi/riscv_asm.h
parent508a27204cbbca0a9430236e56681e5e0d343fb9 (diff)
downloadopensbi-90cb4917b584b07df3e4037a3b660e9ac28e3384.tar.xz
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>
Diffstat (limited to 'include/sbi/riscv_asm.h')
-rw-r--r--include/sbi/riscv_asm.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/sbi/riscv_asm.h b/include/sbi/riscv_asm.h
index a88c086..9648629 100644
--- a/include/sbi/riscv_asm.h
+++ b/include/sbi/riscv_asm.h
@@ -26,6 +26,11 @@
#error "Unexpected __riscv_xlen"
#endif
+#define PAGE_SHIFT (12)
+#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
+#define PAGE_MASK (~(PAGE_SIZE - 1))
+#define SBI_TLB_FLUSH_ALL ((unsigned long)-1)
+
#define REG_L __REG_SEL(ld, lw)
#define REG_S __REG_SEL(sd, sw)
#define SZREG __REG_SEL(8, 4)