aboutsummaryrefslogtreecommitdiff
path: root/arch/metag/include/asm/tlbflush.h
blob: 566acf918a646a7601d523a51bfdd16eed7e73bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef __ASM_METAG_TLBFLUSH_H
#define __ASM_METAG_TLBFLUSH_H

#include <linux/io.h>
#include <linux/sched.h>
#include <asm/metag_mem.h>
#include <asm/pgalloc.h>

/*
 * TLB flushing:
 *
 *  - flush_tlb() flushes the current mm struct TLBs
 *  - flush_tlb_all() flushes all processes TLBs
 *  - flush_tlb_mm(mm) flushes the specified mm context TLB's
 *  - flush_tlb_page(vma, vmaddr) flushes one page
 *  - flush_tlb_range(mm, start, end) flushes a range of pages
 *  - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
 *  - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
 *
 * FIXME: Meta 2 can flush single TLB entries.
 *
 */

#if defined(CONFIG_METAG_META21) && !defined(CONFIG_SMP)
static inline void __flush_tlb(void)
{
	/* flush TLB entries for just the current hardware thread */
	int thread = hard_processor_id();
	metag_out32(0, (LINSYSCFLUSH_TxMMCU_BASE +
			LINSYSCFLUSH_TxMMCU_STRIDE * thread));
}
#else
static inline void __flush_tlb(void)
{
	/* flush TLB entries for all hardware threads */
	metag_out32(0, LINSYSCFLUSH_MMCU);
}
#endif /* defined(CONFIG_METAG_META21) && !defined(CONFIG_SMP) */

#define flush_tlb() __flush_tlb()

#define flush_tlb_all() __flush_tlb()

#define local_flush_tlb_all() __flush_tlb()

static inline void flush_tlb_mm(struct mm_struct *mm)
{
	if (mm == current->active_mm)
		__flush_tlb();
}

static inline void flush_tlb_page(struct vm_area_struct *vma,
				  unsigned long addr)
{
	flush_tlb_mm(vma->vm_mm);
}

static inline void flush_tlb_range(struct vm_area_struct *vma,
				   unsigned long start, unsigned long end)
{
	flush_tlb_mm(vma->vm_mm);
}

static inline void flush_tlb_pgtables(struct mm_struct *mm,
				      unsigned long start, unsigned long end)
{
	flush_tlb_mm(mm);
}

static inline void flush_tlb_kernel_range(unsigned long start,
					  unsigned long end)
{
	flush_tlb_all();
}

#endif /* __ASM_METAG_TLBFLUSH_H */