diff options
author | Thomas Huth <thuth@linux.vnet.ibm.com> | 2013-07-26 09:04:06 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2013-07-29 03:03:45 -0400 |
commit | ea828ebf59f5b56e7261bfaeb94393c9dcb86260 (patch) | |
tree | 2ec8e5669191cedccefd5ec1a435ba865e392595 /arch/s390/kvm/priv.c | |
parent | 843200e7cc5de5f482ebe8acbf81e35a1c8e4a3d (diff) |
KVM: s390: Add helper function for setting condition code
Introduced a helper function for setting the CC in the
guest PSW to improve the readability of the code.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/s390/kvm/priv.c')
-rw-r--r-- | arch/s390/kvm/priv.c | 15 |
1 files changed, 6 insertions, 9 deletions
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; |