blob: a5e656260a70183dd4f3768c3be082fed5988603 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __MMU_H
2#define __MMU_H
3
Martin Schwidefsky1b948d62014-04-03 13:55:01 +02004#include <linux/cpumask.h>
Heiko Carstens1e3cab22012-03-30 09:40:55 +02005#include <linux/errno.h>
6
Martin Schwidefsky146e4b32008-02-09 18:24:35 +01007typedef struct {
Martin Schwidefsky1b948d62014-04-03 13:55:01 +02008 cpumask_t cpu_attach_mask;
Martin Schwidefsky050eef32010-08-24 09:26:21 +02009 atomic_t attach_count;
10 unsigned int flush_mm;
Martin Schwidefsky50aa98b2009-09-11 10:28:57 +020011 spinlock_t list_lock;
Martin Schwidefsky146e4b32008-02-09 18:24:35 +010012 struct list_head pgtable_list;
Martin Schwidefskye5992f22011-07-24 10:48:20 +020013 struct list_head gmap_list;
Martin Schwidefsky146e4b32008-02-09 18:24:35 +010014 unsigned long asce_bits;
Martin Schwidefsky6252d702008-02-09 18:24:37 +010015 unsigned long asce_limit;
Martin Schwidefskyb0206322008-12-25 13:38:36 +010016 unsigned long vdso_base;
Martin Schwidefskyb2fa47e2011-05-23 10:24:40 +020017 /* The mmu context has extended page tables. */
18 unsigned int has_pgste:1;
Dominik Dingel65eef3352014-01-14 15:02:11 +010019 /* The mmu context uses storage keys. */
20 unsigned int use_skey:1;
Martin Schwidefsky146e4b32008-02-09 18:24:35 +010021} mm_context_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -070022
Heiko Carstensa1b200e2010-08-09 17:18:28 -070023#define INIT_MM_CONTEXT(name) \
24 .context.list_lock = __SPIN_LOCK_UNLOCKED(name.context.list_lock), \
Martin Schwidefskye5992f22011-07-24 10:48:20 +020025 .context.pgtable_list = LIST_HEAD_INIT(name.context.pgtable_list), \
26 .context.gmap_list = LIST_HEAD_INIT(name.context.gmap_list),
Heiko Carstensa1b200e2010-08-09 17:18:28 -070027
David Howellsa0616cd2012-03-28 18:30:02 +010028static inline int tprot(unsigned long addr)
29{
30 int rc = -EFAULT;
31
32 asm volatile(
33 " tprot 0(%1),0\n"
34 "0: ipm %0\n"
35 " srl %0,28\n"
36 "1:\n"
37 EX_TABLE(0b,1b)
38 : "+d" (rc) : "a" (addr) : "cc");
39 return rc;
40}
41
Linus Torvalds1da177e2005-04-16 15:20:36 -070042#endif