summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAnthony Liguori2012-11-01 17:12:32 +0100
committerAnthony Liguori2012-11-01 17:12:32 +0100
commit98c8a73b2e82eecac359b0b55a2d9d69f0a916ff (patch)
tree83411ea890eb54266773ad4337fc91c49dd36999 /include
parentarm_boot: Change initrd load address to "halfway through RAM" (diff)
parenttarget-i386: Pass X86CPU to kvm_handle_halt() (diff)
downloadqemu-98c8a73b2e82eecac359b0b55a2d9d69f0a916ff.tar.gz
qemu-98c8a73b2e82eecac359b0b55a2d9d69f0a916ff.tar.xz
qemu-98c8a73b2e82eecac359b0b55a2d9d69f0a916ff.zip
Merge remote-tracking branch 'afaerber/qom-cpu' into staging
* afaerber/qom-cpu: (35 commits) target-i386: Pass X86CPU to kvm_handle_halt() target-i386: Pass X86CPU to kvm_get_mp_state() cpu: Move thread_id to CPUState cpus: Pass CPUState to run_on_cpu() target-i386: Pass X86CPU to cpu_x86_inject_mce() target-i386: Pass X86CPU to kvm_mce_inject() cpus: Pass CPUState to [qemu_]cpu_has_work() spapr: Pass PowerPCCPU to hypercalls spapr: Pass PowerPCCPU to spapr_hypercall() target-ppc: Pass PowerPCCPU to cpu_ppc_hypercall target-ppc: Pass PowerPCCPU to powerpc_excp() xtensa_pic: Pass XtensaCPU to xtensa_ccompare_cb() cpus: Pass CPUState to qemu_wait_io_event_common() cpus: Pass CPUState to flush_queued_work() cpu: Move queued_work_{first,last} to CPUState cpus: Pass CPUState to qemu_cpu_kick() target-ppc: Rename kvm_kick_{env => cpu} and pass PowerPCCPU ppc: Pass PowerPCCPU to {ppc6xx,ppc970,power7,ppc40x,ppce500}_set_irq() cpus: Pass CPUState to qemu_tcg_init_vcpu() cpus: Pass CPUState to qemu_tcg_cpu_thread_fn ... Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'include')
-rw-r--r--include/qemu/cpu.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/include/qemu/cpu.h b/include/qemu/cpu.h
index ad706a6dbd..61b76982f1 100644
--- a/include/qemu/cpu.h
+++ b/include/qemu/cpu.h
@@ -54,6 +54,9 @@ typedef struct CPUClass {
/**
* CPUState:
+ * @created: Indicates whether the CPU thread has been successfully created.
+ * @stop: Indicates a pending stop request.
+ * @stopped: Indicates the CPU has been artificially stopped.
*
* State of one CPU core or thread.
*/
@@ -66,7 +69,13 @@ struct CPUState {
#ifdef _WIN32
HANDLE hThread;
#endif
+ int thread_id;
+ struct QemuCond *halt_cond;
+ struct qemu_work_item *queued_work_first, *queued_work_last;
bool thread_kicked;
+ bool created;
+ bool stop;
+ bool stopped;
/* TODO Move common fields from CPUArchState here. */
};
@@ -78,5 +87,54 @@ struct CPUState {
*/
void cpu_reset(CPUState *cpu);
+/**
+ * qemu_cpu_has_work:
+ * @cpu: The vCPU to check.
+ *
+ * Checks whether the CPU has work to do.
+ *
+ * Returns: %true if the CPU has work, %false otherwise.
+ */
+bool qemu_cpu_has_work(CPUState *cpu);
+
+/**
+ * qemu_cpu_is_self:
+ * @cpu: The vCPU to check against.
+ *
+ * Checks whether the caller is executing on the vCPU thread.
+ *
+ * Returns: %true if called from @cpu's thread, %false otherwise.
+ */
+bool qemu_cpu_is_self(CPUState *cpu);
+
+/**
+ * qemu_cpu_kick:
+ * @cpu: The vCPU to kick.
+ *
+ * Kicks @cpu's thread.
+ */
+void qemu_cpu_kick(CPUState *cpu);
+
+/**
+ * cpu_is_stopped:
+ * @cpu: The CPU to check.
+ *
+ * Checks whether the CPU is stopped.
+ *
+ * Returns: %true if run state is not running or if artificially stopped;
+ * %false otherwise.
+ */
+bool cpu_is_stopped(CPUState *cpu);
+
+/**
+ * run_on_cpu:
+ * @cpu: The vCPU to run on.
+ * @func: The function to be executed.
+ * @data: Data to pass to the function.
+ *
+ * Schedules the function @func for execution on the vCPU @cpu.
+ */
+void run_on_cpu(CPUState *cpu, void (*func)(void *data), void *data);
+
#endif