Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * include/asm-s390/mmu_context.h |
| 3 | * |
| 4 | * S390 version |
| 5 | * |
| 6 | * Derived from "include/asm-i386/mmu_context.h" |
| 7 | */ |
| 8 | |
| 9 | #ifndef __S390_MMU_CONTEXT_H |
| 10 | #define __S390_MMU_CONTEXT_H |
| 11 | |
Gerald Schaefer | c1821c2 | 2007-02-05 21:18:17 +0100 | [diff] [blame] | 12 | #include <asm/pgalloc.h> |
Jeremy Fitzhardinge | d6dd61c | 2007-05-02 19:27:14 +0200 | [diff] [blame] | 13 | #include <asm-generic/mm_hooks.h> |
| 14 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | /* |
| 16 | * get a new mmu context.. S390 don't know about contexts. |
| 17 | */ |
| 18 | #define init_new_context(tsk,mm) 0 |
| 19 | |
| 20 | #define destroy_context(mm) do { } while (0) |
| 21 | |
Gerald Schaefer | c1821c2 | 2007-02-05 21:18:17 +0100 | [diff] [blame] | 22 | #ifndef __s390x__ |
| 23 | #define LCTL_OPCODE "lctl" |
| 24 | #define PGTABLE_BITS (_SEGMENT_TABLE|USER_STD_MASK) |
| 25 | #else |
| 26 | #define LCTL_OPCODE "lctlg" |
| 27 | #define PGTABLE_BITS (_REGION_TABLE|USER_STD_MASK) |
| 28 | #endif |
| 29 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | static inline void enter_lazy_tlb(struct mm_struct *mm, |
| 31 | struct task_struct *tsk) |
| 32 | { |
| 33 | } |
| 34 | |
| 35 | static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, |
Gerald Schaefer | c1821c2 | 2007-02-05 21:18:17 +0100 | [diff] [blame] | 36 | struct task_struct *tsk) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | { |
Gerald Schaefer | c1821c2 | 2007-02-05 21:18:17 +0100 | [diff] [blame] | 38 | pgd_t *shadow_pgd = get_shadow_pgd(next->pgd); |
| 39 | |
| 40 | if (prev != next) { |
| 41 | S390_lowcore.user_asce = (__pa(next->pgd) & PAGE_MASK) | |
| 42 | PGTABLE_BITS; |
| 43 | if (shadow_pgd) { |
| 44 | /* Load primary/secondary space page table origin. */ |
| 45 | S390_lowcore.user_exec_asce = |
| 46 | (__pa(shadow_pgd) & PAGE_MASK) | PGTABLE_BITS; |
| 47 | asm volatile(LCTL_OPCODE" 1,1,%0\n" |
| 48 | LCTL_OPCODE" 7,7,%1" |
| 49 | : : "m" (S390_lowcore.user_exec_asce), |
| 50 | "m" (S390_lowcore.user_asce) ); |
| 51 | } else if (switch_amode) { |
| 52 | /* Load primary space page table origin. */ |
| 53 | asm volatile(LCTL_OPCODE" 1,1,%0" |
| 54 | : : "m" (S390_lowcore.user_asce) ); |
| 55 | } else |
| 56 | /* Load home space page table origin. */ |
| 57 | asm volatile(LCTL_OPCODE" 13,13,%0" |
| 58 | : : "m" (S390_lowcore.user_asce) ); |
| 59 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | cpu_set(smp_processor_id(), next->cpu_vm_mask); |
| 61 | } |
| 62 | |
| 63 | #define deactivate_mm(tsk,mm) do { } while (0) |
| 64 | |
Adrian Bunk | 4448aaf | 2005-11-08 21:34:42 -0800 | [diff] [blame] | 65 | static inline void activate_mm(struct mm_struct *prev, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | struct mm_struct *next) |
| 67 | { |
| 68 | switch_mm(prev, next, current); |
| 69 | set_fs(current->thread.mm_segment); |
| 70 | } |
| 71 | |
Gerald Schaefer | c1821c2 | 2007-02-05 21:18:17 +0100 | [diff] [blame] | 72 | #endif /* __S390_MMU_CONTEXT_H */ |