aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kvm/priv.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/kvm/priv.c')
-rw-r--r--arch/s390/kvm/priv.c42
1 files changed, 11 insertions, 31 deletions
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index 1aeb9335f9e2..d715842f56ca 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -24,17 +24,13 @@
24 24
25static int handle_set_prefix(struct kvm_vcpu *vcpu) 25static int handle_set_prefix(struct kvm_vcpu *vcpu)
26{ 26{
27 int base2 = vcpu->arch.sie_block->ipb >> 28;
28 int disp2 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16);
29 u64 operand2; 27 u64 operand2;
30 u32 address = 0; 28 u32 address = 0;
31 u8 tmp; 29 u8 tmp;
32 30
33 vcpu->stat.instruction_spx++; 31 vcpu->stat.instruction_spx++;
34 32
35 operand2 = disp2; 33 operand2 = kvm_s390_get_base_disp_s(vcpu);
36 if (base2)
37 operand2 += vcpu->run->s.regs.gprs[base2];
38 34
39 /* must be word boundary */ 35 /* must be word boundary */
40 if (operand2 & 3) { 36 if (operand2 & 3) {
@@ -67,15 +63,12 @@ out:
67 63
68static int handle_store_prefix(struct kvm_vcpu *vcpu) 64static int handle_store_prefix(struct kvm_vcpu *vcpu)
69{ 65{
70 int base2 = vcpu->arch.sie_block->ipb >> 28;
71 int disp2 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16);
72 u64 operand2; 66 u64 operand2;
73 u32 address; 67 u32 address;
74 68
75 vcpu->stat.instruction_stpx++; 69 vcpu->stat.instruction_stpx++;
76 operand2 = disp2; 70
77 if (base2) 71 operand2 = kvm_s390_get_base_disp_s(vcpu);
78 operand2 += vcpu->run->s.regs.gprs[base2];
79 72
80 /* must be word boundary */ 73 /* must be word boundary */
81 if (operand2 & 3) { 74 if (operand2 & 3) {
@@ -100,15 +93,12 @@ out:
100 93
101static int handle_store_cpu_address(struct kvm_vcpu *vcpu) 94static int handle_store_cpu_address(struct kvm_vcpu *vcpu)
102{ 95{
103 int base2 = vcpu->arch.sie_block->ipb >> 28;
104 int disp2 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16);
105 u64 useraddr; 96 u64 useraddr;
106 int rc; 97 int rc;
107 98
108 vcpu->stat.instruction_stap++; 99 vcpu->stat.instruction_stap++;
109 useraddr = disp2; 100
110 if (base2) 101 useraddr = kvm_s390_get_base_disp_s(vcpu);
111 useraddr += vcpu->run->s.regs.gprs[base2];
112 102
113 if (useraddr & 1) { 103 if (useraddr & 1) {
114 kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 104 kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
@@ -178,15 +168,12 @@ static int handle_stfl(struct kvm_vcpu *vcpu)
178 168
179static int handle_stidp(struct kvm_vcpu *vcpu) 169static int handle_stidp(struct kvm_vcpu *vcpu)
180{ 170{
181 int base2 = vcpu->arch.sie_block->ipb >> 28;
182 int disp2 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16);
183 u64 operand2; 171 u64 operand2;
184 int rc; 172 int rc;
185 173
186 vcpu->stat.instruction_stidp++; 174 vcpu->stat.instruction_stidp++;
187 operand2 = disp2; 175
188 if (base2) 176 operand2 = kvm_s390_get_base_disp_s(vcpu);
189 operand2 += vcpu->run->s.regs.gprs[base2];
190 177
191 if (operand2 & 7) { 178 if (operand2 & 7) {
192 kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 179 kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
@@ -240,17 +227,13 @@ static int handle_stsi(struct kvm_vcpu *vcpu)
240 int fc = (vcpu->run->s.regs.gprs[0] & 0xf0000000) >> 28; 227 int fc = (vcpu->run->s.regs.gprs[0] & 0xf0000000) >> 28;
241 int sel1 = vcpu->run->s.regs.gprs[0] & 0xff; 228 int sel1 = vcpu->run->s.regs.gprs[0] & 0xff;
242 int sel2 = vcpu->run->s.regs.gprs[1] & 0xffff; 229 int sel2 = vcpu->run->s.regs.gprs[1] & 0xffff;
243 int base2 = vcpu->arch.sie_block->ipb >> 28;
244 int disp2 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16);
245 u64 operand2; 230 u64 operand2;
246 unsigned long mem; 231 unsigned long mem;
247 232
248 vcpu->stat.instruction_stsi++; 233 vcpu->stat.instruction_stsi++;
249 VCPU_EVENT(vcpu, 4, "stsi: fc: %x sel1: %x sel2: %x", fc, sel1, sel2); 234 VCPU_EVENT(vcpu, 4, "stsi: fc: %x sel1: %x sel2: %x", fc, sel1, sel2);
250 235
251 operand2 = disp2; 236 operand2 = kvm_s390_get_base_disp_s(vcpu);
252 if (base2)
253 operand2 += vcpu->run->s.regs.gprs[base2];
254 237
255 if (operand2 & 0xfff && fc > 0) 238 if (operand2 & 0xfff && fc > 0)
256 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 239 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
@@ -335,17 +318,14 @@ int kvm_s390_handle_b2(struct kvm_vcpu *vcpu)
335 318
336static int handle_tprot(struct kvm_vcpu *vcpu) 319static int handle_tprot(struct kvm_vcpu *vcpu)
337{ 320{
338 int base1 = (vcpu->arch.sie_block->ipb & 0xf0000000) >> 28; 321 u64 address1, address2;
339 int disp1 = (vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16;
340 int base2 = (vcpu->arch.sie_block->ipb & 0xf000) >> 12;
341 int disp2 = vcpu->arch.sie_block->ipb & 0x0fff;
342 u64 address1 = disp1 + base1 ? vcpu->run->s.regs.gprs[base1] : 0;
343 u64 address2 = disp2 + base2 ? vcpu->run->s.regs.gprs[base2] : 0;
344 struct vm_area_struct *vma; 322 struct vm_area_struct *vma;
345 unsigned long user_address; 323 unsigned long user_address;
346 324
347 vcpu->stat.instruction_tprot++; 325 vcpu->stat.instruction_tprot++;
348 326
327 kvm_s390_get_base_disp_sse(vcpu, &address1, &address2);
328
349 /* we only handle the Linux memory detection case: 329 /* we only handle the Linux memory detection case:
350 * access key == 0 330 * access key == 0
351 * guest DAT == off 331 * guest DAT == off