mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 15:27:29 +00:00
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>
This commit is contained in:
parent
843200e7cc
commit
ea828ebf59
2 changed files with 13 additions and 9 deletions
|
@ -115,6 +115,13 @@ static inline u64 kvm_s390_get_base_disp_rs(struct kvm_vcpu *vcpu)
|
||||||
return (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2;
|
return (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set the condition code in the guest program status word */
|
||||||
|
static inline void kvm_s390_set_psw_cc(struct kvm_vcpu *vcpu, unsigned long cc)
|
||||||
|
{
|
||||||
|
vcpu->arch.sie_block->gpsw.mask &= ~(3UL << 44);
|
||||||
|
vcpu->arch.sie_block->gpsw.mask |= cc << 44;
|
||||||
|
}
|
||||||
|
|
||||||
int kvm_s390_handle_wait(struct kvm_vcpu *vcpu);
|
int kvm_s390_handle_wait(struct kvm_vcpu *vcpu);
|
||||||
enum hrtimer_restart kvm_s390_idle_wakeup(struct hrtimer *timer);
|
enum hrtimer_restart kvm_s390_idle_wakeup(struct hrtimer *timer);
|
||||||
void kvm_s390_tasklet(unsigned long parm);
|
void kvm_s390_tasklet(unsigned long parm);
|
||||||
|
|
|
@ -163,8 +163,7 @@ static int handle_tpi(struct kvm_vcpu *vcpu)
|
||||||
kfree(inti);
|
kfree(inti);
|
||||||
no_interrupt:
|
no_interrupt:
|
||||||
/* Set condition code and we're done. */
|
/* Set condition code and we're done. */
|
||||||
vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44);
|
kvm_s390_set_psw_cc(vcpu, cc);
|
||||||
vcpu->arch.sie_block->gpsw.mask |= (cc & 3ul) << 44;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,8 +218,7 @@ static int handle_io_inst(struct kvm_vcpu *vcpu)
|
||||||
* Set condition code 3 to stop the guest from issueing channel
|
* Set condition code 3 to stop the guest from issueing channel
|
||||||
* I/O instructions.
|
* I/O instructions.
|
||||||
*/
|
*/
|
||||||
vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44);
|
kvm_s390_set_psw_cc(vcpu, 3);
|
||||||
vcpu->arch.sie_block->gpsw.mask |= (3 & 3ul) << 44;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -383,7 +381,7 @@ static int handle_stsi(struct kvm_vcpu *vcpu)
|
||||||
return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
|
return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
|
||||||
|
|
||||||
if (fc > 3) {
|
if (fc > 3) {
|
||||||
vcpu->arch.sie_block->gpsw.mask |= 3ul << 44; /* cc 3 */
|
kvm_s390_set_psw_cc(vcpu, 3);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,7 +391,7 @@ static int handle_stsi(struct kvm_vcpu *vcpu)
|
||||||
|
|
||||||
if (fc == 0) {
|
if (fc == 0) {
|
||||||
vcpu->run->s.regs.gprs[0] = 3 << 28;
|
vcpu->run->s.regs.gprs[0] = 3 << 28;
|
||||||
vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); /* cc 0 */
|
kvm_s390_set_psw_cc(vcpu, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,12 +425,11 @@ static int handle_stsi(struct kvm_vcpu *vcpu)
|
||||||
}
|
}
|
||||||
trace_kvm_s390_handle_stsi(vcpu, fc, sel1, sel2, operand2);
|
trace_kvm_s390_handle_stsi(vcpu, fc, sel1, sel2, operand2);
|
||||||
free_page(mem);
|
free_page(mem);
|
||||||
vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44);
|
kvm_s390_set_psw_cc(vcpu, 0);
|
||||||
vcpu->run->s.regs.gprs[0] = 0;
|
vcpu->run->s.regs.gprs[0] = 0;
|
||||||
return 0;
|
return 0;
|
||||||
out_no_data:
|
out_no_data:
|
||||||
/* condition code 3 */
|
kvm_s390_set_psw_cc(vcpu, 3);
|
||||||
vcpu->arch.sie_block->gpsw.mask |= 3ul << 44;
|
|
||||||
out_exception:
|
out_exception:
|
||||||
free_page(mem);
|
free_page(mem);
|
||||||
return rc;
|
return rc;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue