2 * linux/include/asm-arm/mmu_context.h
4 * Copyright (C) 1996 Russell King.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 * 27-06-1996 RMK Created
13 #ifndef __ASM_ARM_MMU_CONTEXT_H
14 #define __ASM_ARM_MMU_CONTEXT_H
16 #include <asm/proc-fns.h>
18 #if __LINUX_ARM_ARCH__ >= 6
21 * On ARMv6, we have the following structure in the Context ID:
24 * +-------------------------+-----------+
25 * | process ID | ASID |
26 * +-------------------------+-----------+
28 * +-------------------------------------+
30 * The ASID is used to tag entries in the CPU caches and TLBs.
31 * The context ID is used by debuggers and trace logic, and
32 * should be unique within all running processes.
35 #define ASID_MASK ((~0) << ASID_BITS)
37 extern unsigned int cpu_last_asid;
39 void __init_new_context(struct task_struct *tsk, struct mm_struct *mm);
40 void __new_context(struct mm_struct *mm);
42 static inline void check_context(struct mm_struct *mm)
44 if (unlikely((mm->context.id ^ cpu_last_asid) >> ASID_BITS))
48 #define init_new_context(tsk,mm) (__init_new_context(tsk,mm),0)
52 #define check_context(mm) do { } while (0)
53 #define init_new_context(tsk,mm) 0
57 #define destroy_context(mm) do { } while(0)
60 * This is called when "tsk" is about to enter lazy TLB mode.
62 * mm: describes the currently active mm context
63 * tsk: task which is entering lazy tlb
64 * cpu: cpu number which is entering lazy tlb
66 * tsk->mm will be NULL
69 enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
74 * This is the actual mm switch as far as the scheduler
75 * is concerned. No registers are touched. We avoid
76 * calling the CPU specific function when the mm hasn't
80 switch_mm(struct mm_struct *prev, struct mm_struct *next,
81 struct task_struct *tsk)
83 unsigned int cpu = smp_processor_id();
86 cpu_set(cpu, next->cpu_vm_mask);
88 cpu_switch_mm(next->pgd, next);
89 cpu_clear(cpu, prev->cpu_vm_mask);
93 #define deactivate_mm(tsk,mm) do { } while (0)
94 #define activate_mm(prev,next) switch_mm(prev, next, NULL)