blob: e9a7f0b35a15bb4757d1f411f233a02b33319acf [file] [log] [blame]
David Brazdil0f672f62019-12-10 10:32:29 +00001/* SPDX-License-Identifier: GPL-2.0-or-later */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002/*
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.
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000013 */
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/pgtable.h>
21#include <asm/pgalloc.h>
22#include <asm/current.h>
23#include <linux/sched.h>
24
25/*
26 * - flush_tlb() flushes the current mm struct TLBs
27 * - flush_tlb_all() flushes all processes TLBs
28 * - flush_tlb_mm(mm) flushes the specified mm context TLB's
29 * - flush_tlb_page(vma, vmaddr) flushes one page
30 * - flush_tlb_range(mm, start, end) flushes a range of pages
31 */
32extern void local_flush_tlb_all(void);
33extern void local_flush_tlb_mm(struct mm_struct *mm);
34extern void local_flush_tlb_page(struct vm_area_struct *vma,
35 unsigned long addr);
36extern void local_flush_tlb_range(struct vm_area_struct *vma,
37 unsigned long start,
38 unsigned long end);
39
40#ifndef CONFIG_SMP
41#define flush_tlb_all local_flush_tlb_all
42#define flush_tlb_mm local_flush_tlb_mm
43#define flush_tlb_page local_flush_tlb_page
44#define flush_tlb_range local_flush_tlb_range
45#else
46extern void flush_tlb_all(void);
47extern void flush_tlb_mm(struct mm_struct *mm);
48extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr);
49extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
50 unsigned long end);
51#endif
52
53static inline void flush_tlb(void)
54{
55 flush_tlb_mm(current->mm);
56}
57
58static inline void flush_tlb_kernel_range(unsigned long start,
59 unsigned long end)
60{
61 flush_tlb_range(NULL, start, end);
62}
63
64#endif /* __ASM_OPENRISC_TLBFLUSH_H */