[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 08/31] accel/tcg: Implement AccelOpsClass::has_work() as stub
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v5 08/31] accel/tcg: Implement AccelOpsClass::has_work() as stub |
Date: |
Mon, 20 Sep 2021 23:44:24 +0200 |
Add TCG target-specific has_work() handler in TCGCPUOps,
and add tcg_cpu_has_work() as AccelOpsClass has_work()
implementation.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
include/hw/core/tcg-cpu-ops.h | 4 ++++
accel/tcg/tcg-accel-ops.c | 10 ++++++++++
2 files changed, 14 insertions(+)
diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h
index 55123cb4d22..4a4c4053e3b 100644
--- a/include/hw/core/tcg-cpu-ops.h
+++ b/include/hw/core/tcg-cpu-ops.h
@@ -66,6 +66,10 @@ struct TCGCPUOps {
void (*do_interrupt)(CPUState *cpu);
#endif /* !CONFIG_USER_ONLY || !TARGET_I386 */
#ifdef CONFIG_SOFTMMU
+ /**
+ * @has_work: Callback for checking if there is work to do.
+ */
+ bool (*has_work)(CPUState *cpu);
/** @cpu_exec_interrupt: Callback for processing interrupts in cpu_exec */
bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request);
/**
diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c
index 1a8e8390bd6..f539ba53806 100644
--- a/accel/tcg/tcg-accel-ops.c
+++ b/accel/tcg/tcg-accel-ops.c
@@ -32,6 +32,7 @@
#include "qemu/main-loop.h"
#include "qemu/guest-random.h"
#include "exec/exec-all.h"
+#include "hw/core/tcg-cpu-ops.h"
#include "tcg-accel-ops.h"
#include "tcg-accel-ops-mttcg.h"
@@ -73,6 +74,14 @@ int tcg_cpus_exec(CPUState *cpu)
return ret;
}
+static bool tcg_cpu_has_work(CPUState *cpu)
+{
+ CPUClass *cc = CPU_GET_CLASS(cpu);
+
+ g_assert(cc->tcg_ops->has_work);
+ return cc->tcg_ops->has_work(cpu);
+}
+
/* mask must never be zero, except for A20 change call */
void tcg_handle_interrupt(CPUState *cpu, int mask)
{
@@ -108,6 +117,7 @@ static void tcg_accel_ops_init(AccelOpsClass *ops)
ops->kick_vcpu_thread = rr_kick_vcpu_thread;
ops->handle_interrupt = tcg_handle_interrupt;
}
+ ops->has_work = tcg_cpu_has_work;
}
static void tcg_accel_ops_class_init(ObjectClass *oc, void *data)
--
2.31.1
- [PATCH v5 03/31] hw/core: Restrict cpu_has_work() to sysemu, (continued)
- [PATCH v5 03/31] hw/core: Restrict cpu_has_work() to sysemu, Philippe Mathieu-Daudé, 2021/09/20
- [PATCH v5 04/31] hw/core: Un-inline cpu_has_work(), Philippe Mathieu-Daudé, 2021/09/20
- [PATCH v5 05/31] sysemu: Introduce AccelOpsClass::has_work(), Philippe Mathieu-Daudé, 2021/09/20
- [PATCH v5 06/31] accel/kvm: Implement AccelOpsClass::has_work(), Philippe Mathieu-Daudé, 2021/09/20
- [PATCH v5 07/31] accel/whpx: Implement AccelOpsClass::has_work(), Philippe Mathieu-Daudé, 2021/09/20
- [PATCH v5 11/31] target/avr: Restrict has_work() handler to sysemu, Philippe Mathieu-Daudé, 2021/09/20
- [PATCH v5 12/31] target/cris: Restrict has_work() handler to sysemu, Philippe Mathieu-Daudé, 2021/09/20
- [PATCH v5 08/31] accel/tcg: Implement AccelOpsClass::has_work() as stub,
Philippe Mathieu-Daudé <=
- [PATCH v5 10/31] target/arm: Restrict has_work() handler to sysemu and TCG, Philippe Mathieu-Daudé, 2021/09/20
- [PATCH v5 09/31] target/alpha: Restrict has_work() handler to sysemu, Philippe Mathieu-Daudé, 2021/09/20
- [PATCH v5 13/31] target/hexagon: Remove unused has_work() handler, Philippe Mathieu-Daudé, 2021/09/20
- [PATCH v5 14/31] target/hppa: Restrict has_work() handler to sysemu, Philippe Mathieu-Daudé, 2021/09/20
- [PATCH v5 15/31] target/i386: Restrict has_work() handler to sysemu and TCG, Philippe Mathieu-Daudé, 2021/09/20
- [PATCH v5 16/31] target/m68k: Restrict has_work() handler to sysemu, Philippe Mathieu-Daudé, 2021/09/20
- [PATCH v5 17/31] target/microblaze: Restrict has_work() handler to sysemu, Philippe Mathieu-Daudé, 2021/09/20