18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __ASM_TLBFLUSH_H
38c2ecf20Sopenharmony_ci#define __ASM_TLBFLUSH_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/mm.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci/*
88c2ecf20Sopenharmony_ci * TLB flushing:
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci *  - flush_tlb_all() flushes all processes TLB entries
118c2ecf20Sopenharmony_ci *  - flush_tlb_mm(mm) flushes the specified mm context TLB entries
128c2ecf20Sopenharmony_ci *  - flush_tlb_page(vma, vmaddr) flushes one page
138c2ecf20Sopenharmony_ci *  - flush_tlb_range(vma, start, end) flushes a range of pages
148c2ecf20Sopenharmony_ci *  - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
158c2ecf20Sopenharmony_ci */
168c2ecf20Sopenharmony_ciextern void local_flush_tlb_all(void);
178c2ecf20Sopenharmony_ciextern void local_flush_tlb_range(struct vm_area_struct *vma,
188c2ecf20Sopenharmony_ci	unsigned long start, unsigned long end);
198c2ecf20Sopenharmony_ciextern void local_flush_tlb_kernel_range(unsigned long start,
208c2ecf20Sopenharmony_ci	unsigned long end);
218c2ecf20Sopenharmony_ciextern void local_flush_tlb_page(struct vm_area_struct *vma,
228c2ecf20Sopenharmony_ci	unsigned long page);
238c2ecf20Sopenharmony_ciextern void local_flush_tlb_one(unsigned long vaddr);
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#include <asm/mmu_context.h>
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#ifdef CONFIG_SMP
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ciextern void flush_tlb_all(void);
308c2ecf20Sopenharmony_ciextern void flush_tlb_mm(struct mm_struct *);
318c2ecf20Sopenharmony_ciextern void flush_tlb_range(struct vm_area_struct *vma, unsigned long,
328c2ecf20Sopenharmony_ci	unsigned long);
338c2ecf20Sopenharmony_ciextern void flush_tlb_kernel_range(unsigned long, unsigned long);
348c2ecf20Sopenharmony_ciextern void flush_tlb_page(struct vm_area_struct *, unsigned long);
358c2ecf20Sopenharmony_ciextern void flush_tlb_one(unsigned long vaddr);
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#else /* CONFIG_SMP */
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#define flush_tlb_all()			local_flush_tlb_all()
408c2ecf20Sopenharmony_ci#define flush_tlb_mm(mm)		drop_mmu_context(mm)
418c2ecf20Sopenharmony_ci#define flush_tlb_range(vma, vmaddr, end)	local_flush_tlb_range(vma, vmaddr, end)
428c2ecf20Sopenharmony_ci#define flush_tlb_kernel_range(vmaddr,end) \
438c2ecf20Sopenharmony_ci	local_flush_tlb_kernel_range(vmaddr, end)
448c2ecf20Sopenharmony_ci#define flush_tlb_page(vma, page)	local_flush_tlb_page(vma, page)
458c2ecf20Sopenharmony_ci#define flush_tlb_one(vaddr)		local_flush_tlb_one(vaddr)
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci#endif /* CONFIG_SMP */
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci#endif /* __ASM_TLBFLUSH_H */
50