Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
[sfrench/cifs-2.6.git] / arch / powerpc / include / asm / book3s / 64 / tlbflush.h
index 58b576f654b373a9c5a293d52f02c988d4b1b4c4..0cac17253513d4c8aa9dc2e7e9a0157f88ecb15c 100644 (file)
@@ -8,6 +8,44 @@
 #include <asm/book3s/64/tlbflush-hash.h>
 #include <asm/book3s/64/tlbflush-radix.h>
 
+/* TLB flush actions. Used as argument to tlbiel_all() */
+enum {
+       TLB_INVAL_SCOPE_GLOBAL = 0,     /* invalidate all TLBs */
+       TLB_INVAL_SCOPE_LPID = 1,       /* invalidate TLBs for current LPID */
+};
+
+#ifdef CONFIG_PPC_NATIVE
+static inline void tlbiel_all(void)
+{
+       /*
+        * This is used for host machine check and bootup.
+        *
+        * This uses early_radix_enabled and implementations use
+        * early_cpu_has_feature etc because that works early in boot
+        * and this is the machine check path which is not performance
+        * critical.
+        */
+       if (early_radix_enabled())
+               radix__tlbiel_all(TLB_INVAL_SCOPE_GLOBAL);
+       else
+               hash__tlbiel_all(TLB_INVAL_SCOPE_GLOBAL);
+}
+#else
+static inline void tlbiel_all(void) { BUG(); };
+#endif
+
+static inline void tlbiel_all_lpid(bool radix)
+{
+       /*
+        * This is used for guest machine check.
+        */
+       if (radix)
+               radix__tlbiel_all(TLB_INVAL_SCOPE_LPID);
+       else
+               hash__tlbiel_all(TLB_INVAL_SCOPE_LPID);
+}
+
+
 #define __HAVE_ARCH_FLUSH_PMD_TLB_RANGE
 static inline void flush_pmd_tlb_range(struct vm_area_struct *vma,
                                       unsigned long start, unsigned long end)