[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v12 10/23] tcg: make CPUClass.cpu_exec_* optional
From: |
Claudio Fontana |
Subject: |
[PATCH v12 10/23] tcg: make CPUClass.cpu_exec_* optional |
Date: |
Sat, 12 Dec 2020 16:55:17 +0100 |
From: Eduardo Habkost <ehabkost@redhat.com>
This will let us simplify the code that initializes CPU class
methods, when we move cpu_exec_*() to a separate struct.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
---
accel/tcg/cpu-exec.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 8d31145ad2..890b88861a 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -240,14 +240,18 @@ static void cpu_exec_enter(CPUState *cpu)
{
CPUClass *cc = CPU_GET_CLASS(cpu);
- cc->cpu_exec_enter(cpu);
+ if (cc->cpu_exec_enter) {
+ cc->cpu_exec_enter(cpu);
+ }
}
static void cpu_exec_exit(CPUState *cpu)
{
CPUClass *cc = CPU_GET_CLASS(cpu);
- cc->cpu_exec_exit(cpu);
+ if (cc->cpu_exec_exit) {
+ cc->cpu_exec_exit(cpu);
+ }
}
void cpu_exec_step_atomic(CPUState *cpu)
@@ -619,7 +623,8 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
True when it is, and we should restart on a new TB,
and via longjmp via cpu_loop_exit. */
else {
- if (cc->cpu_exec_interrupt(cpu, interrupt_request)) {
+ if (cc->cpu_exec_interrupt &&
+ cc->cpu_exec_interrupt(cpu, interrupt_request)) {
if (need_replay_interrupt(interrupt_request)) {
replay_interrupt();
}
--
2.26.2
- [PATCH v12 14/23] target/riscv: remove CONFIG_TCG, as it is always TCG, (continued)
- [PATCH v12 20/23] target/arm: do not use cc->do_interrupt for KVM directly, Claudio Fontana, 2020/12/12
- [PATCH v12 19/23] cpu: Move debug_excp_handler to tcg_ops, Claudio Fontana, 2020/12/12
- [PATCH v12 09/23] tcg: cpu_exec_{enter,exit} helpers, Claudio Fontana, 2020/12/12
- [PATCH v12 10/23] tcg: make CPUClass.cpu_exec_* optional,
Claudio Fontana <=
- [PATCH v12 08/23] i386: tcg: remove inline from cpu_load_eflags, Claudio Fontana, 2020/12/12
- [PATCH v12 03/23] i386: move hax accel files into hax/, Claudio Fontana, 2020/12/12
- [PATCH v12 22/23] cpu: move cc->transaction_failed to tcg_ops, Claudio Fontana, 2020/12/12
- [PATCH v12 18/23] cpu: Move tlb_fill to tcg_ops, Claudio Fontana, 2020/12/12
- [PATCH v12 23/23] cpu: move do_unaligned_access to tcg_ops, Claudio Fontana, 2020/12/12
- [PATCH v12 13/23] cpu: Introduce TCGCpuOperations struct, Claudio Fontana, 2020/12/12
- [PATCH v12 12/23] cpu: Remove unnecessary noop methods, Claudio Fontana, 2020/12/12
- [PATCH v12 02/23] i386: move whpx accel files into whpx/, Claudio Fontana, 2020/12/12
- [PATCH v12 21/23] cpu: move cc->do_interrupt to tcg_ops, Claudio Fontana, 2020/12/12