summaryrefslogtreecommitdiff
path: root/accel/qtest/qtest.c
diff options
context:
space:
mode:
authorClaudio Fontana <cfontana@suse.de>2020-07-07 10:21:10 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2020-10-05 16:41:22 +0200
commit1583a389885346208217e8170395624b3aa90480 (patch)
tree693c50df1924e5b911781d3387856e084db8746a /accel/qtest/qtest.c
parenta77dabc33bcc36ec348854f23e89e0de22ca045b (diff)
cpus: extract out qtest-specific code to accel/qtest
register a "CpusAccel" interface for qtest as well. Signed-off-by: Claudio Fontana <cfontana@suse.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'accel/qtest/qtest.c')
-rw-r--r--accel/qtest/qtest.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/accel/qtest/qtest.c b/accel/qtest/qtest.c
new file mode 100644
index 0000000000..537e8b449c
--- /dev/null
+++ b/accel/qtest/qtest.c
@@ -0,0 +1,57 @@
+/*
+ * QTest accelerator code
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#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 int qtest_init_accel(MachineState *ms)
+{
+ cpus_register_accel(&qtest_cpus);
+ return 0;
+}
+
+static void qtest_accel_class_init(ObjectClass *oc, void *data)
+{
+ AccelClass *ac = ACCEL_CLASS(oc);
+ ac->name = "QTest";
+ ac->init_machine = qtest_init_accel;
+ ac->allowed = &qtest_allowed;
+}
+
+#define TYPE_QTEST_ACCEL ACCEL_CLASS_NAME("qtest")
+
+static const TypeInfo qtest_accel_type = {
+ .name = TYPE_QTEST_ACCEL,
+ .parent = TYPE_ACCEL,
+ .class_init = qtest_accel_class_init,
+};
+
+static void qtest_type_init(void)
+{
+ type_register_static(&qtest_accel_type);
+}
+
+type_init(qtest_type_init);