blob: 820dd729b895aeecdd257b09888be3e170115c6e [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __PPC64_MMU_CONTEXT_H
2#define __PPC64_MMU_CONTEXT_H
3
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>
9
10/*
11 * Copyright (C) 2001 PPC 64 Team, IBM Corp
12 *
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.
17 */
18
Linus Torvalds1da177e2005-04-16 15:20:36 -070019static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
20{
21}
22
23#define NO_CONTEXT 0
24#define MAX_CONTEXT (0x100000-1)
25
26extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
27extern void destroy_context(struct mm_struct *mm);
28
29extern void switch_stab(struct task_struct *tsk, struct mm_struct *mm);
30extern void switch_slb(struct task_struct *tsk, struct mm_struct *mm);
31
32/*
33 * switch_mm is the entry point called from the architecture independent
34 * code in kernel/sched.c
35 */
36static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
37 struct task_struct *tsk)
38{
39 if (!cpu_isset(smp_processor_id(), next->cpu_vm_mask))
40 cpu_set(smp_processor_id(), next->cpu_vm_mask);
41
42 /* No need to flush userspace segments if the mm doesnt change */
43 if (prev == next)
44 return;
45
46#ifdef CONFIG_ALTIVEC
47 if (cpu_has_feature(CPU_FTR_ALTIVEC))
48 asm volatile ("dssall");
49#endif /* CONFIG_ALTIVEC */
50
51 if (cpu_has_feature(CPU_FTR_SLB))
52 switch_slb(tsk, next);
53 else
54 switch_stab(tsk, next);
55}
56
57#define deactivate_mm(tsk,mm) do { } while (0)
58
59/*
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.
62 */
63static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
64{
65 unsigned long flags;
66
67 local_irq_save(flags);
68 switch_mm(prev, next, current);
69 local_irq_restore(flags);
70}
71
Linus Torvalds1da177e2005-04-16 15:20:36 -070072#endif /* __PPC64_MMU_CONTEXT_H */