aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kvm/kvm-s390.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/kvm/kvm-s390.c')
-rw-r--r--arch/s390/kvm/kvm-s390.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index c1c7c683fa26..ef4ef21f2c73 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -454,6 +454,34 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
454 return 0; 454 return 0;
455} 455}
456 456
457void s390_vcpu_block(struct kvm_vcpu *vcpu)
458{
459 atomic_set_mask(PROG_BLOCK_SIE, &vcpu->arch.sie_block->prog20);
460}
461
462void s390_vcpu_unblock(struct kvm_vcpu *vcpu)
463{
464 atomic_clear_mask(PROG_BLOCK_SIE, &vcpu->arch.sie_block->prog20);
465}
466
467/*
468 * Kick a guest cpu out of SIE and wait until SIE is not running.
469 * If the CPU is not running (e.g. waiting as idle) the function will
470 * return immediately. */
471void exit_sie(struct kvm_vcpu *vcpu)
472{
473 atomic_set_mask(CPUSTAT_STOP_INT, &vcpu->arch.sie_block->cpuflags);
474 while (vcpu->arch.sie_block->prog0c & PROG_IN_SIE)
475 cpu_relax();
476}
477
478/* Kick a guest cpu out of SIE and prevent SIE-reentry */
479void exit_sie_sync(struct kvm_vcpu *vcpu)
480{
481 s390_vcpu_block(vcpu);
482 exit_sie(vcpu);
483}
484
457int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu) 485int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)
458{ 486{
459 /* kvm common code refers to this, but never calls it */ 487 /* kvm common code refers to this, but never calls it */