1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_METAG_TLBFLUSH_H
3 #define __ASM_METAG_TLBFLUSH_H
6 #include <linux/sched.h>
7 #include <asm/metag_mem.h>
8 #include <asm/pgalloc.h>
13 * - flush_tlb() flushes the current mm struct TLBs
14 * - flush_tlb_all() flushes all processes TLBs
15 * - flush_tlb_mm(mm) flushes the specified mm context TLB's
16 * - flush_tlb_page(vma, vmaddr) flushes one page
17 * - flush_tlb_range(mm, start, end) flushes a range of pages
18 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
19 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
21 * FIXME: Meta 2 can flush single TLB entries.
25 #if defined(CONFIG_METAG_META21) && !defined(CONFIG_SMP)
26 static inline void __flush_tlb(void)
28 /* flush TLB entries for just the current hardware thread */
29 int thread = hard_processor_id();
30 metag_out32(0, (LINSYSCFLUSH_TxMMCU_BASE +
31 LINSYSCFLUSH_TxMMCU_STRIDE * thread));
34 static inline void __flush_tlb(void)
36 /* flush TLB entries for all hardware threads */
37 metag_out32(0, LINSYSCFLUSH_MMCU);
39 #endif /* defined(CONFIG_METAG_META21) && !defined(CONFIG_SMP) */
41 #define flush_tlb() __flush_tlb()
43 #define flush_tlb_all() __flush_tlb()
45 #define local_flush_tlb_all() __flush_tlb()
47 static inline void flush_tlb_mm(struct mm_struct *mm)
49 if (mm == current->active_mm)
53 static inline void flush_tlb_page(struct vm_area_struct *vma,
56 flush_tlb_mm(vma->vm_mm);
59 static inline void flush_tlb_range(struct vm_area_struct *vma,
60 unsigned long start, unsigned long end)
62 flush_tlb_mm(vma->vm_mm);
65 static inline void flush_tlb_pgtables(struct mm_struct *mm,
66 unsigned long start, unsigned long end)
71 static inline void flush_tlb_kernel_range(unsigned long start,
77 #endif /* __ASM_METAG_TLBFLUSH_H */