aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorThomas Huth <thuth@linux.vnet.ibm.com>2013-11-21 10:01:48 -0500
committerCornelia Huck <cornelia.huck@de.ibm.com>2013-12-11 13:04:37 -0500
commitb13d3580ee47ba3b2814e90b8a9b8241f7a4ba83 (patch)
treec1038e66d0e1029f1f46bf1248ca55abacf496e5 /arch/s390
parent949c007acd8b6887cf5f3ac86512a7b12fa245dc (diff)
KVM: s390: Add the SIGP order CONDITIONAL EMERGENCY SIGNAL
This patch adds the missing SIGP order "conditional emergency signal" by calling the "emergency signal" SIGP handler if the required conditions are met. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/include/asm/sigp.h1
-rw-r--r--arch/s390/kvm/sigp.c37
2 files changed, 37 insertions, 1 deletions
diff --git a/arch/s390/include/asm/sigp.h b/arch/s390/include/asm/sigp.h
index 5a87d16d3e7c..c002cd529c71 100644
--- a/arch/s390/include/asm/sigp.h
+++ b/arch/s390/include/asm/sigp.h
@@ -12,6 +12,7 @@
12#define SIGP_SET_PREFIX 13 12#define SIGP_SET_PREFIX 13
13#define SIGP_STORE_STATUS_AT_ADDRESS 14 13#define SIGP_STORE_STATUS_AT_ADDRESS 14
14#define SIGP_SET_ARCHITECTURE 18 14#define SIGP_SET_ARCHITECTURE 18
15#define SIGP_COND_EMERGENCY_SIGNAL 19
15#define SIGP_SENSE_RUNNING 21 16#define SIGP_SENSE_RUNNING 21
16 17
17/* SIGP condition codes */ 18/* SIGP condition codes */
diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c
index bc0d85a24b1b..eee1402349f2 100644
--- a/arch/s390/kvm/sigp.c
+++ b/arch/s390/kvm/sigp.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * handling interprocessor communication 2 * handling interprocessor communication
3 * 3 *
4 * Copyright IBM Corp. 2008, 2009 4 * Copyright IBM Corp. 2008, 2013
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License (version 2 only) 7 * it under the terms of the GNU General Public License (version 2 only)
@@ -89,6 +89,37 @@ unlock:
89 return rc; 89 return rc;
90} 90}
91 91
92static int __sigp_conditional_emergency(struct kvm_vcpu *vcpu, u16 cpu_addr,
93 u16 asn, u64 *reg)
94{
95 struct kvm_vcpu *dst_vcpu = NULL;
96 const u64 psw_int_mask = PSW_MASK_IO | PSW_MASK_EXT;
97 u16 p_asn, s_asn;
98 psw_t *psw;
99 u32 flags;
100
101 if (cpu_addr < KVM_MAX_VCPUS)
102 dst_vcpu = kvm_get_vcpu(vcpu->kvm, cpu_addr);
103 if (!dst_vcpu)
104 return SIGP_CC_NOT_OPERATIONAL;
105 flags = atomic_read(&dst_vcpu->arch.sie_block->cpuflags);
106 psw = &dst_vcpu->arch.sie_block->gpsw;
107 p_asn = dst_vcpu->arch.sie_block->gcr[4] & 0xffff; /* Primary ASN */
108 s_asn = dst_vcpu->arch.sie_block->gcr[3] & 0xffff; /* Secondary ASN */
109
110 /* Deliver the emergency signal? */
111 if (!(flags & CPUSTAT_STOPPED)
112 || (psw->mask & psw_int_mask) != psw_int_mask
113 || ((flags & CPUSTAT_WAIT) && psw->addr != 0)
114 || (!(flags & CPUSTAT_WAIT) && (asn == p_asn || asn == s_asn))) {
115 return __sigp_emergency(vcpu, cpu_addr);
116 } else {
117 *reg &= 0xffffffff00000000UL;
118 *reg |= SIGP_STATUS_INCORRECT_STATE;
119 return SIGP_CC_STATUS_STORED;
120 }
121}
122
92static int __sigp_external_call(struct kvm_vcpu *vcpu, u16 cpu_addr) 123static int __sigp_external_call(struct kvm_vcpu *vcpu, u16 cpu_addr)
93{ 124{
94 struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int; 125 struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int;
@@ -417,6 +448,10 @@ int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu)
417 rc = __sigp_set_prefix(vcpu, cpu_addr, parameter, 448 rc = __sigp_set_prefix(vcpu, cpu_addr, parameter,
418 &vcpu->run->s.regs.gprs[r1]); 449 &vcpu->run->s.regs.gprs[r1]);
419 break; 450 break;
451 case SIGP_COND_EMERGENCY_SIGNAL:
452 rc = __sigp_conditional_emergency(vcpu, cpu_addr, parameter,
453 &vcpu->run->s.regs.gprs[r1]);
454 break;
420 case SIGP_SENSE_RUNNING: 455 case SIGP_SENSE_RUNNING:
421 vcpu->stat.instruction_sigp_sense_running++; 456 vcpu->stat.instruction_sigp_sense_running++;
422 rc = __sigp_sense_running(vcpu, cpu_addr, 457 rc = __sigp_sense_running(vcpu, cpu_addr,