Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / include / asm-parisc / tlbflush.h
index 86ba2c7..f662e83 100644 (file)
@@ -3,11 +3,25 @@
 
 /* TLB flushing routines.... */
 
-#include <linux/config.h>
 #include <linux/mm.h>
 #include <asm/mmu_context.h>
 
+
+/* This is for the serialisation of PxTLB broadcasts.  At least on the
+ * N class systems, only one PxTLB inter processor broadcast can be
+ * active at any one time on the Merced bus.  This tlb purge
+ * synchronisation is fairly lightweight and harmless so we activate
+ * it on all SMP systems not just the N class.  We also need to have
+ * preemption disabled on uniprocessor machines, and spin_lock does that
+ * nicely.
+ */
+extern spinlock_t pa_tlb_lock;
+
+#define purge_tlb_start(x) spin_lock(&pa_tlb_lock)
+#define purge_tlb_end(x) spin_unlock(&pa_tlb_lock)
+
 extern void flush_tlb_all(void);
+extern void flush_tlb_all_local(void *);
 
 /*
  * flush_tlb_mm()
@@ -51,9 +65,12 @@ static inline void flush_tlb_page(struct vm_area_struct *vma,
 {
        /* For one page, it's not worth testing the split_tlb variable */
 
+       mb();
        mtsp(vma->vm_mm->context,1);
+       purge_tlb_start();
        pdtlb(addr);
        pitlb(addr);
+       purge_tlb_end();
 }
 
 static inline void flush_tlb_range(struct vm_area_struct *vma,
@@ -62,11 +79,11 @@ static inline void flush_tlb_range(struct vm_area_struct *vma,
        unsigned long npages;
 
        npages = ((end - (start & PAGE_MASK)) + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
-       if (npages >= 512)  /* XXX arbitrary, should be tuned */
+       if (npages >= 512)  /* 2MB of space: arbitrary, should be tuned */
                flush_tlb_all();
        else {
-
                mtsp(vma->vm_mm->context,1);
+               purge_tlb_start();
                if (split_tlb) {
                        while (npages--) {
                                pdtlb(start);
@@ -79,6 +96,7 @@ static inline void flush_tlb_range(struct vm_area_struct *vma,
                                start += PAGE_SIZE;
                        }
                }
+               purge_tlb_end();
        }
 }