18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef _ASM_NIOS2_TLBFLUSH_H
78c2ecf20Sopenharmony_ci#define _ASM_NIOS2_TLBFLUSH_H
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_cistruct mm_struct;
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/*
128c2ecf20Sopenharmony_ci * TLB flushing:
138c2ecf20Sopenharmony_ci *
148c2ecf20Sopenharmony_ci *  - flush_tlb_all() flushes all processes TLB entries
158c2ecf20Sopenharmony_ci *  - flush_tlb_mm(mm) flushes the specified mm context TLB entries
168c2ecf20Sopenharmony_ci *  - flush_tlb_range(vma, start, end) flushes a range of pages
178c2ecf20Sopenharmony_ci *  - flush_tlb_page(vma, address) flushes a page
188c2ecf20Sopenharmony_ci *  - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
198c2ecf20Sopenharmony_ci *  - flush_tlb_kernel_page(address) flushes a kernel page
208c2ecf20Sopenharmony_ci *
218c2ecf20Sopenharmony_ci *  - reload_tlb_page(vma, address, pte) flushes the TLB for address like
228c2ecf20Sopenharmony_ci *    flush_tlb_page, then replaces it with a TLB for pte.
238c2ecf20Sopenharmony_ci */
248c2ecf20Sopenharmony_ciextern void flush_tlb_all(void);
258c2ecf20Sopenharmony_ciextern void flush_tlb_mm(struct mm_struct *mm);
268c2ecf20Sopenharmony_ciextern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
278c2ecf20Sopenharmony_ci			    unsigned long end);
288c2ecf20Sopenharmony_ciextern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_cistatic inline void flush_tlb_page(struct vm_area_struct *vma,
318c2ecf20Sopenharmony_ci				  unsigned long address)
328c2ecf20Sopenharmony_ci{
338c2ecf20Sopenharmony_ci	flush_tlb_range(vma, address, address + PAGE_SIZE);
348c2ecf20Sopenharmony_ci}
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_cistatic inline void flush_tlb_kernel_page(unsigned long address)
378c2ecf20Sopenharmony_ci{
388c2ecf20Sopenharmony_ci	flush_tlb_kernel_range(address, address + PAGE_SIZE);
398c2ecf20Sopenharmony_ci}
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciextern void reload_tlb_page(struct vm_area_struct *vma, unsigned long addr,
428c2ecf20Sopenharmony_ci			    pte_t pte);
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci#endif /* _ASM_NIOS2_TLBFLUSH_H */
45