From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Anton Johansson" <anjo@rev.ng>,
"Riku Voipio" <riku.voipio@iki.fi>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Claudio Fontana" <cfontana@suse.de>,
"Yanan Wang" <wangyanan55@huawei.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Alessandro Di Federico" <ale@rev.ng>,
"Fabiano Rosas" <farosas@suse.de>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Daniel Henrique Barboza" <danielhb413@gmail.com>,
"Mahmoud Mandour" <ma.mandourr@gmail.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Alexandre Iooss" <erdnaxe@crans.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Alex Bennée" <alex.bennee@linaro.org>
Subject: [PATCH 2/3] accel: Introduce cpu_exec_reset_hold()
Date: Mon, 18 Sep 2023 12:41:51 +0200 [thread overview]
Message-ID: <20230918104153.24433-3-philmd@linaro.org> (raw)
In-Reply-To: <20230918104153.24433-1-philmd@linaro.org>
Introduce cpu_exec_reset_hold() which call an accelerator
specific AccelOpsClass::cpu_reset_hold() handler.
Define a stub on TCG user emulation, because CPU reset is
irrelevant there.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/core/cpu.h | 1 +
include/sysemu/accel-ops.h | 1 +
accel/tcg/user-exec-stub.c | 4 ++++
hw/core/cpu-common.c | 1 +
softmmu/cpus.c | 7 +++++++
5 files changed, 14 insertions(+)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 92a4234439..7bbfa81dcd 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -1011,6 +1011,7 @@ void cpu_class_init_props(DeviceClass *dc);
void cpu_exec_initfn(CPUState *cpu);
void cpu_exec_realizefn(CPUState *cpu, Error **errp);
void cpu_exec_unrealizefn(CPUState *cpu);
+void cpu_exec_reset_hold(CPUState *cpu);
/**
* target_words_bigendian:
diff --git a/include/sysemu/accel-ops.h b/include/sysemu/accel-ops.h
index 3c1fab4b1e..ef91fc28bb 100644
--- a/include/sysemu/accel-ops.h
+++ b/include/sysemu/accel-ops.h
@@ -30,6 +30,7 @@ struct AccelOpsClass {
void (*ops_init)(AccelOpsClass *ops);
bool (*cpus_are_resettable)(void);
+ void (*cpu_reset_hold)(CPUState *cpu);
void (*create_vcpu_thread)(CPUState *cpu); /* MANDATORY NON-NULL */
void (*kick_vcpu_thread)(CPUState *cpu);
diff --git a/accel/tcg/user-exec-stub.c b/accel/tcg/user-exec-stub.c
index 874e1f1a20..b1bf8bed89 100644
--- a/accel/tcg/user-exec-stub.c
+++ b/accel/tcg/user-exec-stub.c
@@ -16,6 +16,10 @@ void qemu_init_vcpu(CPUState *cpu)
{
}
+void cpu_exec_reset_hold(CPUState *cpu)
+{
+}
+
/* User mode emulation does not support record/replay yet. */
bool replay_exception(void)
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
index b3b5ce6702..b50bc22fb7 100644
--- a/hw/core/cpu-common.c
+++ b/hw/core/cpu-common.c
@@ -137,6 +137,7 @@ static void cpu_common_reset_hold(Object *obj)
cpu->crash_occurred = false;
cpu->cflags_next_tb = -1;
+ cpu_exec_reset_hold(cpu);
if (tcg_enabled()) {
tcg_flush_jmp_cache(cpu);
tcg_flush_softmmu_tlb(cpu);
diff --git a/softmmu/cpus.c b/softmmu/cpus.c
index 0848e0dbdb..952f15868c 100644
--- a/softmmu/cpus.c
+++ b/softmmu/cpus.c
@@ -201,6 +201,13 @@ bool cpus_are_resettable(void)
return true;
}
+void cpu_exec_reset_hold(CPUState *cpu)
+{
+ if (cpus_accel->cpu_reset_hold) {
+ cpus_accel->cpu_reset_hold(cpu);
+ }
+}
+
int64_t cpus_get_virtual_clock(void)
{
/*
--
2.41.0
next prev parent reply other threads:[~2023-09-18 10:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-18 10:41 [PATCH 0/3] accel: Factor tcg_cpu_reset_hold() out of cpu-common.c Philippe Mathieu-Daudé
2023-09-18 10:41 ` [PATCH 1/3] accel/tcg: Declare tcg_flush_jmp_cache() in 'exec/tb-flush.h' Philippe Mathieu-Daudé
2023-09-18 10:41 ` Philippe Mathieu-Daudé [this message]
2023-09-18 10:41 ` [PATCH 3/3] accel/tcg: Factor tcg_cpu_reset_hold() out Philippe Mathieu-Daudé
2023-09-18 11:42 ` [PATCH 0/3] accel: Factor tcg_cpu_reset_hold() out of cpu-common.c Anton Johansson via
2023-09-19 14:47 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230918104153.24433-3-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=ale@rev.ng \
--cc=alex.bennee@linaro.org \
--cc=anjo@rev.ng \
--cc=cfontana@suse.de \
--cc=danielhb413@gmail.com \
--cc=eduardo@habkost.net \
--cc=erdnaxe@crans.org \
--cc=farosas@suse.de \
--cc=ma.mandourr@gmail.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=riku.voipio@iki.fi \
--cc=wangyanan55@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).