patch-2.1.97 linux/include/asm-ppc/mmu_context.h

Next file: linux/include/asm-ppc/ohare.h
Previous file: linux/include/asm-ppc/mmu.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.96/linux/include/asm-ppc/mmu_context.h linux/include/asm-ppc/mmu_context.h
@@ -6,21 +6,44 @@
    perhaps I can defer flushing the tlb by keeping a list of
    zombie vsid/context's and handling that through destroy_context
    later -- Cort
+
+   The MPC8xx has only 16 contexts.  We rotate through them on each
+   task switch.  A better way would be to keep track of tasks that
+   own contexts, and implement an LRU usage.  That way very active
+   tasks don't always have to pay the TLB reload overhead.  The
+   kernel pages are mapped shared, so the kernel can run on behalf
+   of any task that makes a kernel entry.  Shared does not mean they
+   are not protected, just that the ASID comparison is not performed.
+        -- Dan
  */
 
-#define NO_CONTEXT	0
-#define LAST_CONTEXT	0xfffff
+#ifdef CONFIG_8xx
+#define NO_CONTEXT      16
+#define LAST_CONTEXT    15
+#else
+#define NO_CONTEXT      0
+#define LAST_CONTEXT    0xfffff
+#endif
 
 extern int next_mmu_context;
 extern void mmu_context_overflow(void);
+
+#ifndef CONFIG_8xx
 extern void set_context(int context);
+#else
+#define set_context(context)    do { } while (0)
+#endif
 
+#ifndef CONFIG_8xx
 /*
  * Allocating context numbers this way tends to spread out
  * the entries in the hash table better than a simple linear
  * allocation.
  */
-#define MUNGE_CONTEXT(n)	(((n) * 897) & LAST_CONTEXT)
+#define MUNGE_CONTEXT(n)        (((n) * 897) & LAST_CONTEXT)
+#else
+#define MUNGE_CONTEXT(n)        (n)
+#endif
 
 /*
  * Get a new mmu context for task tsk if necessary.
@@ -45,7 +68,11 @@
 /*
  * We're finished using the context for an address space.
  */
-#define destroy_context(mm)	do { } while (0)
+#ifdef CONFIG_8xx
+#define destroy_context(mm)     ((mm)->context = NO_CONTEXT)
+#else
+#define destroy_context(mm)     do { } while (0)
+#endif
 
 /*
  * compute the vsid from the context and segment

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov