xref: /openbmc/qemu/accel/qtest/qtest.c (revision b14df228)
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 "qemu/rcu.h"
16 #include "qapi/error.h"
17 #include "qemu/module.h"
18 #include "qemu/option.h"
19 #include "qemu/config-file.h"
20 #include "qemu/accel.h"
21 #include "sysemu/qtest.h"
22 #include "sysemu/cpus.h"
23 #include "qemu/guest-random.h"
24 #include "qemu/main-loop.h"
25 #include "hw/core/cpu.h"
26 
27 static int qtest_init_accel(MachineState *ms)
28 {
29     return 0;
30 }
31 
32 static void qtest_accel_class_init(ObjectClass *oc, void *data)
33 {
34     AccelClass *ac = ACCEL_CLASS(oc);
35     ac->name = "QTest";
36     ac->init_machine = qtest_init_accel;
37     ac->allowed = &qtest_allowed;
38 }
39 
40 #define TYPE_QTEST_ACCEL ACCEL_CLASS_NAME("qtest")
41 
42 static const TypeInfo qtest_accel_type = {
43     .name = TYPE_QTEST_ACCEL,
44     .parent = TYPE_ACCEL,
45     .class_init = qtest_accel_class_init,
46 };
47 module_obj(TYPE_QTEST_ACCEL);
48 
49 static void qtest_accel_ops_class_init(ObjectClass *oc, void *data)
50 {
51     AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
52 
53     ops->create_vcpu_thread = dummy_start_vcpu_thread;
54     ops->get_virtual_clock = qtest_get_virtual_clock;
55 };
56 
57 static const TypeInfo qtest_accel_ops_type = {
58     .name = ACCEL_OPS_NAME("qtest"),
59 
60     .parent = TYPE_ACCEL_OPS,
61     .class_init = qtest_accel_ops_class_init,
62     .abstract = true,
63 };
64 module_obj(ACCEL_OPS_NAME("qtest"));
65 
66 static void qtest_type_init(void)
67 {
68     type_register_static(&qtest_accel_type);
69     type_register_static(&qtest_accel_ops_type);
70 }
71 
72 type_init(qtest_type_init);
73