aboutsummaryrefslogtreecommitdiff
path: root/target-s390x/kvm.c
diff options
context:
space:
mode:
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>2014-09-30 10:57:29 +0200
committerCornelia Huck <cornelia.huck@de.ibm.com>2014-10-10 10:37:47 +0200
commiteb24f7c6896e93047f2c58ffd3ba4f453e88280b (patch)
treed8d615b55773f051b51b70a5ed9822fa91c7f338 /target-s390x/kvm.c
parent75973bfe415774babe7c1e18fa682c050fdce73b (diff)
s390x/kvm: proper use of the cpu states OPERATING and STOPPED
This patch makes sure that halting a cpu and stopping a cpu are two different things. Stopping a cpu will also set the cpu halted - this is needed for common infrastructure to work (note that the stop and stopped flag cannot be used for our purpose because they are already used by other mechanisms). A cpu can be halted ("waiting") when it is operating. If interrupts are disabled, this is called a "disabled wait", as it can't be woken up anymore. A stopped cpu is treated like a "disabled wait" cpu, but in order to prepare for a proper cpu state synchronization with the kvm part, we need to track the real logical state of a cpu. Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> CC: Andreas Faerber <afaerber@suse.de> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'target-s390x/kvm.c')
-rw-r--r--target-s390x/kvm.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index a85a480c6a..415baea514 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -921,7 +921,7 @@ static void sigp_cpu_start(void *arg)
CPUState *cs = arg;
S390CPU *cpu = S390_CPU(cs);
- s390_add_running_cpu(cpu);
+ s390_cpu_set_state(CPU_STATE_OPERATING, cpu);
DPRINTF("DONE: KVM cpu start: %p\n", &cpu->env);
}
@@ -934,7 +934,7 @@ static void sigp_cpu_restart(void *arg)
};
kvm_s390_vcpu_interrupt(cpu, &irq);
- s390_add_running_cpu(cpu);
+ s390_cpu_set_state(CPU_STATE_OPERATING, cpu);
}
int kvm_s390_cpu_restart(S390CPU *cpu)
@@ -1074,7 +1074,7 @@ static void unmanageable_intercept(S390CPU *cpu, const char *str, int pswoffset)
error_report("Unmanageable %s! CPU%i new PSW: 0x%016lx:%016lx",
str, cs->cpu_index, ldq_phys(cs->as, cpu->env.psa + pswoffset),
ldq_phys(cs->as, cpu->env.psa + pswoffset + 8));
- s390_del_running_cpu(cpu);
+ s390_cpu_halt(cpu);
guest_panicked();
}
@@ -1103,7 +1103,8 @@ static int handle_intercept(S390CPU *cpu)
break;
case ICPT_WAITPSW:
/* disabled wait, since enabled wait is handled in kernel */
- if (s390_del_running_cpu(cpu) == 0) {
+ cpu_synchronize_state(cs);
+ if (s390_cpu_halt(cpu) == 0) {
if (is_special_wait_psw(cs)) {
qemu_system_shutdown_request();
} else {
@@ -1113,7 +1114,7 @@ static int handle_intercept(S390CPU *cpu)
r = EXCP_HALTED;
break;
case ICPT_CPU_STOP:
- if (s390_del_running_cpu(cpu) == 0) {
+ if (s390_cpu_set_state(CPU_STATE_STOPPED, cpu) == 0) {
qemu_system_shutdown_request();
}
r = EXCP_HALTED;