[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH qom-next 12/59] cpu: Move stop field to CPUState
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH qom-next 12/59] cpu: Move stop field to CPUState |
Date: |
Wed, 23 May 2012 05:07:35 +0200 |
Change its type to bool.
Signed-off-by: Andreas Färber <address@hidden>
---
cpu-defs.h | 1 -
cpus.c | 27 ++++++++++++++++++---------
include/qemu/cpu.h | 2 ++
3 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/cpu-defs.h b/cpu-defs.h
index ae95158..c93371e 100644
--- a/cpu-defs.h
+++ b/cpu-defs.h
@@ -205,7 +205,6 @@ typedef struct CPUWatchpoint {
/* user data */ \
void *opaque; \
\
- uint32_t stop; /* Stop request */ \
uint32_t stopped; /* Artificially stopped */ \
struct QemuCond *halt_cond; \
struct qemu_work_item *queued_work_first, *queued_work_last; \
diff --git a/cpus.c b/cpus.c
index 8ad4949..e26ef39 100644
--- a/cpus.c
+++ b/cpus.c
@@ -424,7 +424,9 @@ static void do_vm_stop(RunState state)
static int cpu_can_run(CPUArchState *env)
{
- if (env->stop) {
+ CPUState *cpu = ENV_GET_CPU(env);
+
+ if (cpu->stop) {
return 0;
}
if (env->stopped || !runstate_is_running()) {
@@ -435,7 +437,9 @@ static int cpu_can_run(CPUArchState *env)
static bool cpu_thread_is_idle(CPUArchState *env)
{
- if (env->stop || env->queued_work_first) {
+ CPUState *cpu = ENV_GET_CPU(env);
+
+ if (cpu->stop || env->queued_work_first) {
return false;
}
if (env->stopped || !runstate_is_running()) {
@@ -689,8 +693,8 @@ static void qemu_wait_io_event_common(CPUArchState *env)
{
CPUState *cpu = ENV_GET_CPU(env);
- if (env->stop) {
- env->stop = 0;
+ if (cpu->stop) {
+ cpu->stop = false;
env->stopped = 1;
qemu_cond_signal(&qemu_pause_cond);
}
@@ -938,7 +942,8 @@ void pause_all_vcpus(void)
qemu_clock_enable(vm_clock, false);
while (penv) {
- penv->stop = 1;
+ CPUState *pcpu = ENV_GET_CPU(penv);
+ pcpu->stop = true;
qemu_cpu_kick(penv);
penv = penv->next_cpu;
}
@@ -947,7 +952,8 @@ void pause_all_vcpus(void)
cpu_stop_current();
if (!kvm_enabled()) {
while (penv) {
- penv->stop = 0;
+ CPUState *pcpu = ENV_GET_CPU(penv);
+ pcpu->stop = 0;
penv->stopped = 1;
penv = penv->next_cpu;
}
@@ -971,7 +977,8 @@ void resume_all_vcpus(void)
qemu_clock_enable(vm_clock, true);
while (penv) {
- penv->stop = 0;
+ CPUState *pcpu = ENV_GET_CPU(penv);
+ pcpu->stop = false;
penv->stopped = 0;
qemu_cpu_kick(penv);
penv = penv->next_cpu;
@@ -1051,7 +1058,8 @@ void qemu_init_vcpu(void *_env)
void cpu_stop_current(void)
{
if (cpu_single_env) {
- cpu_single_env->stop = 0;
+ CPUState *cpu_single_cpu = ENV_GET_CPU(cpu_single_env);
+ cpu_single_cpu->stop = false;
cpu_single_env->stopped = 1;
cpu_exit(cpu_single_env);
qemu_cond_signal(&qemu_pause_cond);
@@ -1133,6 +1141,7 @@ static void tcg_exec_all(void)
}
for (; next_cpu != NULL && !exit_request; next_cpu = next_cpu->next_cpu) {
CPUArchState *env = next_cpu;
+ CPUState *cpu = ENV_GET_CPU(env);
qemu_clock_enable(vm_clock,
(env->singlestep_enabled & SSTEP_NOTIMER) == 0);
@@ -1143,7 +1152,7 @@ static void tcg_exec_all(void)
cpu_handle_guest_debug(env);
break;
}
- } else if (env->stop || env->stopped) {
+ } else if (cpu->stop || env->stopped) {
break;
}
}
diff --git a/include/qemu/cpu.h b/include/qemu/cpu.h
index 3ab2e25..04c7848 100644
--- a/include/qemu/cpu.h
+++ b/include/qemu/cpu.h
@@ -55,6 +55,7 @@ typedef struct CPUClass {
/**
* CPUState:
* @created: Indicates whether the CPU thread has been successfully created.
+ * @stop: Indicates a pending stop request.
*
* State of one CPU core or thread.
*/
@@ -69,6 +70,7 @@ struct CPUState {
#endif
bool thread_kicked;
bool created;
+ bool stop;
/* TODO Move common fields from CPUArchState here. */
};
--
1.7.7
- [Qemu-devel] [PATCH qom-next 09/59] cpus: Pass CPUState to qemu_cpu_is_self(), (continued)
- [Qemu-devel] [PATCH qom-next 09/59] cpus: Pass CPUState to qemu_cpu_is_self(), Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 14/59] cpu: Move stopped field to CPUState, Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 05/59] apic: Replace cpu_env pointer by X86CPU link, Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 08/59] Makefile.dis: Add include/ to include path, Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 17/59] cpu: Move halt_cond to CPUState, Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 04/59] pc: Add CPU as /machine/cpu[n], Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 06/59] pc: Pass X86CPU to cpu_is_bsp(), Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 07/59] cpu: Move thread_kicked to CPUState, Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 22/59] ppc: Pass PowerPCCPU to power7_set_irq(), Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 20/59] ppc: Pass PowerPCCPU to ppc6xx_set_irq(), Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 12/59] cpu: Move stop field to CPUState,
Andreas Färber <=
- [Qemu-devel] [PATCH qom-next 02/59] cpu: Move CPU_COMMON_THREAD into CPUState, Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 18/59] cpus: Pass CPUState to qemu_tcg_cpu_thread_fn, Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 21/59] ppc: Pass PowerPCCPU to ppc970_set_irq(), Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 27/59] sun4u: Pass SPARCCPU to {, s, hs}tick_irq() and cpu_timer_create(), Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 16/59] cpus: Pass CPUState to cpu_can_run(), Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 23/59] ppc: Pass PowerPCCPU to ppc40x_set_irq(), Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 29/59] target-ppc: Rename kvm_kick_{env => cpu} and pass PowerPCCPU, Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 30/59] target-s390x: Let cpu_s390x_init() return S390CPU, Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 13/59] ppce500_spin: Store PowerPCCPU in SpinKick, Andreas Färber, 2012/05/22
- [Qemu-devel] [PATCH qom-next 33/59] target-s390x: Pass S390CPU to s390_cpu_restart(), Andreas Färber, 2012/05/22