@@ -13,10 +13,20 @@
#define TCG_ACCEL_OPS_H
#include "system/cpus.h"
+#include "hw/core/cpu.h"
void tcg_cpu_destroy(CPUState *cpu);
int tcg_cpu_exec(CPUState *cpu);
void tcg_handle_interrupt(CPUState *cpu, int mask);
void tcg_cpu_init_cflags(CPUState *cpu, bool parallel);
+#ifdef CONFIG_USER_ONLY
+#define tcg_cpus_queue cpus_queue
+#else
+/* Guard with qemu_cpu_list_lock */
+extern CPUTailQ tcg_cpus_queue;
+#endif
+
+#define CPU_FOREACH_TCG(cpu) QTAILQ_FOREACH_RCU(cpu, &tcg_cpus_queue, node)
+
#endif /* TCG_ACCEL_OPS_H */
@@ -47,6 +47,13 @@
/* common functionality among all TCG variants */
+CPUTailQ tcg_cpus_queue = QTAILQ_HEAD_INITIALIZER(tcg_cpus_queue);
+
+static CPUTailQ *tcg_get_cpus_queue(void)
+{
+ return &tcg_cpus_queue;
+}
+
void tcg_cpu_init_cflags(CPUState *cpu, bool parallel)
{
uint32_t cflags;
@@ -199,6 +206,7 @@ static inline void tcg_remove_all_breakpoints(CPUState *cpu)
static void tcg_accel_ops_init(AccelOpsClass *ops)
{
+ ops->get_cpus_queue = tcg_get_cpus_queue;
if (qemu_tcg_mttcg_enabled()) {
ops->create_vcpu_thread = mttcg_start_vcpu_thread;
ops->kick_vcpu_thread = mttcg_kick_vcpu_thread;
Use a specific vCPUs queue for our unique software accelerator. Register the AccelOpsClass::get_cpus_queue() handler. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- accel/tcg/tcg-accel-ops.h | 10 ++++++++++ accel/tcg/tcg-accel-ops.c | 8 ++++++++ 2 files changed, 18 insertions(+)