aboutsummaryrefslogtreecommitdiff
path: root/target-s390x/helper.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/helper.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/helper.c')
-rw-r--r--target-s390x/helper.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/target-s390x/helper.c b/target-s390x/helper.c
index e21afe6b46..09aec7b42e 100644
--- a/target-s390x/helper.c
+++ b/target-s390x/helper.c
@@ -504,23 +504,18 @@ hwaddr s390_cpu_get_phys_addr_debug(CPUState *cs, vaddr vaddr)
void load_psw(CPUS390XState *env, uint64_t mask, uint64_t addr)
{
+ env->psw.addr = addr;
+ env->psw.mask = mask;
+ env->cc_op = (mask >> 44) & 3;
+
if (mask & PSW_MASK_WAIT) {
S390CPU *cpu = s390_env_get_cpu(env);
- CPUState *cs = CPU(cpu);
- if (!(mask & (PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK))) {
- if (s390_del_running_cpu(cpu) == 0) {
+ if (s390_cpu_halt(cpu) == 0) {
#ifndef CONFIG_USER_ONLY
- qemu_system_shutdown_request();
+ qemu_system_shutdown_request();
#endif
- }
}
- cs->halted = 1;
- cs->exception_index = EXCP_HLT;
}
-
- env->psw.addr = addr;
- env->psw.mask = mask;
- env->cc_op = (mask >> 44) & 3;
}
static uint64_t get_psw_mask(CPUS390XState *env)
@@ -818,7 +813,7 @@ void s390_cpu_do_interrupt(CPUState *cs)
qemu_log_mask(CPU_LOG_INT, "%s: %d at pc=%" PRIx64 "\n",
__func__, cs->exception_index, env->psw.addr);
- s390_add_running_cpu(cpu);
+ s390_cpu_set_state(CPU_STATE_OPERATING, cpu);
/* handle machine checks */
if ((env->psw.mask & PSW_MASK_MCHECK) &&
(cs->exception_index == -1)) {