11 #ifndef _ASM_MMU_CONTEXT_H
12 #define _ASM_MMU_CONTEXT_H
14 #include <linux/errno.h>
15 #include <linux/sched.h>
17 #include <linux/slab.h>
18 #include <asm/cacheflush.h>
20 #include <asm/tlbflush.h>
21 #ifdef CONFIG_MIPS_MT_SMTC
27 #ifdef CONFIG_MIPS_PGD_C0_CONTEXT
29 #define TLBMISS_HANDLER_SETUP_PGD(pgd) \
30 tlbmiss_handler_setup_pgd((unsigned long)(pgd))
32 extern void tlbmiss_handler_setup_pgd(
unsigned long pgd);
34 #define TLBMISS_HANDLER_SETUP() \
36 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir); \
37 write_c0_xcontext((unsigned long) smp_processor_id() << 51); \
49 #define TLBMISS_HANDLER_SETUP_PGD(pgd) \
50 pgd_current[smp_processor_id()] = (unsigned long)(pgd)
53 #define TLBMISS_HANDLER_SETUP() \
54 write_c0_context((unsigned long) smp_processor_id() << 25); \
55 back_to_back_c0_hazard(); \
56 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
59 #define TLBMISS_HANDLER_SETUP() \
60 write_c0_context((unsigned long) smp_processor_id() << 26); \
61 back_to_back_c0_hazard(); \
62 TLBMISS_HANDLER_SETUP_PGD(swapper_pg_dir)
65 #if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
68 #define ASID_MASK 0xfc0
70 #elif defined(CONFIG_CPU_R8000)
73 #define ASID_MASK 0xff0
75 #elif defined(CONFIG_CPU_RM9000)
78 #define ASID_MASK 0xfff
81 #elif defined(CONFIG_MIPS_MT_SMTC)
85 #define ASID_MASK (smtc_asid_mask)
86 #define HW_ASID_MASK 0xff
91 #define ASID_MASK 0xff
95 #define cpu_context(cpu, mm) ((mm)->context.asid[cpu])
96 #define cpu_asid(cpu, mm) (cpu_context((cpu), (mm)) & ASID_MASK)
97 #define asid_cache(cpu) (cpu_data[cpu].asid_cache)
107 #define ASID_VERSION_MASK ((unsigned long)~(ASID_MASK|(ASID_MASK-1)))
108 #define ASID_FIRST_VERSION ((unsigned long)(~ASID_VERSION_MASK) + 1)
110 #ifndef CONFIG_MIPS_MT_SMTC
113 get_new_mmu_context(
struct mm_struct *mm,
unsigned long cpu)
129 #define get_new_mmu_context(mm, cpu) smtc_get_new_mmu_context((mm), (cpu))
153 #ifdef CONFIG_MIPS_MT_SMTC
154 unsigned long oldasid;
155 unsigned long mtflags;
165 get_new_mmu_context(next, cpu);
166 #ifdef CONFIG_MIPS_MT_SMTC
199 cpumask_clear_cpu(cpu, mm_cpumask(prev));
200 cpumask_set_cpu(cpu, mm_cpumask(next));
213 #define deactivate_mm(tsk, mm) do { } while (0)
225 #ifdef CONFIG_MIPS_MT_SMTC
226 unsigned long oldasid;
227 unsigned long mtflags;
234 get_new_mmu_context(next, cpu);
236 #ifdef CONFIG_MIPS_MT_SMTC
256 cpumask_clear_cpu(cpu, mm_cpumask(prev));
257 cpumask_set_cpu(cpu, mm_cpumask(next));
267 drop_mmu_context(
struct mm_struct *mm,
unsigned cpu)
270 #ifdef CONFIG_MIPS_MT_SMTC
271 unsigned long oldasid;
273 unsigned int prevvpe;
280 get_new_mmu_context(mm, cpu);
281 #ifdef CONFIG_MIPS_MT_SMTC
300 #ifndef CONFIG_MIPS_MT_SMTC