1#ifndef __ASM_POWERPC_MMU_CONTEXT_H
2#define __ASM_POWERPC_MMU_CONTEXT_H
3#ifdef __KERNEL__
4
5#include <linux/kernel.h>
6#include <linux/mm.h>
7#include <linux/sched.h>
8#include <linux/spinlock.h>
9#include <asm/mmu.h>
10#include <asm/cputable.h>
11#include <asm-generic/mm_hooks.h>
12#include <asm/cputhreads.h>
13
14
15
16
17extern void mmu_context_init(void);
18extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
19extern void destroy_context(struct mm_struct *mm);
20
21extern void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next);
22extern void switch_stab(struct task_struct *tsk, struct mm_struct *mm);
23extern void switch_slb(struct task_struct *tsk, struct mm_struct *mm);
24extern void set_context(unsigned long id, pgd_t *pgd);
25
26
27
28
29
30static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
31 struct task_struct *tsk)
32{
33
34 cpumask_set_cpu(smp_processor_id(), mm_cpumask(next));
35
36
37#ifdef CONFIG_PPC32
38 tsk->thread.pgdir = next->pgd;
39#endif
40
41
42 if (prev == next)
43 return;
44
45
46
47
48#ifdef CONFIG_ALTIVEC
49 if (cpu_has_feature(CPU_FTR_ALTIVEC))
50 asm volatile ("dssall");
51#endif
52
53
54
55
56#ifdef CONFIG_PPC_STD_MMU_64
57 if (cpu_has_feature(CPU_FTR_SLB))
58 switch_slb(tsk, next);
59 else
60 switch_stab(tsk, next);
61#else
62
63 switch_mmu_context(prev, next);
64#endif
65
66}
67
68#define deactivate_mm(tsk,mm) do { } while (0)
69
70
71
72
73
74static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
75{
76 unsigned long flags;
77
78 local_irq_save(flags);
79 switch_mm(prev, next, current);
80 local_irq_restore(flags);
81}
82
83
84static inline void enter_lazy_tlb(struct mm_struct *mm,
85 struct task_struct *tsk)
86{
87}
88
89#endif
90#endif
91