18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2020 Loongson Technology Corporation Limited
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci#ifndef __ASM_TLBFLUSH_H
68c2ecf20Sopenharmony_ci#define __ASM_TLBFLUSH_H
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#include <linux/mm.h>
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci/*
118c2ecf20Sopenharmony_ci * TLB flushing:
128c2ecf20Sopenharmony_ci *
138c2ecf20Sopenharmony_ci *  - flush_tlb_all() flushes all processes TLB entries
148c2ecf20Sopenharmony_ci *  - flush_tlb_mm(mm) flushes the specified mm context TLB entries
158c2ecf20Sopenharmony_ci *  - flush_tlb_page(vma, vmaddr) flushes one page
168c2ecf20Sopenharmony_ci *  - flush_tlb_range(vma, start, end) flushes a range of pages
178c2ecf20Sopenharmony_ci *  - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
188c2ecf20Sopenharmony_ci */
198c2ecf20Sopenharmony_ciextern void local_flush_tlb_all(void);
208c2ecf20Sopenharmony_ciextern void local_flush_tlb_user(void);
218c2ecf20Sopenharmony_ciextern void local_flush_tlb_kernel(void);
228c2ecf20Sopenharmony_ciextern void local_flush_tlb_mm(struct mm_struct *mm);
238c2ecf20Sopenharmony_ciextern void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start, unsigned long end);
248c2ecf20Sopenharmony_ciextern void local_flush_tlb_kernel_range(unsigned long start, unsigned long end);
258c2ecf20Sopenharmony_ciextern void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page);
268c2ecf20Sopenharmony_ciextern void local_flush_tlb_one(unsigned long vaddr);
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#ifdef CONFIG_SMP
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ciextern void flush_tlb_all(void);
318c2ecf20Sopenharmony_ciextern void flush_tlb_mm(struct mm_struct *);
328c2ecf20Sopenharmony_ciextern void flush_tlb_range(struct vm_area_struct *vma, unsigned long, 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)		local_flush_tlb_mm(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)	local_flush_tlb_kernel_range(vmaddr, end)
438c2ecf20Sopenharmony_ci#define flush_tlb_page(vma, page)	local_flush_tlb_page(vma, page)
448c2ecf20Sopenharmony_ci#define flush_tlb_one(vaddr)		local_flush_tlb_one(vaddr)
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci#endif /* CONFIG_SMP */
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci#endif /* __ASM_TLBFLUSH_H */
49