|
14 | 14 | #include <asm/access-regs.h>
|
15 | 15 | #include <asm/fault.h>
|
16 | 16 | #include <asm/gmap.h>
|
| 17 | +#include <asm/dat-bits.h> |
17 | 18 | #include "kvm-s390.h"
|
18 | 19 | #include "gaccess.h"
|
19 | 20 |
|
20 |
| -union asce { |
21 |
| - unsigned long val; |
22 |
| - struct { |
23 |
| - unsigned long origin : 52; /* Region- or Segment-Table Origin */ |
24 |
| - unsigned long : 2; |
25 |
| - unsigned long g : 1; /* Subspace Group Control */ |
26 |
| - unsigned long p : 1; /* Private Space Control */ |
27 |
| - unsigned long s : 1; /* Storage-Alteration-Event Control */ |
28 |
| - unsigned long x : 1; /* Space-Switch-Event Control */ |
29 |
| - unsigned long r : 1; /* Real-Space Control */ |
30 |
| - unsigned long : 1; |
31 |
| - unsigned long dt : 2; /* Designation-Type Control */ |
32 |
| - unsigned long tl : 2; /* Region- or Segment-Table Length */ |
33 |
| - }; |
34 |
| -}; |
35 |
| - |
36 |
| -enum { |
37 |
| - ASCE_TYPE_SEGMENT = 0, |
38 |
| - ASCE_TYPE_REGION3 = 1, |
39 |
| - ASCE_TYPE_REGION2 = 2, |
40 |
| - ASCE_TYPE_REGION1 = 3 |
41 |
| -}; |
42 |
| - |
43 |
| -union region1_table_entry { |
44 |
| - unsigned long val; |
45 |
| - struct { |
46 |
| - unsigned long rto: 52;/* Region-Table Origin */ |
47 |
| - unsigned long : 2; |
48 |
| - unsigned long p : 1; /* DAT-Protection Bit */ |
49 |
| - unsigned long : 1; |
50 |
| - unsigned long tf : 2; /* Region-Second-Table Offset */ |
51 |
| - unsigned long i : 1; /* Region-Invalid Bit */ |
52 |
| - unsigned long : 1; |
53 |
| - unsigned long tt : 2; /* Table-Type Bits */ |
54 |
| - unsigned long tl : 2; /* Region-Second-Table Length */ |
55 |
| - }; |
56 |
| -}; |
57 |
| - |
58 |
| -union region2_table_entry { |
59 |
| - unsigned long val; |
60 |
| - struct { |
61 |
| - unsigned long rto: 52;/* Region-Table Origin */ |
62 |
| - unsigned long : 2; |
63 |
| - unsigned long p : 1; /* DAT-Protection Bit */ |
64 |
| - unsigned long : 1; |
65 |
| - unsigned long tf : 2; /* Region-Third-Table Offset */ |
66 |
| - unsigned long i : 1; /* Region-Invalid Bit */ |
67 |
| - unsigned long : 1; |
68 |
| - unsigned long tt : 2; /* Table-Type Bits */ |
69 |
| - unsigned long tl : 2; /* Region-Third-Table Length */ |
70 |
| - }; |
71 |
| -}; |
72 |
| - |
73 |
| -struct region3_table_entry_fc0 { |
74 |
| - unsigned long sto: 52;/* Segment-Table Origin */ |
75 |
| - unsigned long : 1; |
76 |
| - unsigned long fc : 1; /* Format-Control */ |
77 |
| - unsigned long p : 1; /* DAT-Protection Bit */ |
78 |
| - unsigned long : 1; |
79 |
| - unsigned long tf : 2; /* Segment-Table Offset */ |
80 |
| - unsigned long i : 1; /* Region-Invalid Bit */ |
81 |
| - unsigned long cr : 1; /* Common-Region Bit */ |
82 |
| - unsigned long tt : 2; /* Table-Type Bits */ |
83 |
| - unsigned long tl : 2; /* Segment-Table Length */ |
84 |
| -}; |
85 |
| - |
86 |
| -struct region3_table_entry_fc1 { |
87 |
| - unsigned long rfaa : 33; /* Region-Frame Absolute Address */ |
88 |
| - unsigned long : 14; |
89 |
| - unsigned long av : 1; /* ACCF-Validity Control */ |
90 |
| - unsigned long acc: 4; /* Access-Control Bits */ |
91 |
| - unsigned long f : 1; /* Fetch-Protection Bit */ |
92 |
| - unsigned long fc : 1; /* Format-Control */ |
93 |
| - unsigned long p : 1; /* DAT-Protection Bit */ |
94 |
| - unsigned long iep: 1; /* Instruction-Execution-Protection */ |
95 |
| - unsigned long : 2; |
96 |
| - unsigned long i : 1; /* Region-Invalid Bit */ |
97 |
| - unsigned long cr : 1; /* Common-Region Bit */ |
98 |
| - unsigned long tt : 2; /* Table-Type Bits */ |
99 |
| - unsigned long : 2; |
100 |
| -}; |
101 |
| - |
102 |
| -union region3_table_entry { |
103 |
| - unsigned long val; |
104 |
| - struct region3_table_entry_fc0 fc0; |
105 |
| - struct region3_table_entry_fc1 fc1; |
106 |
| - struct { |
107 |
| - unsigned long : 53; |
108 |
| - unsigned long fc : 1; /* Format-Control */ |
109 |
| - unsigned long : 4; |
110 |
| - unsigned long i : 1; /* Region-Invalid Bit */ |
111 |
| - unsigned long cr : 1; /* Common-Region Bit */ |
112 |
| - unsigned long tt : 2; /* Table-Type Bits */ |
113 |
| - unsigned long : 2; |
114 |
| - }; |
115 |
| -}; |
116 |
| - |
117 |
| -struct segment_entry_fc0 { |
118 |
| - unsigned long pto: 53;/* Page-Table Origin */ |
119 |
| - unsigned long fc : 1; /* Format-Control */ |
120 |
| - unsigned long p : 1; /* DAT-Protection Bit */ |
121 |
| - unsigned long : 3; |
122 |
| - unsigned long i : 1; /* Segment-Invalid Bit */ |
123 |
| - unsigned long cs : 1; /* Common-Segment Bit */ |
124 |
| - unsigned long tt : 2; /* Table-Type Bits */ |
125 |
| - unsigned long : 2; |
126 |
| -}; |
127 |
| - |
128 |
| -struct segment_entry_fc1 { |
129 |
| - unsigned long sfaa : 44; /* Segment-Frame Absolute Address */ |
130 |
| - unsigned long : 3; |
131 |
| - unsigned long av : 1; /* ACCF-Validity Control */ |
132 |
| - unsigned long acc: 4; /* Access-Control Bits */ |
133 |
| - unsigned long f : 1; /* Fetch-Protection Bit */ |
134 |
| - unsigned long fc : 1; /* Format-Control */ |
135 |
| - unsigned long p : 1; /* DAT-Protection Bit */ |
136 |
| - unsigned long iep: 1; /* Instruction-Execution-Protection */ |
137 |
| - unsigned long : 2; |
138 |
| - unsigned long i : 1; /* Segment-Invalid Bit */ |
139 |
| - unsigned long cs : 1; /* Common-Segment Bit */ |
140 |
| - unsigned long tt : 2; /* Table-Type Bits */ |
141 |
| - unsigned long : 2; |
142 |
| -}; |
143 |
| - |
144 |
| -union segment_table_entry { |
145 |
| - unsigned long val; |
146 |
| - struct segment_entry_fc0 fc0; |
147 |
| - struct segment_entry_fc1 fc1; |
148 |
| - struct { |
149 |
| - unsigned long : 53; |
150 |
| - unsigned long fc : 1; /* Format-Control */ |
151 |
| - unsigned long : 4; |
152 |
| - unsigned long i : 1; /* Segment-Invalid Bit */ |
153 |
| - unsigned long cs : 1; /* Common-Segment Bit */ |
154 |
| - unsigned long tt : 2; /* Table-Type Bits */ |
155 |
| - unsigned long : 2; |
156 |
| - }; |
157 |
| -}; |
158 |
| - |
159 |
| -enum { |
160 |
| - TABLE_TYPE_SEGMENT = 0, |
161 |
| - TABLE_TYPE_REGION3 = 1, |
162 |
| - TABLE_TYPE_REGION2 = 2, |
163 |
| - TABLE_TYPE_REGION1 = 3 |
164 |
| -}; |
165 |
| - |
166 |
| -union page_table_entry { |
167 |
| - unsigned long val; |
168 |
| - struct { |
169 |
| - unsigned long pfra : 52; /* Page-Frame Real Address */ |
170 |
| - unsigned long z : 1; /* Zero Bit */ |
171 |
| - unsigned long i : 1; /* Page-Invalid Bit */ |
172 |
| - unsigned long p : 1; /* DAT-Protection Bit */ |
173 |
| - unsigned long iep: 1; /* Instruction-Execution-Protection */ |
174 |
| - unsigned long : 8; |
175 |
| - }; |
176 |
| -}; |
177 |
| - |
178 | 21 | /*
|
179 | 22 | * vaddress union in order to easily decode a virtual address into its
|
180 | 23 | * region first index, region second index etc. parts.
|
@@ -632,7 +475,7 @@ static unsigned long guest_translate(struct kvm_vcpu *vcpu, unsigned long gva,
|
632 | 475 | iep = ctlreg0.iep && test_kvm_facility(vcpu->kvm, 130);
|
633 | 476 | if (asce.r)
|
634 | 477 | goto real_address;
|
635 |
| - ptr = asce.origin * PAGE_SIZE; |
| 478 | + ptr = asce.rsto * PAGE_SIZE; |
636 | 479 | switch (asce.dt) {
|
637 | 480 | case ASCE_TYPE_REGION1:
|
638 | 481 | if (vaddr.rfx01 > asce.tl)
|
@@ -1379,7 +1222,7 @@ static int kvm_s390_shadow_tables(struct gmap *sg, unsigned long saddr,
|
1379 | 1222 | parent = sg->parent;
|
1380 | 1223 | vaddr.addr = saddr;
|
1381 | 1224 | asce.val = sg->orig_asce;
|
1382 |
| - ptr = asce.origin * PAGE_SIZE; |
| 1225 | + ptr = asce.rsto * PAGE_SIZE; |
1383 | 1226 | if (asce.r) {
|
1384 | 1227 | *fake = 1;
|
1385 | 1228 | ptr = 0;
|
|
0 commit comments