162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef _SPARC64_TLB_H
362306a36Sopenharmony_ci#define _SPARC64_TLB_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include <linux/swap.h>
662306a36Sopenharmony_ci#include <linux/pagemap.h>
762306a36Sopenharmony_ci#include <asm/tlbflush.h>
862306a36Sopenharmony_ci#include <asm/mmu_context.h>
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#ifdef CONFIG_SMP
1162306a36Sopenharmony_civoid smp_flush_tlb_pending(struct mm_struct *,
1262306a36Sopenharmony_ci				  unsigned long, unsigned long *);
1362306a36Sopenharmony_ci#endif
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#ifdef CONFIG_SMP
1662306a36Sopenharmony_civoid smp_flush_tlb_mm(struct mm_struct *mm);
1762306a36Sopenharmony_ci#define do_flush_tlb_mm(mm) smp_flush_tlb_mm(mm)
1862306a36Sopenharmony_ci#else
1962306a36Sopenharmony_ci#define do_flush_tlb_mm(mm) __flush_tlb_mm(CTX_HWBITS(mm->context), SECONDARY_CONTEXT)
2062306a36Sopenharmony_ci#endif
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_civoid __flush_tlb_pending(unsigned long, unsigned long, unsigned long *);
2362306a36Sopenharmony_civoid flush_tlb_pending(void);
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci#define tlb_flush(tlb)	flush_tlb_pending()
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci/*
2862306a36Sopenharmony_ci * SPARC64's hardware TLB fill does not use the Linux page-tables
2962306a36Sopenharmony_ci * and therefore we don't need a TLBI when freeing page-table pages.
3062306a36Sopenharmony_ci */
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci#ifdef CONFIG_MMU_GATHER_RCU_TABLE_FREE
3362306a36Sopenharmony_ci#define tlb_needs_table_invalidate()	(false)
3462306a36Sopenharmony_ci#endif
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci#include <asm-generic/tlb.h>
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#endif /* _SPARC64_TLB_H */
39