1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * OpenRISC Linux
4 *
5 * Linux architectural port borrowing liberally from similar works of
6 * others. All original copyrights apply as per the original source
7 * declaration.
8 *
9 * OpenRISC implementation:
10 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
11 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
12 * et al.
13 */
14
15 #ifndef __ASM_OPENRISC_TLBFLUSH_H
16 #define __ASM_OPENRISC_TLBFLUSH_H
17
18 #include <linux/mm.h>
19 #include <asm/processor.h>
20 #include <asm/current.h>
21 #include <linux/sched.h>
22
23 /*
24 * - flush_tlb() flushes the current mm struct TLBs
25 * - flush_tlb_all() flushes all processes TLBs
26 * - flush_tlb_mm(mm) flushes the specified mm context TLB's
27 * - flush_tlb_page(vma, vmaddr) flushes one page
28 * - flush_tlb_range(mm, start, end) flushes a range of pages
29 */
30 extern void local_flush_tlb_all(void);
31 extern void local_flush_tlb_mm(struct mm_struct *mm);
32 extern void local_flush_tlb_page(struct vm_area_struct *vma,
33 unsigned long addr);
34 extern void local_flush_tlb_range(struct vm_area_struct *vma,
35 unsigned long start,
36 unsigned long end);
37
38 #ifndef CONFIG_SMP
39 #define flush_tlb_all local_flush_tlb_all
40 #define flush_tlb_mm local_flush_tlb_mm
41 #define flush_tlb_page local_flush_tlb_page
42 #define flush_tlb_range local_flush_tlb_range
43 #else
44 extern void flush_tlb_all(void);
45 extern void flush_tlb_mm(struct mm_struct *mm);
46 extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr);
47 extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
48 unsigned long end);
49 #endif
50
flush_tlb(void)51 static inline void flush_tlb(void)
52 {
53 flush_tlb_mm(current->mm);
54 }
55
flush_tlb_kernel_range(unsigned long start,unsigned long end)56 static inline void flush_tlb_kernel_range(unsigned long start,
57 unsigned long end)
58 {
59 flush_tlb_range(NULL, start, end);
60 }
61
62 #endif /* __ASM_OPENRISC_TLBFLUSH_H */
63