KVM: s390: implements the kvm_arch_vcpu_in_kernel()
authorLongpeng(Mike) <longpeng2@huawei.com>
Tue, 8 Aug 2017 04:05:34 +0000 (12:05 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 8 Aug 2017 08:57:43 +0000 (10:57 +0200)
This implements kvm_arch_vcpu_in_kernel() for s390.  DIAG is a privileged
operation, so it cannot be called from problem state (user mode).

Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/s390/kvm/diag.c
arch/s390/kvm/kvm-s390.c

index 6182edebea3db9477bb67219738e576f3e46688a..5ee90020382dcfe8da61a3eeef5f1fc7a544e6ee 100644 (file)
@@ -150,7 +150,7 @@ static int __diag_time_slice_end(struct kvm_vcpu *vcpu)
 {
        VCPU_EVENT(vcpu, 5, "%s", "diag time slice end");
        vcpu->stat.diagnose_44++;
-       kvm_vcpu_on_spin(vcpu, false);
+       kvm_vcpu_on_spin(vcpu, true);
        return 0;
 }
 
index 5e07322034b9f7a016bc56842ece38f30d9d5863..9f23a9e81a91d9006f6f52790d0875125914a732 100644 (file)
@@ -2449,7 +2449,7 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
 
 bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu)
 {
-       return false;
+       return !(vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE);
 }
 
 void kvm_s390_vcpu_block(struct kvm_vcpu *vcpu)