aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorCarsten Otte <carsteno@de.ibm.com>2009-11-19 08:21:16 -0500
committerAvi Kivity <avi@redhat.com>2009-12-03 02:32:25 -0500
commitd7b0b5eb3000c6fb902f08c619fcd673a23d8fab (patch)
tree4c7aa92657435c687f98383aaea5ce15ee9fba9c /arch
parent3cfc3092f40bc37c57ba556cfd8de4218f2135ab (diff)
KVM: s390: Make psw available on all exits, not just a subset
This patch moves s390 processor status word into the base kvm_run struct and keeps it up-to date on all userspace exits. The userspace ABI is broken by this, however there are no applications in the wild using this. A capability check is provided so users can verify the updated API exists. Cc: stable@kernel.org Signed-off-by: Carsten Otte <cotte@de.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/s390/include/asm/kvm.h3
-rw-r--r--arch/s390/kvm/kvm-s390.c25
2 files changed, 19 insertions, 9 deletions
diff --git a/arch/s390/include/asm/kvm.h b/arch/s390/include/asm/kvm.h
index 3dfcaeb5d7f4..82b32a100c7d 100644
--- a/arch/s390/include/asm/kvm.h
+++ b/arch/s390/include/asm/kvm.h
@@ -1,6 +1,5 @@
1#ifndef __LINUX_KVM_S390_H 1#ifndef __LINUX_KVM_S390_H
2#define __LINUX_KVM_S390_H 2#define __LINUX_KVM_S390_H
3
4/* 3/*
5 * asm-s390/kvm.h - KVM s390 specific structures and definitions 4 * asm-s390/kvm.h - KVM s390 specific structures and definitions
6 * 5 *
@@ -15,6 +14,8 @@
15 */ 14 */
16#include <linux/types.h> 15#include <linux/types.h>
17 16
17#define __KVM_S390
18
18/* for KVM_GET_REGS and KVM_SET_REGS */ 19/* for KVM_GET_REGS and KVM_SET_REGS */
19struct kvm_regs { 20struct kvm_regs {
20 /* general purpose regs for s390 */ 21 /* general purpose regs for s390 */
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