Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __MMU_H |
| 2 | #define __MMU_H |
| 3 | |
Heiko Carstens | 1e3cab2 | 2012-03-30 09:40:55 +0200 | [diff] [blame^] | 4 | #include <linux/errno.h> |
| 5 | |
Martin Schwidefsky | 146e4b3 | 2008-02-09 18:24:35 +0100 | [diff] [blame] | 6 | typedef struct { |
Martin Schwidefsky | 050eef3 | 2010-08-24 09:26:21 +0200 | [diff] [blame] | 7 | atomic_t attach_count; |
| 8 | unsigned int flush_mm; |
Martin Schwidefsky | 50aa98b | 2009-09-11 10:28:57 +0200 | [diff] [blame] | 9 | spinlock_t list_lock; |
Martin Schwidefsky | 146e4b3 | 2008-02-09 18:24:35 +0100 | [diff] [blame] | 10 | struct list_head pgtable_list; |
Martin Schwidefsky | e5992f2 | 2011-07-24 10:48:20 +0200 | [diff] [blame] | 11 | struct list_head gmap_list; |
Martin Schwidefsky | 146e4b3 | 2008-02-09 18:24:35 +0100 | [diff] [blame] | 12 | unsigned long asce_bits; |
Martin Schwidefsky | 6252d70 | 2008-02-09 18:24:37 +0100 | [diff] [blame] | 13 | unsigned long asce_limit; |
Martin Schwidefsky | b020632 | 2008-12-25 13:38:36 +0100 | [diff] [blame] | 14 | unsigned long vdso_base; |
Martin Schwidefsky | b2fa47e | 2011-05-23 10:24:40 +0200 | [diff] [blame] | 15 | /* Cloned contexts will be created with extended page tables. */ |
| 16 | unsigned int alloc_pgste:1; |
| 17 | /* The mmu context has extended page tables. */ |
| 18 | unsigned int has_pgste:1; |
Martin Schwidefsky | 146e4b3 | 2008-02-09 18:24:35 +0100 | [diff] [blame] | 19 | } mm_context_t; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | |
Heiko Carstens | a1b200e | 2010-08-09 17:18:28 -0700 | [diff] [blame] | 21 | #define INIT_MM_CONTEXT(name) \ |
| 22 | .context.list_lock = __SPIN_LOCK_UNLOCKED(name.context.list_lock), \ |
Martin Schwidefsky | e5992f2 | 2011-07-24 10:48:20 +0200 | [diff] [blame] | 23 | .context.pgtable_list = LIST_HEAD_INIT(name.context.pgtable_list), \ |
| 24 | .context.gmap_list = LIST_HEAD_INIT(name.context.gmap_list), |
Heiko Carstens | a1b200e | 2010-08-09 17:18:28 -0700 | [diff] [blame] | 25 | |
David Howells | a0616cd | 2012-03-28 18:30:02 +0100 | [diff] [blame] | 26 | static inline int tprot(unsigned long addr) |
| 27 | { |
| 28 | int rc = -EFAULT; |
| 29 | |
| 30 | asm volatile( |
| 31 | " tprot 0(%1),0\n" |
| 32 | "0: ipm %0\n" |
| 33 | " srl %0,28\n" |
| 34 | "1:\n" |
| 35 | EX_TABLE(0b,1b) |
| 36 | : "+d" (rc) : "a" (addr) : "cc"); |
| 37 | return rc; |
| 38 | } |
| 39 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | #endif |