1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _PARISC_TLBFLUSH_H
3 #define _PARISC_TLBFLUSH_H
5 /* TLB flushing routines.... */
8 #include <linux/sched.h>
9 #include <asm/mmu_context.h>
11 extern void flush_tlb_all(void);
12 extern void flush_tlb_all_local(void *);
14 #define smp_flush_tlb_all() flush_tlb_all()
16 int __flush_tlb_range(unsigned long sid
,
17 unsigned long start
, unsigned long end
);
19 #define flush_tlb_range(vma, start, end) \
20 __flush_tlb_range((vma)->vm_mm->context, start, end)
22 #define flush_tlb_kernel_range(start, end) \
23 __flush_tlb_range(0, start, end)
28 * The code to switch to a new context is NOT valid for processes
29 * which play with the space id's. Thus, we have to preserve the
30 * space and just flush the entire tlb. However, the compilers,
31 * dynamic linker, etc, do not manipulate space id's, so there
32 * could be a significant performance benefit in switching contexts
33 * and not flushing the whole tlb.
36 static inline void flush_tlb_mm(struct mm_struct
*mm
)
38 BUG_ON(mm
== &init_mm
); /* Should never happen */
40 #if 1 || defined(CONFIG_SMP)
41 /* Except for very small threads, flushing the whole TLB is
42 * faster than using __flush_tlb_range. The pdtlb and pitlb
43 * instructions are very slow because of the TLB broadcast.
44 * It might be faster to do local range flushes on all CPUs
49 /* FIXME: currently broken, causing space id and protection ids
50 * to go out of sync, resulting in faults on userspace accesses.
51 * This approach needs further investigation since running many
52 * small applications (e.g., GCC testsuite) is faster on HP-UX.
56 free_sid(mm
->context
);
57 mm
->context
= alloc_sid();
58 if (mm
== current
->active_mm
)
59 load_context(mm
->context
);
64 static inline void flush_tlb_page(struct vm_area_struct
*vma
,
67 purge_tlb_entries(vma
->vm_mm
, addr
);