1
2
3
4
5
6
7
8
9#ifndef _ASM_S390_GMAP_H
10#define _ASM_S390_GMAP_H
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34struct gmap {
35 struct list_head list;
36 struct list_head crst_list;
37 struct mm_struct *mm;
38 struct radix_tree_root guest_to_host;
39 struct radix_tree_root host_to_guest;
40 spinlock_t guest_table_lock;
41 atomic_t ref_count;
42 unsigned long *table;
43 unsigned long asce;
44 unsigned long asce_end;
45 void *private;
46 bool pfault_enabled;
47
48 struct radix_tree_root host_to_rmap;
49 struct list_head children;
50 struct list_head pt_list;
51 spinlock_t shadow_lock;
52 struct gmap *parent;
53 unsigned long orig_asce;
54 int edat_level;
55 bool removed;
56 bool initialized;
57};
58
59
60
61
62
63
64struct gmap_rmap {
65 struct gmap_rmap *next;
66 unsigned long raddr;
67};
68
69#define gmap_for_each_rmap(pos, head) \
70 for (pos = (head); pos; pos = pos->next)
71
72#define gmap_for_each_rmap_safe(pos, n, head) \
73 for (pos = (head); n = pos ? pos->next : NULL, pos; pos = n)
74
75
76
77
78
79struct gmap_notifier {
80 struct list_head list;
81 struct rcu_head rcu;
82 void (*notifier_call)(struct gmap *gmap, unsigned long start,
83 unsigned long end);
84};
85
86static inline int gmap_is_shadow(struct gmap *gmap)
87{
88 return !!gmap->parent;
89}
90
91struct gmap *gmap_create(struct mm_struct *mm, unsigned long limit);
92void gmap_remove(struct gmap *gmap);
93struct gmap *gmap_get(struct gmap *gmap);
94void gmap_put(struct gmap *gmap);
95
96void gmap_enable(struct gmap *gmap);
97void gmap_disable(struct gmap *gmap);
98struct gmap *gmap_get_enabled(void);
99int gmap_map_segment(struct gmap *gmap, unsigned long from,
100 unsigned long to, unsigned long len);
101int gmap_unmap_segment(struct gmap *gmap, unsigned long to, unsigned long len);
102unsigned long __gmap_translate(struct gmap *, unsigned long gaddr);
103unsigned long gmap_translate(struct gmap *, unsigned long gaddr);
104int __gmap_link(struct gmap *gmap, unsigned long gaddr, unsigned long vmaddr);
105int gmap_fault(struct gmap *, unsigned long gaddr, unsigned int fault_flags);
106void gmap_discard(struct gmap *, unsigned long from, unsigned long to);
107void __gmap_zap(struct gmap *, unsigned long gaddr);
108void gmap_unlink(struct mm_struct *, unsigned long *table, unsigned long vmaddr);
109
110int gmap_read_table(struct gmap *gmap, unsigned long gaddr, unsigned long *val);
111
112struct gmap *gmap_shadow(struct gmap *parent, unsigned long asce,
113 int edat_level);
114int gmap_shadow_valid(struct gmap *sg, unsigned long asce, int edat_level);
115int gmap_shadow_r2t(struct gmap *sg, unsigned long saddr, unsigned long r2t,
116 int fake);
117int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t,
118 int fake);
119int gmap_shadow_sgt(struct gmap *sg, unsigned long saddr, unsigned long sgt,
120 int fake);
121int gmap_shadow_pgt(struct gmap *sg, unsigned long saddr, unsigned long pgt,
122 int fake);
123int gmap_shadow_pgt_lookup(struct gmap *sg, unsigned long saddr,
124 unsigned long *pgt, int *dat_protection, int *fake);
125int gmap_shadow_page(struct gmap *sg, unsigned long saddr, pte_t pte);
126
127void gmap_register_pte_notifier(struct gmap_notifier *);
128void gmap_unregister_pte_notifier(struct gmap_notifier *);
129void gmap_pte_notify(struct mm_struct *, unsigned long addr, pte_t *,
130 unsigned long bits);
131
132int gmap_mprotect_notify(struct gmap *, unsigned long start,
133 unsigned long len, int prot);
134
135#endif
136