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