cpu: Move queued_work_{first,last} to CPUState
Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
c08d7424d6
commit
c64ca8140e
|
@ -205,7 +205,6 @@ typedef struct CPUWatchpoint {
|
||||||
/* user data */ \
|
/* user data */ \
|
||||||
void *opaque; \
|
void *opaque; \
|
||||||
\
|
\
|
||||||
struct qemu_work_item *queued_work_first, *queued_work_last; \
|
|
||||||
const char *cpu_model_str; \
|
const char *cpu_model_str; \
|
||||||
struct KVMState *kvm_state; \
|
struct KVMState *kvm_state; \
|
||||||
struct kvm_run *kvm_run; \
|
struct kvm_run *kvm_run; \
|
||||||
|
|
19
cpus.c
19
cpus.c
|
@ -66,7 +66,7 @@ static bool cpu_thread_is_idle(CPUArchState *env)
|
||||||
{
|
{
|
||||||
CPUState *cpu = ENV_GET_CPU(env);
|
CPUState *cpu = ENV_GET_CPU(env);
|
||||||
|
|
||||||
if (cpu->stop || env->queued_work_first) {
|
if (cpu->stop || cpu->queued_work_first) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (cpu->stopped || !runstate_is_running()) {
|
if (cpu->stopped || !runstate_is_running()) {
|
||||||
|
@ -652,12 +652,12 @@ void run_on_cpu(CPUArchState *env, void (*func)(void *data), void *data)
|
||||||
|
|
||||||
wi.func = func;
|
wi.func = func;
|
||||||
wi.data = data;
|
wi.data = data;
|
||||||
if (!env->queued_work_first) {
|
if (cpu->queued_work_first == NULL) {
|
||||||
env->queued_work_first = &wi;
|
cpu->queued_work_first = &wi;
|
||||||
} else {
|
} else {
|
||||||
env->queued_work_last->next = &wi;
|
cpu->queued_work_last->next = &wi;
|
||||||
}
|
}
|
||||||
env->queued_work_last = &wi;
|
cpu->queued_work_last = &wi;
|
||||||
wi.next = NULL;
|
wi.next = NULL;
|
||||||
wi.done = false;
|
wi.done = false;
|
||||||
|
|
||||||
|
@ -672,18 +672,19 @@ void run_on_cpu(CPUArchState *env, void (*func)(void *data), void *data)
|
||||||
|
|
||||||
static void flush_queued_work(CPUArchState *env)
|
static void flush_queued_work(CPUArchState *env)
|
||||||
{
|
{
|
||||||
|
CPUState *cpu = ENV_GET_CPU(env);
|
||||||
struct qemu_work_item *wi;
|
struct qemu_work_item *wi;
|
||||||
|
|
||||||
if (!env->queued_work_first) {
|
if (cpu->queued_work_first == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((wi = env->queued_work_first)) {
|
while ((wi = cpu->queued_work_first)) {
|
||||||
env->queued_work_first = wi->next;
|
cpu->queued_work_first = wi->next;
|
||||||
wi->func(wi->data);
|
wi->func(wi->data);
|
||||||
wi->done = true;
|
wi->done = true;
|
||||||
}
|
}
|
||||||
env->queued_work_last = NULL;
|
cpu->queued_work_last = NULL;
|
||||||
qemu_cond_broadcast(&qemu_work_cond);
|
qemu_cond_broadcast(&qemu_work_cond);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,7 @@ struct CPUState {
|
||||||
HANDLE hThread;
|
HANDLE hThread;
|
||||||
#endif
|
#endif
|
||||||
struct QemuCond *halt_cond;
|
struct QemuCond *halt_cond;
|
||||||
|
struct qemu_work_item *queued_work_first, *queued_work_last;
|
||||||
bool thread_kicked;
|
bool thread_kicked;
|
||||||
bool created;
|
bool created;
|
||||||
bool stop;
|
bool stop;
|
||||||
|
|
Loading…
Reference in New Issue