2 * linux/arch/arm/kernel/smp_tlb.c
4 * Copyright (C) 2002 ARM Limited, All Rights Reserved.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 #include <linux/preempt.h>
11 #include <linux/smp.h>
13 #include <asm/smp_plat.h>
14 #include <asm/tlbflush.h>
16 /**********************************************************************/
22 struct vm_area_struct *ta_vma;
23 unsigned long ta_start;
27 static inline void ipi_flush_tlb_all(void *ignored)
29 local_flush_tlb_all();
32 static inline void ipi_flush_tlb_mm(void *arg)
34 struct mm_struct *mm = (struct mm_struct *)arg;
36 local_flush_tlb_mm(mm);
39 static inline void ipi_flush_tlb_page(void *arg)
41 struct tlb_args *ta = (struct tlb_args *)arg;
43 local_flush_tlb_page(ta->ta_vma, ta->ta_start);
46 static inline void ipi_flush_tlb_kernel_page(void *arg)
48 struct tlb_args *ta = (struct tlb_args *)arg;
50 local_flush_tlb_kernel_page(ta->ta_start);
53 static inline void ipi_flush_tlb_range(void *arg)
55 struct tlb_args *ta = (struct tlb_args *)arg;
57 local_flush_tlb_range(ta->ta_vma, ta->ta_start, ta->ta_end);
60 static inline void ipi_flush_tlb_kernel_range(void *arg)
62 struct tlb_args *ta = (struct tlb_args *)arg;
64 local_flush_tlb_kernel_range(ta->ta_start, ta->ta_end);
67 static inline void ipi_flush_bp_all(void *ignored)
72 void flush_tlb_all(void)
74 if (tlb_ops_need_broadcast())
75 on_each_cpu(ipi_flush_tlb_all, NULL, 1);
77 local_flush_tlb_all();
80 void flush_tlb_mm(struct mm_struct *mm)
82 if (tlb_ops_need_broadcast())
83 on_each_cpu_mask(mm_cpumask(mm), ipi_flush_tlb_mm, mm, 1);
85 local_flush_tlb_mm(mm);
88 void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr)
90 if (tlb_ops_need_broadcast()) {
94 on_each_cpu_mask(mm_cpumask(vma->vm_mm), ipi_flush_tlb_page,
97 local_flush_tlb_page(vma, uaddr);
100 void flush_tlb_kernel_page(unsigned long kaddr)
102 if (tlb_ops_need_broadcast()) {
105 on_each_cpu(ipi_flush_tlb_kernel_page, &ta, 1);
107 local_flush_tlb_kernel_page(kaddr);
110 void flush_tlb_range(struct vm_area_struct *vma,
111 unsigned long start, unsigned long end)
113 if (tlb_ops_need_broadcast()) {
118 on_each_cpu_mask(mm_cpumask(vma->vm_mm), ipi_flush_tlb_range,
121 local_flush_tlb_range(vma, start, end);
124 void flush_tlb_kernel_range(unsigned long start, unsigned long end)
126 if (tlb_ops_need_broadcast()) {
130 on_each_cpu(ipi_flush_tlb_kernel_range, &ta, 1);
132 local_flush_tlb_kernel_range(start, end);
135 void flush_bp_all(void)
137 if (tlb_ops_need_broadcast())
138 on_each_cpu(ipi_flush_bp_all, NULL, 1);
140 local_flush_bp_all();