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