2019-05-29 10:18:00 -04:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2017-07-10 21:02:19 -04:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
|
2017-10-25 17:30:32 -04:00
|
|
|
#include <linux/mm_types.h>
|
2018-10-02 15:15:05 -04:00
|
|
|
#include <asm/smp.h>
|
2017-10-25 17:30:32 -04:00
|
|
|
|
2017-07-10 21:02:19 -04:00
|
|
|
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");
|
|
|
|
}
|
|
|
|
|
2019-08-21 10:58:37 -04:00
|
|
|
#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 */
|
2017-07-10 21:02:19 -04:00
|
|
|
#define flush_tlb_all() local_flush_tlb_all()
|
|
|
|
#define flush_tlb_page(vma, addr) local_flush_tlb_page(addr)
|
2017-10-26 04:53:40 -04:00
|
|
|
|
|
|
|
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()
|
2017-07-10 21:02:19 -04:00
|
|
|
#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 */
|