blob: bd6f303045185b7dbb2a4bc4a14d4c7729a84e4a [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 Schwidefsky64f31d52016-05-25 09:45:26 +02009 atomic_t flush_count;
Martin Schwidefsky050eef32010-08-24 09:26:21 +020010 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;
Martin Schwidefsky44b6cc82016-06-13 10:36:00 +020015 unsigned long gmap_asce;
Gerald Schaefer723cacb2016-04-15 16:38:40 +020016 unsigned long asce;
Martin Schwidefsky6252d702008-02-09 18:24:37 +010017 unsigned long asce_limit;
Martin Schwidefskyb0206322008-12-25 13:38:36 +010018 unsigned long vdso_base;
Martin Schwidefsky0b46e0a2015-04-15 13:23:26 +020019 /* The mmu context allocates 4K page tables. */
20 unsigned int alloc_pgste:1;
21 /* The mmu context uses extended page tables. */
Martin Schwidefskyb2fa47e2011-05-23 10:24:40 +020022 unsigned int has_pgste:1;
Dominik Dingel65eef3352014-01-14 15:02:11 +010023 /* The mmu context uses storage keys. */
24 unsigned int use_skey:1;
Claudio Imbrendaaa824e12017-04-20 10:03:46 +020025 /* The mmu context uses CMMA. */
26 unsigned int use_cmma:1;
Martin Schwidefsky146e4b32008-02-09 18:24:35 +010027} mm_context_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
Martin Schwidefsky8ecb1a52016-03-08 11:54:14 +010029#define INIT_MM_CONTEXT(name) \
30 .context.pgtable_lock = \
31 __SPIN_LOCK_UNLOCKED(name.context.pgtable_lock), \
32 .context.pgtable_list = LIST_HEAD_INIT(name.context.pgtable_list), \
33 .context.gmap_lock = __SPIN_LOCK_UNLOCKED(name.context.gmap_lock), \
Martin Schwidefskye5992f22011-07-24 10:48:20 +020034 .context.gmap_list = LIST_HEAD_INIT(name.context.gmap_list),
Heiko Carstensa1b200e2010-08-09 17:18:28 -070035
David Howellsa0616cd2012-03-28 18:30:02 +010036static inline int tprot(unsigned long addr)
37{
38 int rc = -EFAULT;
39
40 asm volatile(
41 " tprot 0(%1),0\n"
42 "0: ipm %0\n"
43 " srl %0,28\n"
44 "1:\n"
45 EX_TABLE(0b,1b)
46 : "+d" (rc) : "a" (addr) : "cc");
47 return rc;
48}
49
Linus Torvalds1da177e2005-04-16 15:20:36 -070050#endif