summaryrefslogtreecommitdiffstats
path: root/include/qom/cpu.h
diff options
context:
space:
mode:
authorMichael S. Tsirkin2013-04-24 22:58:04 +0200
committerAndreas Färber2013-05-01 13:04:18 +0200
commitd6b9e0d60cc511eca210834428bb74508cff3d33 (patch)
treed7220a74859b39703f59df54265c5f0cf778715b /include/qom/cpu.h
parentcpu: Introduce get_arch_id() method and override it for X86CPU (diff)
downloadqemu-d6b9e0d60cc511eca210834428bb74508cff3d33.tar.gz
qemu-d6b9e0d60cc511eca210834428bb74508cff3d33.tar.xz
qemu-d6b9e0d60cc511eca210834428bb74508cff3d33.zip
cpu: Add qemu_for_each_cpu()
Wrapper to avoid open-coded loops and to make CPUState iteration independent of CPUArchState. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'include/qom/cpu.h')
-rw-r--r--include/qom/cpu.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 1b4de17415..a28e5ffee2 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -216,6 +216,15 @@ bool cpu_is_stopped(CPUState *cpu);
void run_on_cpu(CPUState *cpu, void (*func)(void *data), void *data);
/**
+ * qemu_for_each_cpu:
+ * @func: The function to be executed.
+ * @data: Data to pass to the function.
+ *
+ * Executes @func for each CPU.
+ */
+void qemu_for_each_cpu(void (*func)(CPUState *cpu, void *data), void *data);
+
+/**
* qemu_get_cpu:
* @index: The CPUState@cpu_index value of the CPU to obtain.
*