4c8eb19cf9
Remove a confusing comment on our local_flush_tlb_all()
implementation. Per an internal discussion with Andrew, while it's
true that the fence.i is not necessary, it's not the case that an
sfence.vma implies a fence.i. We also drop the section about
"flush[ing] the entire local TLB" to better align with the language in
section 4.2.1 "Supervisor Memory-Management Fence Instruction" of the
RISC-V Privileged Specification v20190608.
Fixes: c901e45a99
("RISC-V: `sfence.vma` orderes the instruction cache")
Reported-by: Alan Kao <alankao@andestech.com>
Cc: Palmer Dabbelt <palmer@sifive.com>
Cc: Andrew Waterman <andrew@sifive.com>
Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
51 lines
1.3 KiB
C
51 lines
1.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) 2009 Chen Liqin <liqin.chen@sunplusct.com>
|
|
* Copyright (C) 2012 Regents of the University of California
|
|
*/
|
|
|
|
#ifndef _ASM_RISCV_TLBFLUSH_H
|
|
#define _ASM_RISCV_TLBFLUSH_H
|
|
|
|
#include <linux/mm_types.h>
|
|
#include <asm/smp.h>
|
|
|
|
static inline void local_flush_tlb_all(void)
|
|
{
|
|
__asm__ __volatile__ ("sfence.vma" : : : "memory");
|
|
}
|
|
|
|
/* Flush one page from local TLB */
|
|
static inline void local_flush_tlb_page(unsigned long addr)
|
|
{
|
|
__asm__ __volatile__ ("sfence.vma %0" : : "r" (addr) : "memory");
|
|
}
|
|
|
|
#ifdef CONFIG_SMP
|
|
void flush_tlb_all(void);
|
|
void flush_tlb_mm(struct mm_struct *mm);
|
|
void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr);
|
|
void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
|
|
unsigned long end);
|
|
#else /* CONFIG_SMP */
|
|
#define flush_tlb_all() local_flush_tlb_all()
|
|
#define flush_tlb_page(vma, addr) local_flush_tlb_page(addr)
|
|
|
|
static inline void flush_tlb_range(struct vm_area_struct *vma,
|
|
unsigned long start, unsigned long end)
|
|
{
|
|
local_flush_tlb_all();
|
|
}
|
|
|
|
#define flush_tlb_mm(mm) flush_tlb_all()
|
|
#endif /* CONFIG_SMP */
|
|
|
|
/* Flush a range of kernel pages */
|
|
static inline void flush_tlb_kernel_range(unsigned long start,
|
|
unsigned long end)
|
|
{
|
|
flush_tlb_all();
|
|
}
|
|
|
|
#endif /* _ASM_RISCV_TLBFLUSH_H */
|