blob: b941528cc49e69ef2259978284f71fdcf3eadd5d [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 Schwidefsky8ecb1a52016-03-08 11:54:14 +010011 spinlock_t pgtable_lock;
Martin Schwidefsky146e4b32008-02-09 18:24:35 +010012 struct list_head pgtable_list;
Martin Schwidefsky8ecb1a52016-03-08 11:54:14 +010013 spinlock_t gmap_lock;
Martin Schwidefskye5992f22011-07-24 10:48:20 +020014 struct list_head gmap_list;
Gerald Schaefer723cacb2016-04-15 16:38:40 +020015 unsigned long asce;
Martin Schwidefsky6252d702008-02-09 18:24:37 +010016 unsigned long asce_limit;
Martin Schwidefskyb0206322008-12-25 13:38:36 +010017 unsigned long vdso_base;
Martin Schwidefsky0b46e0a2015-04-15 13:23:26 +020018 /* The mmu context allocates 4K page tables. */
19 unsigned int alloc_pgste:1;
20 /* The mmu context uses extended page tables. */
Martin Schwidefskyb2fa47e2011-05-23 10:24:40 +020021 unsigned int has_pgste:1;
Dominik Dingel65eef3352014-01-14 15:02:11 +010022 /* The mmu context uses storage keys. */
23 unsigned int use_skey:1;
Martin Schwidefsky146e4b32008-02-09 18:24:35 +010024} mm_context_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -070025
Martin Schwidefsky8ecb1a52016-03-08 11:54:14 +010026#define INIT_MM_CONTEXT(name) \
27 .context.pgtable_lock = \
28 __SPIN_LOCK_UNLOCKED(name.context.pgtable_lock), \
29 .context.pgtable_list = LIST_HEAD_INIT(name.context.pgtable_list), \
30 .context.gmap_lock = __SPIN_LOCK_UNLOCKED(name.context.gmap_lock), \
Martin Schwidefskye5992f22011-07-24 10:48:20 +020031 .context.gmap_list = LIST_HEAD_INIT(name.context.gmap_list),
Heiko Carstensa1b200e2010-08-09 17:18:28 -070032
David Howellsa0616cd2012-03-28 18:30:02 +010033static inline int tprot(unsigned long addr)
34{
35 int rc = -EFAULT;
36
37 asm volatile(
38 " tprot 0(%1),0\n"
39 "0: ipm %0\n"
40 " srl %0,28\n"
41 "1:\n"
42 EX_TABLE(0b,1b)
43 : "+d" (rc) : "a" (addr) : "cc");
44 return rc;
45}
46
Linus Torvalds1da177e2005-04-16 15:20:36 -070047#endif