aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>2014-06-06 04:25:09 -0400
committerChristian Borntraeger <borntraeger@de.ibm.com>2014-10-28 08:09:14 -0400
commita6cc3108567e0adc06c4a8031186f84ad1e1e194 (patch)
treeec8594d77600ecb84dec4ed06e6c835702470f48 /arch/s390
parent07b0303540e1951c75c98b7dd729ff1851a0049f (diff)
KVM: s390: sigp: split handling of SIGP STOP (AND STORE STATUS)
In preparation for further code changes (e.g. getting rid of action_flags), this patch splits the handling of the two sigp orders SIGP STOP and SIGP STOP AND STORE STATUS by introducing a separate handler function for SIGP STOP AND STORE STATUS. Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/kvm/sigp.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c
index 1b330d4eb20b..f7cd3f774f25 100644
--- a/arch/s390/kvm/sigp.c
+++ b/arch/s390/kvm/sigp.c
@@ -147,15 +147,27 @@ out:
147 return rc; 147 return rc;
148} 148}
149 149
150static int __sigp_stop(struct kvm_vcpu *vcpu, struct kvm_vcpu *dst_vcpu, 150static int __sigp_stop(struct kvm_vcpu *vcpu, struct kvm_vcpu *dst_vcpu)
151 int action)
152{ 151{
153 int rc; 152 int rc;
154 153
155 rc = __inject_sigp_stop(dst_vcpu, action); 154 rc = __inject_sigp_stop(dst_vcpu, ACTION_STOP_ON_STOP);
156 VCPU_EVENT(vcpu, 4, "sent sigp stop to cpu %x", dst_vcpu->vcpu_id); 155 VCPU_EVENT(vcpu, 4, "sent sigp stop to cpu %x", dst_vcpu->vcpu_id);
157 156
158 if ((action & ACTION_STORE_ON_STOP) != 0 && rc == -ESHUTDOWN) { 157 return rc;
158}
159
160static int __sigp_stop_and_store_status(struct kvm_vcpu *vcpu,
161 struct kvm_vcpu *dst_vcpu, u64 *reg)
162{
163 int rc;
164
165 rc = __inject_sigp_stop(dst_vcpu, ACTION_STOP_ON_STOP |
166 ACTION_STORE_ON_STOP);
167 VCPU_EVENT(vcpu, 4, "sent sigp stop and store status to cpu %x",
168 dst_vcpu->vcpu_id);
169
170 if (rc == -ESHUTDOWN) {
159 /* If the CPU has already been stopped, we still have 171 /* If the CPU has already been stopped, we still have
160 * to save the status when doing stop-and-store. This 172 * to save the status when doing stop-and-store. This
161 * has to be done after unlocking all spinlocks. */ 173 * has to be done after unlocking all spinlocks. */
@@ -347,12 +359,11 @@ static int handle_sigp_dst(struct kvm_vcpu *vcpu, u8 order_code,
347 break; 359 break;
348 case SIGP_STOP: 360 case SIGP_STOP:
349 vcpu->stat.instruction_sigp_stop++; 361 vcpu->stat.instruction_sigp_stop++;
350 rc = __sigp_stop(vcpu, dst_vcpu, ACTION_STOP_ON_STOP); 362 rc = __sigp_stop(vcpu, dst_vcpu);
351 break; 363 break;
352 case SIGP_STOP_AND_STORE_STATUS: 364 case SIGP_STOP_AND_STORE_STATUS:
353 vcpu->stat.instruction_sigp_stop_store_status++; 365 vcpu->stat.instruction_sigp_stop_store_status++;
354 rc = __sigp_stop(vcpu, dst_vcpu, ACTION_STORE_ON_STOP | 366 rc = __sigp_stop_and_store_status(vcpu, dst_vcpu, status_reg);
355 ACTION_STOP_ON_STOP);
356 break; 367 break;
357 case SIGP_STORE_STATUS_AT_ADDRESS: 368 case SIGP_STORE_STATUS_AT_ADDRESS:
358 vcpu->stat.instruction_sigp_store_status++; 369 vcpu->stat.instruction_sigp_store_status++;