162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#ifndef _ASM_NIOS2_TLBFLUSH_H
762306a36Sopenharmony_ci#define _ASM_NIOS2_TLBFLUSH_H
862306a36Sopenharmony_ci
962306a36Sopenharmony_cistruct mm_struct;
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci/*
1262306a36Sopenharmony_ci * TLB flushing:
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci *  - flush_tlb_all() flushes all processes TLB entries
1562306a36Sopenharmony_ci *  - flush_tlb_mm(mm) flushes the specified mm context TLB entries
1662306a36Sopenharmony_ci *  - flush_tlb_range(vma, start, end) flushes a range of pages
1762306a36Sopenharmony_ci *  - flush_tlb_page(vma, address) flushes a page
1862306a36Sopenharmony_ci *  - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
1962306a36Sopenharmony_ci *  - flush_tlb_kernel_page(address) flushes a kernel page
2062306a36Sopenharmony_ci *
2162306a36Sopenharmony_ci *  - reload_tlb_page(vma, address, pte) flushes the TLB for address like
2262306a36Sopenharmony_ci *    flush_tlb_page, then replaces it with a TLB for pte.
2362306a36Sopenharmony_ci */
2462306a36Sopenharmony_ciextern void flush_tlb_all(void);
2562306a36Sopenharmony_ciextern void flush_tlb_mm(struct mm_struct *mm);
2662306a36Sopenharmony_ciextern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
2762306a36Sopenharmony_ci			    unsigned long end);
2862306a36Sopenharmony_ciextern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_cistatic inline void flush_tlb_page(struct vm_area_struct *vma,
3162306a36Sopenharmony_ci				  unsigned long address)
3262306a36Sopenharmony_ci{
3362306a36Sopenharmony_ci	flush_tlb_range(vma, address, address + PAGE_SIZE);
3462306a36Sopenharmony_ci}
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_cistatic inline void flush_tlb_kernel_page(unsigned long address)
3762306a36Sopenharmony_ci{
3862306a36Sopenharmony_ci	flush_tlb_kernel_range(address, address + PAGE_SIZE);
3962306a36Sopenharmony_ci}
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ciextern void reload_tlb_page(struct vm_area_struct *vma, unsigned long addr,
4262306a36Sopenharmony_ci			    pte_t pte);
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci#endif /* _ASM_NIOS2_TLBFLUSH_H */
45