From: Jason Andryuk <jandryuk@gmail.com>
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <lvivier@redhat.com>,
Thomas Huth <thuth@redhat.com>,
Jason Andryuk <jandryuk@gmail.com>,
Claudio Fontana <cfontana@suse.de>,
Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@twiddle.net>
Subject: [PATCH v2 2/3] accel: move qtest CpusAccel functions to a common location
Date: Tue, 13 Oct 2020 10:05:10 -0400 [thread overview]
Message-ID: <20201013140511.5681-3-jandryuk@gmail.com> (raw)
In-Reply-To: <20201013140511.5681-1-jandryuk@gmail.com>
Move and rename accel/qtest/qtest-cpus.c files to accel/dummy-cpus.c so
it can be re-used by Xen.
Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
---
v2:
- Use accel/dummy-cpus.c
- Put prototype in include/sysemu/cpus.h
---
accel/{qtest/qtest-cpus.c => dummy-cpus.c} | 22 ++++------------------
accel/meson.build | 7 +++++++
accel/qtest/meson.build | 1 -
accel/qtest/qtest-cpus.h | 17 -----------------
accel/qtest/qtest.c | 5 ++++-
include/sysemu/cpus.h | 3 +++
6 files changed, 18 insertions(+), 37 deletions(-)
rename accel/{qtest/qtest-cpus.c => dummy-cpus.c} (75%)
delete mode 100644 accel/qtest/qtest-cpus.h
diff --git a/accel/qtest/qtest-cpus.c b/accel/dummy-cpus.c
similarity index 75%
rename from accel/qtest/qtest-cpus.c
rename to accel/dummy-cpus.c
index db094201c1..10429fdfb2 100644
--- a/accel/qtest/qtest-cpus.c
+++ b/accel/dummy-cpus.c
@@ -1,5 +1,5 @@
/*
- * QTest accelerator code
+ * Dummy cpu thread code
*
* Copyright IBM, Corp. 2011
*
@@ -13,21 +13,12 @@
#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"
-
-static void *qtest_cpu_thread_fn(void *arg)
+static void *dummy_cpu_thread_fn(void *arg)
{
CPUState *cpu = arg;
sigset_t waitset;
@@ -67,7 +58,7 @@ static void *qtest_cpu_thread_fn(void *arg)
return NULL;
}
-static void qtest_start_vcpu_thread(CPUState *cpu)
+void dummy_start_vcpu_thread(CPUState *cpu)
{
char thread_name[VCPU_THREAD_NAME_SIZE];
@@ -76,11 +67,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/meson.build b/accel/meson.build
index bb00d0fd13..9a417396bd 100644
--- a/accel/meson.build
+++ b/accel/meson.build
@@ -5,3 +5,10 @@ subdir('kvm')
subdir('tcg')
subdir('xen')
subdir('stubs')
+
+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/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-cpus.h b/accel/qtest/qtest-cpus.h
deleted file mode 100644
index 739519a472..0000000000
--- a/accel/qtest/qtest-cpus.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Accelerator CPUS Interface
- *
- * Copyright 2020 SUSE LLC
- *
- * This work is licensed under the terms of the GNU GPL, version 2 or later.
- * See the COPYING file in the top-level directory.
- */
-
-#ifndef QTEST_CPUS_H
-#define QTEST_CPUS_H
-
-#include "sysemu/cpus.h"
-
-extern const CpusAccel qtest_cpus;
-
-#endif /* QTEST_CPUS_H */
diff --git a/accel/qtest/qtest.c b/accel/qtest/qtest.c
index 537e8b449c..b282cea5cf 100644
--- a/accel/qtest/qtest.c
+++ b/accel/qtest/qtest.c
@@ -25,7 +25,10 @@
#include "qemu/main-loop.h"
#include "hw/core/cpu.h"
-#include "qtest-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)
{
diff --git a/include/sysemu/cpus.h b/include/sysemu/cpus.h
index 231685955d..e8156728c6 100644
--- a/include/sysemu/cpus.h
+++ b/include/sysemu/cpus.h
@@ -25,6 +25,9 @@ typedef struct CpusAccel {
/* register accel-specific cpus interface implementation */
void cpus_register_accel(const CpusAccel *i);
+/* Create a dummy vcpu for CpusAccel->create_vcpu_thread */
+void dummy_start_vcpu_thread(CPUState *);
+
/* interface available for cpus accelerator threads */
/* For temporary buffers for forming a name */
--
2.25.1
next prev parent reply other threads:[~2020-10-13 14:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-13 14:05 [PATCH v2 0/3] Add Xen CpusAccel Jason Andryuk
2020-10-13 14:05 ` [PATCH v2 1/3] accel: Remove _WIN32 ifdef from qtest-cpus.c Jason Andryuk
2020-10-13 14:06 ` Claudio Fontana
2020-10-23 7:05 ` Thomas Huth
2020-10-23 8:04 ` Philippe Mathieu-Daudé
2020-10-13 14:05 ` Jason Andryuk [this message]
2020-10-13 14:12 ` [PATCH v2 2/3] accel: move qtest CpusAccel functions to a common location Claudio Fontana
2020-10-23 7:07 ` Thomas Huth
2020-10-13 14:05 ` [PATCH v2 3/3] accel: Add xen CpusAccel using dummy-cpus Jason Andryuk
2020-10-13 14:12 ` Claudio Fontana
2020-10-16 15:05 ` Anthony PERARD via
2020-10-13 17:16 ` [PATCH v2 0/3] Add Xen CpusAccel Paolo Bonzini
2020-10-22 15:17 ` Jason Andryuk
2020-10-22 15:29 ` Paolo Bonzini
2020-10-23 7:09 ` Thomas Huth
2020-10-23 9:34 ` Paolo Bonzini
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=20201013140511.5681-3-jandryuk@gmail.com \
--to=jandryuk@gmail.com \
--cc=cfontana@suse.de \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--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).