[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC v7 09/22] tcg: make CPUClass.cpu_exec_* optional
From: |
Claudio Fontana |
Subject: |
[RFC v7 09/22] tcg: make CPUClass.cpu_exec_* optional |
Date: |
Mon, 30 Nov 2020 03:35:22 +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>
---
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
- [RFC v7 00/22] i386 cleanup, Claudio Fontana, 2020/11/29
- [RFC v7 01/22] i386: move kvm accel files into kvm/, Claudio Fontana, 2020/11/29
- [RFC v7 02/22] i386: move whpx accel files into whpx/, Claudio Fontana, 2020/11/29
- [RFC v7 04/22] i386: hvf: remove stale MAINTAINERS entry for old hvf stubs, Claudio Fontana, 2020/11/29
- [RFC v7 03/22] i386: move hax accel files into hax/, Claudio Fontana, 2020/11/29
- [RFC v7 08/22] tcg: cpu_exec_{enter,exit} helpers, Claudio Fontana, 2020/11/29
- [RFC v7 05/22] i386: move TCG accel files into tcg/, Claudio Fontana, 2020/11/29
- [RFC v7 06/22] i386: move cpu dump out of helper.c into cpu-dump.c, Claudio Fontana, 2020/11/29
- [RFC v7 07/22] i386: move TCG cpu class initialization out of helper.c, Claudio Fontana, 2020/11/29
- [RFC v7 09/22] tcg: make CPUClass.cpu_exec_* optional,
Claudio Fontana <=
- [RFC v7 12/22] cpu: Introduce TCGCpuOperations struct, Claudio Fontana, 2020/11/29
- [RFC v7 11/22] cpu: Remove unnecessary noop methods, Claudio Fontana, 2020/11/29
- [RFC v7 15/22] cpu: Move tlb_fill to tcg_ops, Claudio Fontana, 2020/11/29
- [RFC v7 10/22] tcg: Make CPUClass.debug_excp_handler optional, Claudio Fontana, 2020/11/29
- [RFC v7 16/22] cpu: Move debug_excp_handler to tcg_ops, Claudio Fontana, 2020/11/29
- [RFC v7 14/22] cpu: Move cpu_exec_* to tcg_ops, Claudio Fontana, 2020/11/29
- [RFC v7 19/22] accel: introduce AccelCPUClass extending CPUClass, Claudio Fontana, 2020/11/29
- [RFC v7 17/22] accel: extend AccelState and AccelClass to user-mode, Claudio Fontana, 2020/11/29
- [RFC v7 18/22] accel: replace struct CpusAccel with AccelOpsClass, Claudio Fontana, 2020/11/29
- [RFC v7 22/22] cpu: introduce cpu_accel_instance_init, Claudio Fontana, 2020/11/29