mfd: wm8350-i2c: Make sure the i2c regmap functions are compiled
[linux/fpc-iii.git] / arch / s390 / include / asm / tlbflush.h
blobf9fef0425feecdd808e33bcbe4a457b8ece374ac
1 #ifndef _S390_TLBFLUSH_H
2 #define _S390_TLBFLUSH_H
4 #include <linux/mm.h>
5 #include <linux/sched.h>
6 #include <asm/processor.h>
7 #include <asm/pgalloc.h>
9 /*
10 * Flush all tlb entries on the local cpu.
12 static inline void __tlb_flush_local(void)
14 asm volatile("ptlb" : : : "memory");
17 #ifdef CONFIG_SMP
19 * Flush all tlb entries on all cpus.
21 void smp_ptlb_all(void);
23 static inline void __tlb_flush_global(void)
25 register unsigned long reg2 asm("2");
26 register unsigned long reg3 asm("3");
27 register unsigned long reg4 asm("4");
28 long dummy;
30 #ifndef CONFIG_64BIT
31 if (!MACHINE_HAS_CSP) {
32 smp_ptlb_all();
33 return;
35 #endif /* CONFIG_64BIT */
37 dummy = 0;
38 reg2 = reg3 = 0;
39 reg4 = ((unsigned long) &dummy) + 1;
40 asm volatile(
41 " csp %0,%2"
42 : : "d" (reg2), "d" (reg3), "d" (reg4), "m" (dummy) : "cc" );
45 static inline void __tlb_flush_full(struct mm_struct *mm)
47 cpumask_t local_cpumask;
49 preempt_disable();
51 * If the process only ran on the local cpu, do a local flush.
53 cpumask_copy(&local_cpumask, cpumask_of(smp_processor_id()));
54 if (cpumask_equal(mm_cpumask(mm), &local_cpumask))
55 __tlb_flush_local();
56 else
57 __tlb_flush_global();
58 preempt_enable();
60 #else
61 #define __tlb_flush_full(mm) __tlb_flush_local()
62 #define __tlb_flush_global() __tlb_flush_local()
63 #endif
66 * Flush all tlb entries of a page table on all cpus.
68 static inline void __tlb_flush_idte(unsigned long asce)
70 asm volatile(
71 " .insn rrf,0xb98e0000,0,%0,%1,0"
72 : : "a" (2048), "a" (asce) : "cc" );
75 static inline void __tlb_flush_mm(struct mm_struct * mm)
78 * If the machine has IDTE we prefer to do a per mm flush
79 * on all cpus instead of doing a local flush if the mm
80 * only ran on the local cpu.
82 if (MACHINE_HAS_IDTE && list_empty(&mm->context.gmap_list))
83 __tlb_flush_idte((unsigned long) mm->pgd |
84 mm->context.asce_bits);
85 else
86 __tlb_flush_full(mm);
89 static inline void __tlb_flush_mm_lazy(struct mm_struct * mm)
91 if (mm->context.flush_mm) {
92 __tlb_flush_mm(mm);
93 mm->context.flush_mm = 0;
98 * TLB flushing:
99 * flush_tlb() - flushes the current mm struct TLBs
100 * flush_tlb_all() - flushes all processes TLBs
101 * flush_tlb_mm(mm) - flushes the specified mm context TLB's
102 * flush_tlb_page(vma, vmaddr) - flushes one page
103 * flush_tlb_range(vma, start, end) - flushes a range of pages
104 * flush_tlb_kernel_range(start, end) - flushes a range of kernel pages
108 * flush_tlb_mm goes together with ptep_set_wrprotect for the
109 * copy_page_range operation and flush_tlb_range is related to
110 * ptep_get_and_clear for change_protection. ptep_set_wrprotect and
111 * ptep_get_and_clear do not flush the TLBs directly if the mm has
112 * only one user. At the end of the update the flush_tlb_mm and
113 * flush_tlb_range functions need to do the flush.
115 #define flush_tlb() do { } while (0)
116 #define flush_tlb_all() do { } while (0)
117 #define flush_tlb_page(vma, addr) do { } while (0)
119 static inline void flush_tlb_mm(struct mm_struct *mm)
121 __tlb_flush_mm_lazy(mm);
124 static inline void flush_tlb_range(struct vm_area_struct *vma,
125 unsigned long start, unsigned long end)
127 __tlb_flush_mm_lazy(vma->vm_mm);
130 static inline void flush_tlb_kernel_range(unsigned long start,
131 unsigned long end)
133 __tlb_flush_mm(&init_mm);
136 #endif /* _S390_TLBFLUSH_H */