blob: 94227f0eaf6da5c0aa85b8f49548984831c0a1bd [file] [log] [blame]
Jonas Bonn61e85e32011-06-04 11:06:11 +03001/*
2 * OpenRISC Linux
3 *
4 * Linux architectural port borrowing liberally from similar works of
5 * others. All original copyrights apply as per the original source
6 * declaration.
7 *
8 * OpenRISC implementation:
9 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
10 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
11 * et al.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 */
18
19#ifndef __ASM_OPENRISC_TLBFLUSH_H
20#define __ASM_OPENRISC_TLBFLUSH_H
21
22#include <linux/mm.h>
23#include <asm/processor.h>
24#include <asm/pgtable.h>
25#include <asm/pgalloc.h>
26#include <asm/current.h>
27#include <linux/sched.h>
28
29/*
30 * - flush_tlb() flushes the current mm struct TLBs
31 * - flush_tlb_all() flushes all processes TLBs
32 * - flush_tlb_mm(mm) flushes the specified mm context TLB's
33 * - flush_tlb_page(vma, vmaddr) flushes one page
34 * - flush_tlb_range(mm, start, end) flushes a range of pages
35 */
Stefan Kristiansson8e6d08e2014-05-11 21:49:34 +030036extern void local_flush_tlb_all(void);
37extern void local_flush_tlb_mm(struct mm_struct *mm);
38extern void local_flush_tlb_page(struct vm_area_struct *vma,
39 unsigned long addr);
40extern void local_flush_tlb_range(struct vm_area_struct *vma,
41 unsigned long start,
42 unsigned long end);
Jonas Bonn61e85e32011-06-04 11:06:11 +030043
Stefan Kristiansson8e6d08e2014-05-11 21:49:34 +030044#ifndef CONFIG_SMP
45#define flush_tlb_all local_flush_tlb_all
46#define flush_tlb_mm local_flush_tlb_mm
47#define flush_tlb_page local_flush_tlb_page
48#define flush_tlb_range local_flush_tlb_range
49#else
50extern void flush_tlb_all(void);
51extern void flush_tlb_mm(struct mm_struct *mm);
52extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long addr);
53extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
54 unsigned long end);
55#endif
Jonas Bonn61e85e32011-06-04 11:06:11 +030056
57static inline void flush_tlb(void)
58{
59 flush_tlb_mm(current->mm);
60}
61
62static inline void flush_tlb_kernel_range(unsigned long start,
63 unsigned long end)
64{
65 flush_tlb_range(NULL, start, end);
66}
67
68#endif /* __ASM_OPENRISC_TLBFLUSH_H */