162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef _ASM_IA64_TLB_H
362306a36Sopenharmony_ci#define _ASM_IA64_TLB_H
462306a36Sopenharmony_ci/*
562306a36Sopenharmony_ci * Based on <asm-generic/tlb.h>.
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * Copyright (C) 2002-2003 Hewlett-Packard Co
862306a36Sopenharmony_ci *	David Mosberger-Tang <davidm@hpl.hp.com>
962306a36Sopenharmony_ci */
1062306a36Sopenharmony_ci/*
1162306a36Sopenharmony_ci * Removing a translation from a page table (including TLB-shootdown) is a four-step
1262306a36Sopenharmony_ci * procedure:
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci *	(1) Flush (virtual) caches --- ensures virtual memory is coherent with kernel memory
1562306a36Sopenharmony_ci *	    (this is a no-op on ia64).
1662306a36Sopenharmony_ci *	(2) Clear the relevant portions of the page-table
1762306a36Sopenharmony_ci *	(3) Flush the TLBs --- ensures that stale content is gone from CPU TLBs
1862306a36Sopenharmony_ci *	(4) Release the pages that were freed up in step (2).
1962306a36Sopenharmony_ci *
2062306a36Sopenharmony_ci * Note that the ordering of these steps is crucial to avoid races on MP machines.
2162306a36Sopenharmony_ci *
2262306a36Sopenharmony_ci * The Linux kernel defines several platform-specific hooks for TLB-shootdown.  When
2362306a36Sopenharmony_ci * unmapping a portion of the virtual address space, these hooks are called according to
2462306a36Sopenharmony_ci * the following template:
2562306a36Sopenharmony_ci *
2662306a36Sopenharmony_ci *	tlb <- tlb_gather_mmu(mm);			// start unmap for address space MM
2762306a36Sopenharmony_ci *	{
2862306a36Sopenharmony_ci *	  for each vma that needs a shootdown do {
2962306a36Sopenharmony_ci *	    tlb_start_vma(tlb, vma);
3062306a36Sopenharmony_ci *	      for each page-table-entry PTE that needs to be removed do {
3162306a36Sopenharmony_ci *		tlb_remove_tlb_entry(tlb, pte, address);
3262306a36Sopenharmony_ci *		if (pte refers to a normal page) {
3362306a36Sopenharmony_ci *		  tlb_remove_page(tlb, page);
3462306a36Sopenharmony_ci *		}
3562306a36Sopenharmony_ci *	      }
3662306a36Sopenharmony_ci *	    tlb_end_vma(tlb, vma);
3762306a36Sopenharmony_ci *	  }
3862306a36Sopenharmony_ci *	}
3962306a36Sopenharmony_ci *	tlb_finish_mmu(tlb);				// finish unmap for address space MM
4062306a36Sopenharmony_ci */
4162306a36Sopenharmony_ci#include <linux/mm.h>
4262306a36Sopenharmony_ci#include <linux/pagemap.h>
4362306a36Sopenharmony_ci#include <linux/swap.h>
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci#include <asm/processor.h>
4662306a36Sopenharmony_ci#include <asm/tlbflush.h>
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci#include <asm-generic/tlb.h>
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci#endif /* _ASM_IA64_TLB_H */
51