blob: 5d54bf57e6c358fae064d8616e505d463d59d1dc [file] [log] [blame]
David Howellsb920de12008-02-08 04:19:31 -08001/* MN10300 TLB flushing functions
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_TLBFLUSH_H
12#define _ASM_TLBFLUSH_H
13
14#include <asm/processor.h>
15
David Howells492e6752010-10-27 17:28:49 +010016/**
17 * local_flush_tlb - Flush the current MM's entries from the local CPU's TLBs
18 */
19static inline void local_flush_tlb(void)
20{
21 int w;
22 asm volatile(
23 " mov %1,%0 \n"
24 " or %2,%0 \n"
25 " mov %0,%1 \n"
26 : "=d"(w)
27 : "m"(MMUCTR), "i"(MMUCTR_IIV|MMUCTR_DIV)
28 : "cc", "memory");
29}
David Howellsb920de12008-02-08 04:19:31 -080030
David Howells492e6752010-10-27 17:28:49 +010031/**
32 * local_flush_tlb_all - Flush all entries from the local CPU's TLBs
33 */
34#define local_flush_tlb_all() local_flush_tlb()
35
36/**
37 * local_flush_tlb_one - Flush one entry from the local CPU's TLBs
38 */
39#define local_flush_tlb_one(addr) local_flush_tlb()
40
41/**
42 * local_flush_tlb_page - Flush a page's entry from the local CPU's TLBs
43 * @mm: The MM to flush for
44 * @addr: The address of the target page in RAM (not its page struct)
45 */
46extern void local_flush_tlb_page(struct mm_struct *mm, unsigned long addr);
David Howellsb920de12008-02-08 04:19:31 -080047
48
49/*
50 * TLB flushing:
51 *
52 * - flush_tlb() flushes the current mm struct TLBs
53 * - flush_tlb_all() flushes all processes TLBs
54 * - flush_tlb_mm(mm) flushes the specified mm context TLB's
55 * - flush_tlb_page(vma, vmaddr) flushes one page
56 * - flush_tlb_range(mm, start, end) flushes a range of pages
57 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
58 */
59#define flush_tlb_all() \
60do { \
61 preempt_disable(); \
David Howells492e6752010-10-27 17:28:49 +010062 local_flush_tlb_all(); \
David Howellsb920de12008-02-08 04:19:31 -080063 preempt_enable(); \
64} while (0)
65
66#define flush_tlb_mm(mm) \
67do { \
68 preempt_disable(); \
David Howells492e6752010-10-27 17:28:49 +010069 local_flush_tlb_all(); \
David Howellsb920de12008-02-08 04:19:31 -080070 preempt_enable(); \
71} while (0)
72
73#define flush_tlb_range(vma, start, end) \
74do { \
75 unsigned long __s __attribute__((unused)) = (start); \
76 unsigned long __e __attribute__((unused)) = (end); \
77 preempt_disable(); \
David Howells492e6752010-10-27 17:28:49 +010078 local_flush_tlb_all(); \
David Howellsb920de12008-02-08 04:19:31 -080079 preempt_enable(); \
80} while (0)
81
David Howells492e6752010-10-27 17:28:49 +010082#define flush_tlb_page(vma, addr) local_flush_tlb_page((vma)->vm_mm, addr)
83#define flush_tlb() flush_tlb_all()
David Howellsb920de12008-02-08 04:19:31 -080084
David Howellsb920de12008-02-08 04:19:31 -080085#define flush_tlb_kernel_range(start, end) \
86do { \
87 unsigned long __s __attribute__((unused)) = (start); \
88 unsigned long __e __attribute__((unused)) = (end); \
89 flush_tlb_all(); \
90} while (0)
91
David Howellsb920de12008-02-08 04:19:31 -080092#define flush_tlb_pgtables(mm, start, end) do {} while (0)
93
94#endif /* _ASM_TLBFLUSH_H */