blob: 1c7d6ce328bf6bfe52cf715ac8680c2143a2dc76 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __MMU_H
2#define __MMU_H
3
Martin Schwidefsky146e4b32008-02-09 18:24:35 +01004typedef struct {
Martin Schwidefsky050eef32010-08-24 09:26:21 +02005 atomic_t attach_count;
6 unsigned int flush_mm;
Martin Schwidefsky50aa98b2009-09-11 10:28:57 +02007 spinlock_t list_lock;
Martin Schwidefsky146e4b32008-02-09 18:24:35 +01008 struct list_head pgtable_list;
Martin Schwidefskye5992f22011-07-24 10:48:20 +02009 struct list_head gmap_list;
Martin Schwidefsky146e4b32008-02-09 18:24:35 +010010 unsigned long asce_bits;
Martin Schwidefsky6252d702008-02-09 18:24:37 +010011 unsigned long asce_limit;
Martin Schwidefskyb0206322008-12-25 13:38:36 +010012 unsigned long vdso_base;
Martin Schwidefskyb2fa47e2011-05-23 10:24:40 +020013 /* Cloned contexts will be created with extended page tables. */
14 unsigned int alloc_pgste:1;
15 /* The mmu context has extended page tables. */
16 unsigned int has_pgste:1;
Martin Schwidefsky146e4b32008-02-09 18:24:35 +010017} mm_context_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
Heiko Carstensa1b200e2010-08-09 17:18:28 -070019#define INIT_MM_CONTEXT(name) \
20 .context.list_lock = __SPIN_LOCK_UNLOCKED(name.context.list_lock), \
Martin Schwidefskye5992f22011-07-24 10:48:20 +020021 .context.pgtable_list = LIST_HEAD_INIT(name.context.pgtable_list), \
22 .context.gmap_list = LIST_HEAD_INIT(name.context.gmap_list),
Heiko Carstensa1b200e2010-08-09 17:18:28 -070023
David Howellsa0616cd2012-03-28 18:30:02 +010024static inline int tprot(unsigned long addr)
25{
26 int rc = -EFAULT;
27
28 asm volatile(
29 " tprot 0(%1),0\n"
30 "0: ipm %0\n"
31 " srl %0,28\n"
32 "1:\n"
33 EX_TABLE(0b,1b)
34 : "+d" (rc) : "a" (addr) : "cc");
35 return rc;
36}
37
Linus Torvalds1da177e2005-04-16 15:20:36 -070038#endif