diff options
-rw-r--r-- | arch/s390/kvm/kvm-s390.h | 7 | ||||
-rw-r--r-- | arch/s390/kvm/priv.c | 15 |
2 files changed, 13 insertions, 9 deletions
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h index faa4df633474..dc99f1ca4267 100644 --- a/arch/s390/kvm/kvm-s390.h +++ b/arch/s390/kvm/kvm-s390.h | |||
@@ -115,6 +115,13 @@ static inline u64 kvm_s390_get_base_disp_rs(struct kvm_vcpu *vcpu) | |||
115 | return (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2; | 115 | return (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2; |
116 | } | 116 | } |
117 | 117 | ||
118 | /* Set the condition code in the guest program status word */ | ||
119 | static inline void kvm_s390_set_psw_cc(struct kvm_vcpu *vcpu, unsigned long cc) | ||
120 | { | ||
121 | vcpu->arch.sie_block->gpsw.mask &= ~(3UL << 44); | ||
122 | vcpu->arch.sie_block->gpsw.mask |= cc << 44; | ||
123 | } | ||
124 | |||
118 | int kvm_s390_handle_wait(struct kvm_vcpu *vcpu); | 125 | int kvm_s390_handle_wait(struct kvm_vcpu *vcpu); |
119 | enum hrtimer_restart kvm_s390_idle_wakeup(struct hrtimer *timer); | 126 | enum hrtimer_restart kvm_s390_idle_wakeup(struct hrtimer *timer); |
120 | void kvm_s390_tasklet(unsigned long parm); | 127 | void kvm_s390_tasklet(unsigned long parm); |
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c index 697e34b59036..8f8d8ee9b1fb 100644 --- a/arch/s390/kvm/priv.c +++ b/arch/s390/kvm/priv.c | |||
@@ -163,8 +163,7 @@ static int handle_tpi(struct kvm_vcpu *vcpu) | |||
163 | kfree(inti); | 163 | kfree(inti); |
164 | no_interrupt: | 164 | no_interrupt: |
165 | /* Set condition code and we're done. */ | 165 | /* Set condition code and we're done. */ |
166 | vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); | 166 | kvm_s390_set_psw_cc(vcpu, cc); |
167 | vcpu->arch.sie_block->gpsw.mask |= (cc & 3ul) << 44; | ||
168 | return 0; | 167 | return 0; |
169 | } | 168 | } |
170 | 169 | ||
@@ -219,8 +218,7 @@ static int handle_io_inst(struct kvm_vcpu *vcpu) | |||
219 | * Set condition code 3 to stop the guest from issueing channel | 218 | * Set condition code 3 to stop the guest from issueing channel |
220 | * I/O instructions. | 219 | * I/O instructions. |
221 | */ | 220 | */ |
222 | vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); | 221 | kvm_s390_set_psw_cc(vcpu, 3); |
223 | vcpu->arch.sie_block->gpsw.mask |= (3 & 3ul) << 44; | ||
224 | return 0; | 222 | return 0; |
225 | } | 223 | } |
226 | } | 224 | } |
@@ -383,7 +381,7 @@ static int handle_stsi(struct kvm_vcpu *vcpu) | |||
383 | return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); | 381 | return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); |
384 | 382 | ||
385 | if (fc > 3) { | 383 | if (fc > 3) { |
386 | vcpu->arch.sie_block->gpsw.mask |= 3ul << 44; /* cc 3 */ | 384 | kvm_s390_set_psw_cc(vcpu, 3); |
387 | return 0; | 385 | return 0; |
388 | } | 386 | } |
389 | 387 | ||
@@ -393,7 +391,7 @@ static int handle_stsi(struct kvm_vcpu *vcpu) | |||
393 | 391 | ||
394 | if (fc == 0) { | 392 | if (fc == 0) { |
395 | vcpu->run->s.regs.gprs[0] = 3 << 28; | 393 | vcpu->run->s.regs.gprs[0] = 3 << 28; |
396 | vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); /* cc 0 */ | 394 | kvm_s390_set_psw_cc(vcpu, 0); |
397 | return 0; | 395 | return 0; |
398 | } | 396 | } |
399 | 397 | ||
@@ -427,12 +425,11 @@ static int handle_stsi(struct kvm_vcpu *vcpu) | |||
427 | } | 425 | } |
428 | trace_kvm_s390_handle_stsi(vcpu, fc, sel1, sel2, operand2); | 426 | trace_kvm_s390_handle_stsi(vcpu, fc, sel1, sel2, operand2); |
429 | free_page(mem); | 427 | free_page(mem); |
430 | vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); | 428 | kvm_s390_set_psw_cc(vcpu, 0); |
431 | vcpu->run->s.regs.gprs[0] = 0; | 429 | vcpu->run->s.regs.gprs[0] = 0; |
432 | return 0; | 430 | return 0; |
433 | out_no_data: | 431 | out_no_data: |
434 | /* condition code 3 */ | 432 | kvm_s390_set_psw_cc(vcpu, 3); |
435 | vcpu->arch.sie_block->gpsw.mask |= 3ul << 44; | ||
436 | out_exception: | 433 | out_exception: |
437 | free_page(mem); | 434 | free_page(mem); |
438 | return rc; | 435 | return rc; |