xref: /OK3568_Linux_fs/kernel/arch/ia64/include/asm/tlb.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun #ifndef _ASM_IA64_TLB_H
3*4882a593Smuzhiyun #define _ASM_IA64_TLB_H
4*4882a593Smuzhiyun /*
5*4882a593Smuzhiyun  * Based on <asm-generic/tlb.h>.
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * Copyright (C) 2002-2003 Hewlett-Packard Co
8*4882a593Smuzhiyun  *	David Mosberger-Tang <davidm@hpl.hp.com>
9*4882a593Smuzhiyun  */
10*4882a593Smuzhiyun /*
11*4882a593Smuzhiyun  * Removing a translation from a page table (including TLB-shootdown) is a four-step
12*4882a593Smuzhiyun  * procedure:
13*4882a593Smuzhiyun  *
14*4882a593Smuzhiyun  *	(1) Flush (virtual) caches --- ensures virtual memory is coherent with kernel memory
15*4882a593Smuzhiyun  *	    (this is a no-op on ia64).
16*4882a593Smuzhiyun  *	(2) Clear the relevant portions of the page-table
17*4882a593Smuzhiyun  *	(3) Flush the TLBs --- ensures that stale content is gone from CPU TLBs
18*4882a593Smuzhiyun  *	(4) Release the pages that were freed up in step (2).
19*4882a593Smuzhiyun  *
20*4882a593Smuzhiyun  * Note that the ordering of these steps is crucial to avoid races on MP machines.
21*4882a593Smuzhiyun  *
22*4882a593Smuzhiyun  * The Linux kernel defines several platform-specific hooks for TLB-shootdown.  When
23*4882a593Smuzhiyun  * unmapping a portion of the virtual address space, these hooks are called according to
24*4882a593Smuzhiyun  * the following template:
25*4882a593Smuzhiyun  *
26*4882a593Smuzhiyun  *	tlb <- tlb_gather_mmu(mm, start, end);		// start unmap for address space MM
27*4882a593Smuzhiyun  *	{
28*4882a593Smuzhiyun  *	  for each vma that needs a shootdown do {
29*4882a593Smuzhiyun  *	    tlb_start_vma(tlb, vma);
30*4882a593Smuzhiyun  *	      for each page-table-entry PTE that needs to be removed do {
31*4882a593Smuzhiyun  *		tlb_remove_tlb_entry(tlb, pte, address);
32*4882a593Smuzhiyun  *		if (pte refers to a normal page) {
33*4882a593Smuzhiyun  *		  tlb_remove_page(tlb, page);
34*4882a593Smuzhiyun  *		}
35*4882a593Smuzhiyun  *	      }
36*4882a593Smuzhiyun  *	    tlb_end_vma(tlb, vma);
37*4882a593Smuzhiyun  *	  }
38*4882a593Smuzhiyun  *	}
39*4882a593Smuzhiyun  *	tlb_finish_mmu(tlb, start, end);	// finish unmap for address space MM
40*4882a593Smuzhiyun  */
41*4882a593Smuzhiyun #include <linux/mm.h>
42*4882a593Smuzhiyun #include <linux/pagemap.h>
43*4882a593Smuzhiyun #include <linux/swap.h>
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun #include <asm/processor.h>
46*4882a593Smuzhiyun #include <asm/tlbflush.h>
47*4882a593Smuzhiyun 
48*4882a593Smuzhiyun #include <asm-generic/tlb.h>
49*4882a593Smuzhiyun 
50*4882a593Smuzhiyun #endif /* _ASM_IA64_TLB_H */
51