From: Jason Andryuk <jandryuk@gmail.com>
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <lvivier@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Thomas Huth <thuth@redhat.com>,
Jason Andryuk <jandryuk@gmail.com>
Subject: [PATCH 1/2] accel: move qtest CpusAccel functions to a common location
Date: Mon, 12 Oct 2020 16:07:23 -0400 [thread overview]
Message-ID: <20201012200725.64137-2-jandryuk@gmail.com> (raw)
In-Reply-To: <20201012200725.64137-1-jandryuk@gmail.com>
Move and rename accel/qtest/qtest-cpu.* files to accel/dummy/ so they
can be re-used by Xen.
Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
---
.../qtest-cpus.c => dummy/dummy-cpus.c} | 22 +++++--------------
.../qtest-cpus.h => dummy/dummy-cpus.h} | 10 ++++-----
accel/dummy/meson.build | 6 +++++
accel/meson.build | 1 +
accel/qtest/meson.build | 1 -
accel/qtest/qtest.c | 7 +++++-
6 files changed, 23 insertions(+), 24 deletions(-)
rename accel/{qtest/qtest-cpus.c => dummy/dummy-cpus.c} (76%)
rename accel/{qtest/qtest-cpus.h => dummy/dummy-cpus.h} (59%)
create mode 100644 accel/dummy/meson.build
diff --git a/accel/qtest/qtest-cpus.c b/accel/dummy/dummy-cpus.c
similarity index 76%
rename from accel/qtest/qtest-cpus.c
rename to accel/dummy/dummy-cpus.c
index 7c5399ed9d..efade99f03 100644
--- a/accel/qtest/qtest-cpus.c
+++ b/accel/dummy/dummy-cpus.c
@@ -1,5 +1,5 @@
/*
- * QTest accelerator code
+ * Dummy cpu thread code
*
* Copyright IBM, Corp. 2011
*
@@ -13,21 +13,14 @@
#include "qemu/osdep.h"
#include "qemu/rcu.h"
-#include "qapi/error.h"
-#include "qemu/module.h"
-#include "qemu/option.h"
-#include "qemu/config-file.h"
-#include "sysemu/accel.h"
-#include "sysemu/qtest.h"
#include "sysemu/cpus.h"
-#include "sysemu/cpu-timers.h"
#include "qemu/guest-random.h"
#include "qemu/main-loop.h"
#include "hw/core/cpu.h"
-#include "qtest-cpus.h"
+#include "dummy-cpus.h"
-static void *qtest_cpu_thread_fn(void *arg)
+static void *dummy_cpu_thread_fn(void *arg)
{
#ifdef _WIN32
error_report("qtest is not supported under Windows");
@@ -72,7 +65,7 @@ static void *qtest_cpu_thread_fn(void *arg)
#endif
}
-static void qtest_start_vcpu_thread(CPUState *cpu)
+void dummy_start_vcpu_thread(CPUState *cpu)
{
char thread_name[VCPU_THREAD_NAME_SIZE];
@@ -81,11 +74,6 @@ static void qtest_start_vcpu_thread(CPUState *cpu)
qemu_cond_init(cpu->halt_cond);
snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/DUMMY",
cpu->cpu_index);
- qemu_thread_create(cpu->thread, thread_name, qtest_cpu_thread_fn, cpu,
+ qemu_thread_create(cpu->thread, thread_name, dummy_cpu_thread_fn, cpu,
QEMU_THREAD_JOINABLE);
}
-
-const CpusAccel qtest_cpus = {
- .create_vcpu_thread = qtest_start_vcpu_thread,
- .get_virtual_clock = qtest_get_virtual_clock,
-};
diff --git a/accel/qtest/qtest-cpus.h b/accel/dummy/dummy-cpus.h
similarity index 59%
rename from accel/qtest/qtest-cpus.h
rename to accel/dummy/dummy-cpus.h
index 739519a472..a7a0469b17 100644
--- a/accel/qtest/qtest-cpus.h
+++ b/accel/dummy/dummy-cpus.h
@@ -7,11 +7,11 @@
* See the COPYING file in the top-level directory.
*/
-#ifndef QTEST_CPUS_H
-#define QTEST_CPUS_H
+#ifndef DUMMY_CPUS_H
+#define DUMMY_CPUS_H
-#include "sysemu/cpus.h"
+#include "qemu/typedefs.h"
-extern const CpusAccel qtest_cpus;
+void dummy_start_vcpu_thread(CPUState *);
-#endif /* QTEST_CPUS_H */
+#endif /* DUMMY_CPUS_H */
diff --git a/accel/dummy/meson.build b/accel/dummy/meson.build
new file mode 100644
index 0000000000..5fbe27de90
--- /dev/null
+++ b/accel/dummy/meson.build
@@ -0,0 +1,6 @@
+dummy_ss = ss.source_set()
+dummy_ss.add(files(
+ 'dummy-cpus.c',
+))
+
+specific_ss.add_all(when: ['CONFIG_SOFTMMU', 'CONFIG_POSIX'], if_true: dummy_ss)
diff --git a/accel/meson.build b/accel/meson.build
index bb00d0fd13..d45a33fb8e 100644
--- a/accel/meson.build
+++ b/accel/meson.build
@@ -1,5 +1,6 @@
softmmu_ss.add(files('accel.c'))
+subdir('dummy')
subdir('qtest')
subdir('kvm')
subdir('tcg')
diff --git a/accel/qtest/meson.build b/accel/qtest/meson.build
index e477cb2ae2..a2f3276459 100644
--- a/accel/qtest/meson.build
+++ b/accel/qtest/meson.build
@@ -1,7 +1,6 @@
qtest_ss = ss.source_set()
qtest_ss.add(files(
'qtest.c',
- 'qtest-cpus.c',
))
specific_ss.add_all(when: ['CONFIG_SOFTMMU', 'CONFIG_POSIX'], if_true: qtest_ss)
diff --git a/accel/qtest/qtest.c b/accel/qtest/qtest.c
index 537e8b449c..ac54bc8f52 100644
--- a/accel/qtest/qtest.c
+++ b/accel/qtest/qtest.c
@@ -25,7 +25,12 @@
#include "qemu/main-loop.h"
#include "hw/core/cpu.h"
-#include "qtest-cpus.h"
+#include "accel/dummy/dummy-cpus.h"
+
+const CpusAccel qtest_cpus = {
+ .create_vcpu_thread = dummy_start_vcpu_thread,
+ .get_virtual_clock = qtest_get_virtual_clock,
+};
static int qtest_init_accel(MachineState *ms)
{
--
2.25.1
next prev parent reply other threads:[~2020-10-12 20:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-12 20:07 [PATCH 0/2] Add Xen CpusAccel Jason Andryuk
2020-10-12 20:07 ` Jason Andryuk [this message]
2020-10-12 20:23 ` [PATCH 1/2] accel: move qtest CpusAccel functions to a common location Claudio Fontana
2020-10-12 20:30 ` Paolo Bonzini
2020-10-12 20:38 ` Jason Andryuk
2020-10-12 20:40 ` Jason Andryuk
2020-10-12 20:44 ` Paolo Bonzini
2020-10-12 20:07 ` [PATCH 2/2] accel: Add xen CpusAccel using dummy-cpu Jason Andryuk
2020-10-12 20:25 ` Claudio Fontana
2020-10-12 20:16 ` [PATCH 0/2] Add Xen CpusAccel Claudio Fontana
2020-10-13 8:42 ` Philippe Mathieu-Daudé
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=20201012200725.64137-2-jandryuk@gmail.com \
--to=jandryuk@gmail.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.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).