Merge ../linux-2.6
[linux-2.6/kvm.git] / include / asm-ppc64 / mmu_context.h
blob820dd729b895aeecdd257b09888be3e170115c6e
1 #ifndef __PPC64_MMU_CONTEXT_H
2 #define __PPC64_MMU_CONTEXT_H
4 #include <linux/config.h>
5 #include <linux/kernel.h>
6 #include <linux/mm.h>
7 #include <asm/mmu.h>
8 #include <asm/cputable.h>
11 * Copyright (C) 2001 PPC 64 Team, IBM Corp
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version
16 * 2 of the License, or (at your option) any later version.
19 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
23 #define NO_CONTEXT 0
24 #define MAX_CONTEXT (0x100000-1)
26 extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
27 extern void destroy_context(struct mm_struct *mm);
29 extern void switch_stab(struct task_struct *tsk, struct mm_struct *mm);
30 extern void switch_slb(struct task_struct *tsk, struct mm_struct *mm);
33 * switch_mm is the entry point called from the architecture independent
34 * code in kernel/sched.c
36 static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
37 struct task_struct *tsk)
39 if (!cpu_isset(smp_processor_id(), next->cpu_vm_mask))
40 cpu_set(smp_processor_id(), next->cpu_vm_mask);
42 /* No need to flush userspace segments if the mm doesnt change */
43 if (prev == next)
44 return;
46 #ifdef CONFIG_ALTIVEC
47 if (cpu_has_feature(CPU_FTR_ALTIVEC))
48 asm volatile ("dssall");
49 #endif /* CONFIG_ALTIVEC */
51 if (cpu_has_feature(CPU_FTR_SLB))
52 switch_slb(tsk, next);
53 else
54 switch_stab(tsk, next);
57 #define deactivate_mm(tsk,mm) do { } while (0)
60 * After we have set current->mm to a new value, this activates
61 * the context for the new mm so we see the new mappings.
63 static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
65 unsigned long flags;
67 local_irq_save(flags);
68 switch_mm(prev, next, current);
69 local_irq_restore(flags);
72 #endif /* __PPC64_MMU_CONTEXT_H */