1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_IA64_TLBFLUSH_H
3 #define _ASM_IA64_TLBFLUSH_H
6 * Copyright (C) 2002 Hewlett-Packard Co
7 * David Mosberger-Tang <davidm@hpl.hp.com>
13 #include <asm/intrinsics.h>
14 #include <asm/mmu_context.h>
18 * Now for some TLB flushing routines. This is the kind of stuff that
19 * can be very expensive, so try to avoid them whenever possible.
21 extern void setup_ptcg_sem(int max_purges
, int from_palo
);
24 * Flush everything (kernel mapping may also have changed due to
27 extern void local_flush_tlb_all (void);
30 extern void smp_flush_tlb_all (void);
31 extern void smp_flush_tlb_mm (struct mm_struct
*mm
);
32 extern void smp_flush_tlb_cpumask (cpumask_t xcpumask
);
33 # define flush_tlb_all() smp_flush_tlb_all()
35 # define flush_tlb_all() local_flush_tlb_all()
36 # define smp_flush_tlb_cpumask(m) local_flush_tlb_all()
40 local_finish_flush_tlb_mm (struct mm_struct
*mm
)
42 if (mm
== current
->active_mm
)
47 * Flush a specified user mapping. This is called, e.g., as a result of fork() and
48 * exit(). fork() ends up here because the copy-on-write mechanism needs to write-protect
49 * the PTEs of the parent task.
52 flush_tlb_mm (struct mm_struct
*mm
)
57 set_bit(mm
->context
, ia64_ctx
.flushmap
);
60 if (atomic_read(&mm
->mm_users
) == 0)
61 return; /* happens as a result of exit_mmap() */
66 local_finish_flush_tlb_mm(mm
);
70 extern void flush_tlb_range (struct vm_area_struct
*vma
, unsigned long start
, unsigned long end
);
73 * Page-granular tlb flush.
76 flush_tlb_page (struct vm_area_struct
*vma
, unsigned long addr
)
79 flush_tlb_range(vma
, (addr
& PAGE_MASK
), (addr
& PAGE_MASK
) + PAGE_SIZE
);
81 if (vma
->vm_mm
== current
->active_mm
)
82 ia64_ptcl(addr
, (PAGE_SHIFT
<< 2));
84 vma
->vm_mm
->context
= 0;
89 * Flush the local TLB. Invoked from another cpu using an IPI.
92 void smp_local_flush_tlb(void);
94 #define smp_local_flush_tlb()
97 static inline void flush_tlb_kernel_range(unsigned long start
,
100 flush_tlb_all(); /* XXX fix me */
103 #endif /* _ASM_IA64_TLBFLUSH_H */