aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kvm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/kvm')
-rw-r--r--arch/s390/kvm/kvm-s390.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 544505893c9f..f8bcaefd7d34 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -117,10 +117,16 @@ long kvm_arch_dev_ioctl(struct file *filp,
117 117
118int kvm_dev_ioctl_check_extension(long ext) 118int kvm_dev_ioctl_check_extension(long ext)
119{ 119{
120 int r;
121
120 switch (ext) { 122 switch (ext) {
123 case KVM_CAP_S390_PSW:
124 r = 1;
125 break;
121 default: 126 default:
122 return 0; 127 r = 0;
123 } 128 }
129 return r;
124} 130}
125 131
126/* Section: vm related */ 132/* Section: vm related */
@@ -420,8 +426,10 @@ static int kvm_arch_vcpu_ioctl_set_initial_psw(struct kvm_vcpu *vcpu, psw_t psw)
420 vcpu_load(vcpu); 426 vcpu_load(vcpu);
421 if (atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_RUNNING) 427 if (atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_RUNNING)
422 rc = -EBUSY; 428 rc = -EBUSY;
423 else 429 else {
424 vcpu->arch.sie_block->gpsw = psw; 430 vcpu->run->psw_mask = psw.mask;
431 vcpu->run->psw_addr = psw.addr;
432 }
425 vcpu_put(vcpu); 433 vcpu_put(vcpu);
426 return rc; 434 return rc;
427} 435}
@@ -509,9 +517,6 @@ rerun_vcpu:
509 517
510 switch (kvm_run->exit_reason) { 518 switch (kvm_run->exit_reason) {
511 case KVM_EXIT_S390_SIEIC: 519 case KVM_EXIT_S390_SIEIC:
512 vcpu->arch.sie_block->gpsw.mask = kvm_run->s390_sieic.mask;
513 vcpu->arch.sie_block->gpsw.addr = kvm_run->s390_sieic.addr;
514 break;
515 case KVM_EXIT_UNKNOWN: 520 case KVM_EXIT_UNKNOWN:
516 case KVM_EXIT_INTR: 521 case KVM_EXIT_INTR:
517 case KVM_EXIT_S390_RESET: 522 case KVM_EXIT_S390_RESET:
@@ -520,6 +525,9 @@ rerun_vcpu:
520 BUG(); 525 BUG();
521 } 526 }
522 527
528 vcpu->arch.sie_block->gpsw.mask = kvm_run->psw_mask;
529 vcpu->arch.sie_block->gpsw.addr = kvm_run->psw_addr;
530
523 might_fault(); 531 might_fault();
524 532
525 do { 533 do {
@@ -539,8 +547,6 @@ rerun_vcpu:
539 /* intercept cannot be handled in-kernel, prepare kvm-run */ 547 /* intercept cannot be handled in-kernel, prepare kvm-run */
540 kvm_run->exit_reason = KVM_EXIT_S390_SIEIC; 548 kvm_run->exit_reason = KVM_EXIT_S390_SIEIC;
541 kvm_run->s390_sieic.icptcode = vcpu->arch.sie_block->icptcode; 549 kvm_run->s390_sieic.icptcode = vcpu->arch.sie_block->icptcode;
542 kvm_run->s390_sieic.mask = vcpu->arch.sie_block->gpsw.mask;
543 kvm_run->s390_sieic.addr = vcpu->arch.sie_block->gpsw.addr;
544 kvm_run->s390_sieic.ipa = vcpu->arch.sie_block->ipa; 550 kvm_run->s390_sieic.ipa = vcpu->arch.sie_block->ipa;
545 kvm_run->s390_sieic.ipb = vcpu->arch.sie_block->ipb; 551 kvm_run->s390_sieic.ipb = vcpu->arch.sie_block->ipb;
546 rc = 0; 552 rc = 0;
@@ -552,6 +558,9 @@ rerun_vcpu:
552 rc = 0; 558 rc = 0;
553 } 559 }
554 560
561 kvm_run->psw_mask = vcpu->arch.sie_block->gpsw.mask;
562 kvm_run->psw_addr = vcpu->arch.sie_block->gpsw.addr;
563
555 if (vcpu->sigset_active) 564 if (vcpu->sigset_active)
556 sigprocmask(SIG_SETMASK, &sigsaved, NULL); 565 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
557 566