[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 40/40] accel/tcg: Simplify tcg_cpu_has_work()
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v6 40/40] accel/tcg: Simplify tcg_cpu_has_work() |
Date: |
Fri, 24 Sep 2021 11:38:47 +0200 |
All TCG targets implement the TCGCPUOps::has_work() handler.
We can remove the non-NULL handler check in tcg_cpu_has_work().
Add an assertion in tcg_exec_realizefn() for future TCG targets.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
accel/tcg/cpu-exec.c | 4 ++++
accel/tcg/tcg-accel-ops.c | 5 +----
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 5fd1ed34222..18c20e5759b 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -993,6 +993,10 @@ void tcg_exec_realizefn(CPUState *cpu, Error **errp)
CPUClass *cc = CPU_GET_CLASS(cpu);
if (!tcg_target_initialized) {
+ /* Mandatory non-NULL handlers */
+ g_assert(cc->tcg_ops->initialize);
+ g_assert(cc->tcg_ops->has_work);
+
cc->tcg_ops->initialize();
tcg_target_initialized = true;
}
diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c
index 3c75ed2cccc..6cd32f04cb9 100644
--- a/accel/tcg/tcg-accel-ops.c
+++ b/accel/tcg/tcg-accel-ops.c
@@ -78,10 +78,7 @@ static bool tcg_cpu_has_work(CPUState *cpu)
{
CPUClass *cc = CPU_GET_CLASS(cpu);
- if (cc->tcg_ops->has_work) {
- return cc->tcg_ops->has_work(cpu);
- }
- return false;
+ return cc->tcg_ops->has_work(cpu);
}
/* mask must never be zero, except for A20 change call */
--
2.31.1
- [PATCH v6 31/40] target/riscv: Restrict has_work() handler to sysemu and TCG, (continued)
- [PATCH v6 31/40] target/riscv: Restrict has_work() handler to sysemu and TCG, Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 29/40] target/ppc: Introduce PowerPCCPUClass::has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 33/40] target/s390x: Restrict has_work() handler to sysemu and TCG, Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 34/40] target/sh4: Restrict has_work() handler to sysemu, Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 35/40] target/sparc: Remove pointless use of CONFIG_TCG definition, Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 36/40] target/sparc: Restrict has_work() handler to sysemu, Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 37/40] target/tricore: Restrict has_work() handler to sysemu, Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 38/40] target/xtensa: Restrict has_work() handler to sysemu, Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 39/40] accel/tcg: Remove CPUClass::has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 40/40] accel/tcg: Simplify tcg_cpu_has_work(),
Philippe Mathieu-Daudé <=
- Re: [PATCH v6 00/40] accel: Move has_work() from CPUClass to AccelOpsClass, Philippe Mathieu-Daudé, 2021/09/25