diff options
Diffstat (limited to 'arch/s390/kvm/priv.c')
-rw-r--r-- | arch/s390/kvm/priv.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c index 4cdc54e63ebc..59200ee275e5 100644 --- a/arch/s390/kvm/priv.c +++ b/arch/s390/kvm/priv.c | |||
@@ -164,8 +164,7 @@ static int handle_tpi(struct kvm_vcpu *vcpu) | |||
164 | kfree(inti); | 164 | kfree(inti); |
165 | no_interrupt: | 165 | no_interrupt: |
166 | /* Set condition code and we're done. */ | 166 | /* Set condition code and we're done. */ |
167 | vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); | 167 | kvm_s390_set_psw_cc(vcpu, cc); |
168 | vcpu->arch.sie_block->gpsw.mask |= (cc & 3ul) << 44; | ||
169 | return 0; | 168 | return 0; |
170 | } | 169 | } |
171 | 170 | ||
@@ -220,15 +219,13 @@ static int handle_io_inst(struct kvm_vcpu *vcpu) | |||
220 | * Set condition code 3 to stop the guest from issueing channel | 219 | * Set condition code 3 to stop the guest from issueing channel |
221 | * I/O instructions. | 220 | * I/O instructions. |
222 | */ | 221 | */ |
223 | vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); | 222 | kvm_s390_set_psw_cc(vcpu, 3); |
224 | vcpu->arch.sie_block->gpsw.mask |= (3 & 3ul) << 44; | ||
225 | return 0; | 223 | return 0; |
226 | } | 224 | } |
227 | } | 225 | } |
228 | 226 | ||
229 | static int handle_stfl(struct kvm_vcpu *vcpu) | 227 | static int handle_stfl(struct kvm_vcpu *vcpu) |
230 | { | 228 | { |
231 | unsigned int facility_list; | ||
232 | int rc; | 229 | int rc; |
233 | 230 | ||
234 | vcpu->stat.instruction_stfl++; | 231 | vcpu->stat.instruction_stfl++; |
@@ -236,15 +233,13 @@ static int handle_stfl(struct kvm_vcpu *vcpu) | |||
236 | if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) | 233 | if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) |
237 | return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); | 234 | return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); |
238 | 235 | ||
239 | /* only pass the facility bits, which we can handle */ | ||
240 | facility_list = S390_lowcore.stfl_fac_list & 0xff82fff3; | ||
241 | |||
242 | rc = copy_to_guest(vcpu, offsetof(struct _lowcore, stfl_fac_list), | 236 | rc = copy_to_guest(vcpu, offsetof(struct _lowcore, stfl_fac_list), |
243 | &facility_list, sizeof(facility_list)); | 237 | vfacilities, 4); |
244 | if (rc) | 238 | if (rc) |
245 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); | 239 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); |
246 | VCPU_EVENT(vcpu, 5, "store facility list value %x", facility_list); | 240 | VCPU_EVENT(vcpu, 5, "store facility list value %x", |
247 | trace_kvm_s390_handle_stfl(vcpu, facility_list); | 241 | *(unsigned int *) vfacilities); |
242 | trace_kvm_s390_handle_stfl(vcpu, *(unsigned int *) vfacilities); | ||
248 | return 0; | 243 | return 0; |
249 | } | 244 | } |
250 | 245 | ||
@@ -387,7 +382,7 @@ static int handle_stsi(struct kvm_vcpu *vcpu) | |||
387 | return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); | 382 | return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); |
388 | 383 | ||
389 | if (fc > 3) { | 384 | if (fc > 3) { |
390 | vcpu->arch.sie_block->gpsw.mask |= 3ul << 44; /* cc 3 */ | 385 | kvm_s390_set_psw_cc(vcpu, 3); |
391 | return 0; | 386 | return 0; |
392 | } | 387 | } |
393 | 388 | ||
@@ -397,7 +392,7 @@ static int handle_stsi(struct kvm_vcpu *vcpu) | |||
397 | 392 | ||
398 | if (fc == 0) { | 393 | if (fc == 0) { |
399 | vcpu->run->s.regs.gprs[0] = 3 << 28; | 394 | vcpu->run->s.regs.gprs[0] = 3 << 28; |
400 | vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); /* cc 0 */ | 395 | kvm_s390_set_psw_cc(vcpu, 0); |
401 | return 0; | 396 | return 0; |
402 | } | 397 | } |
403 | 398 | ||
@@ -431,12 +426,11 @@ static int handle_stsi(struct kvm_vcpu *vcpu) | |||
431 | } | 426 | } |
432 | trace_kvm_s390_handle_stsi(vcpu, fc, sel1, sel2, operand2); | 427 | trace_kvm_s390_handle_stsi(vcpu, fc, sel1, sel2, operand2); |
433 | free_page(mem); | 428 | free_page(mem); |
434 | vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); | 429 | kvm_s390_set_psw_cc(vcpu, 0); |
435 | vcpu->run->s.regs.gprs[0] = 0; | 430 | vcpu->run->s.regs.gprs[0] = 0; |
436 | return 0; | 431 | return 0; |
437 | out_no_data: | 432 | out_no_data: |
438 | /* condition code 3 */ | 433 | kvm_s390_set_psw_cc(vcpu, 3); |
439 | vcpu->arch.sie_block->gpsw.mask |= 3ul << 44; | ||
440 | out_exception: | 434 | out_exception: |
441 | free_page(mem); | 435 | free_page(mem); |
442 | return rc; | 436 | return rc; |
@@ -494,12 +488,12 @@ static int handle_epsw(struct kvm_vcpu *vcpu) | |||
494 | kvm_s390_get_regs_rre(vcpu, ®1, ®2); | 488 | kvm_s390_get_regs_rre(vcpu, ®1, ®2); |
495 | 489 | ||
496 | /* This basically extracts the mask half of the psw. */ | 490 | /* This basically extracts the mask half of the psw. */ |
497 | vcpu->run->s.regs.gprs[reg1] &= 0xffffffff00000000; | 491 | vcpu->run->s.regs.gprs[reg1] &= 0xffffffff00000000UL; |
498 | vcpu->run->s.regs.gprs[reg1] |= vcpu->arch.sie_block->gpsw.mask >> 32; | 492 | vcpu->run->s.regs.gprs[reg1] |= vcpu->arch.sie_block->gpsw.mask >> 32; |
499 | if (reg2) { | 493 | if (reg2) { |
500 | vcpu->run->s.regs.gprs[reg2] &= 0xffffffff00000000; | 494 | vcpu->run->s.regs.gprs[reg2] &= 0xffffffff00000000UL; |
501 | vcpu->run->s.regs.gprs[reg2] |= | 495 | vcpu->run->s.regs.gprs[reg2] |= |
502 | vcpu->arch.sie_block->gpsw.mask & 0x00000000ffffffff; | 496 | vcpu->arch.sie_block->gpsw.mask & 0x00000000ffffffffUL; |
503 | } | 497 | } |
504 | return 0; | 498 | return 0; |
505 | } | 499 | } |