Browse Source

qtest: Move accel code to accel/qtest.c

QTest has two parts: the server (-qtest) and the accelerator
(-machine accel=qtest).  The accelerator depends on CONFIG_POSIX
due to its usage of sigwait(), but the server doesn't.

Move the accel code to accel/qtest.c.  Later we will disable
compilation of accel/qtest.c on non-POSIX systems.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <2019042221.2488-2-ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
[thuth: added fixup for MAINTAINERS file]
Signed-off-by: Thomas Huth <thuth@redhat.com>
master
Eduardo Habkost 1 month ago
parent
commit
3fe13fe16e
4 changed files with 57 additions and 34 deletions
  1. 1
    0
      MAINTAINERS
  2. 1
    0
      accel/Makefile.objs
  3. 55
    0
      accel/qtest.c
  4. 0
    34
      qtest.c

+ 1
- 0
MAINTAINERS View File

@@ -2035,6 +2035,7 @@ M: Laurent Vivier <lvivier@redhat.com>
2035 2035
 R: Paolo Bonzini <pbonzini@redhat.com>
2036 2036
 S: Maintained
2037 2037
 F: qtest.c
2038
+F: accel/qtest.c
2038 2039
 F: tests/libqtest.*
2039 2040
 F: tests/libqos/
2040 2041
 F: tests/*-test.c

+ 1
- 0
accel/Makefile.objs View File

@@ -1,4 +1,5 @@
1 1
 obj-$(CONFIG_SOFTMMU) += accel.o
2
+obj-$(CONFIG_SOFTMMU) += qtest.o
2 3
 obj-$(CONFIG_KVM) += kvm/
3 4
 obj-$(CONFIG_TCG) += tcg/
4 5
 obj-y += stubs/

+ 55
- 0
accel/qtest.c View File

@@ -0,0 +1,55 @@
1
+/*
2
+ * QTest accelerator code
3
+ *
4
+ * Copyright IBM, Corp. 2011
5
+ *
6
+ * Authors:
7
+ *  Anthony Liguori   <aliguori@us.ibm.com>
8
+ *
9
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
10
+ * See the COPYING file in the top-level directory.
11
+ *
12
+ */
13
+
14
+#include "qemu/osdep.h"
15
+#include "qapi/error.h"
16
+#include "qemu/module.h"
17
+#include "qemu/option.h"
18
+#include "qemu/config-file.h"
19
+#include "sysemu/accel.h"
20
+#include "sysemu/qtest.h"
21
+#include "sysemu/cpus.h"
22
+
23
+static int qtest_init_accel(MachineState *ms)
24
+{
25
+    QemuOpts *opts = qemu_opts_create(qemu_find_opts("icount"), NULL, 0,
26
+                                      &error_abort);
27
+    qemu_opt_set(opts, "shift", "0", &error_abort);
28
+    configure_icount(opts, &error_abort);
29
+    qemu_opts_del(opts);
30
+    return 0;
31
+}
32
+
33
+static void qtest_accel_class_init(ObjectClass *oc, void *data)
34
+{
35
+    AccelClass *ac = ACCEL_CLASS(oc);
36
+    ac->name = "QTest";
37
+    ac->available = qtest_available;
38
+    ac->init_machine = qtest_init_accel;
39
+    ac->allowed = &qtest_allowed;
40
+}
41
+
42
+#define TYPE_QTEST_ACCEL ACCEL_CLASS_NAME("qtest")
43
+
44
+static const TypeInfo qtest_accel_type = {
45
+    .name = TYPE_QTEST_ACCEL,
46
+    .parent = TYPE_ACCEL,
47
+    .class_init = qtest_accel_class_init,
48
+};
49
+
50
+static void qtest_type_init(void)
51
+{
52
+    type_register_static(&qtest_accel_type);
53
+}
54
+
55
+type_init(qtest_type_init);

+ 0
- 34
qtest.c View File

@@ -749,16 +749,6 @@ static void qtest_event(void *opaque, int event)
749 749
     }
750 750
 }
751 751
 
752
-static int qtest_init_accel(MachineState *ms)
753
-{
754
-    QemuOpts *opts = qemu_opts_create(qemu_find_opts("icount"), NULL, 0,
755
-                                      &error_abort);
756
-    qemu_opt_set(opts, "shift", "0", &error_abort);
757
-    configure_icount(opts, &error_abort);
758
-    qemu_opts_del(opts);
759
-    return 0;
760
-}
761
-
762 752
 void qtest_init(const char *qtest_chrdev, const char *qtest_log, Error **errp)
763 753
 {
764 754
     Chardev *chr;
@@ -791,27 +781,3 @@ bool qtest_driver(void)
791 781
 {
792 782
     return qtest_chr.chr != NULL;
793 783
 }
794
-
795
-static void qtest_accel_class_init(ObjectClass *oc, void *data)
796
-{
797
-    AccelClass *ac = ACCEL_CLASS(oc);
798
-    ac->name = "QTest";
799
-    ac->available = qtest_available;
800
-    ac->init_machine = qtest_init_accel;
801
-    ac->allowed = &qtest_allowed;
802
-}
803
-
804
-#define TYPE_QTEST_ACCEL ACCEL_CLASS_NAME("qtest")
805
-
806
-static const TypeInfo qtest_accel_type = {
807
-    .name = TYPE_QTEST_ACCEL,
808
-    .parent = TYPE_ACCEL,
809
-    .class_init = qtest_accel_class_init,
810
-};
811
-
812
-static void qtest_type_init(void)
813
-{
814
-    type_register_static(&qtest_accel_type);
815
-}
816
-
817
-type_init(qtest_type_init);

Loading…
Cancel
Save