aboutsummaryrefslogtreecommitdiff
path: root/accel.c
diff options
context:
space:
mode:
Diffstat (limited to 'accel.c')
-rw-r--r--accel.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/accel.c b/accel.c
index 6087ab3..74e41da 100644
--- a/accel.c
+++ b/accel.c
@@ -32,6 +32,7 @@
#include "sysemu/qtest.h"
#include "hw/xen/xen.h"
#include "qom/object.h"
+#include "hw/boards.h"
int tcg_tb_size;
static bool tcg_allowed = true;
@@ -60,11 +61,17 @@ static AccelClass *accel_find(const char *opt_name)
static int accel_init_machine(AccelClass *acc, MachineState *ms)
{
+ ObjectClass *oc = OBJECT_CLASS(acc);
+ const char *cname = object_class_get_name(oc);
+ AccelState *accel = ACCEL(object_new(cname));
int ret;
+ ms->accelerator = accel;
*(acc->allowed) = true;
ret = acc->init_machine(ms);
if (ret < 0) {
+ ms->accelerator = NULL;
*(acc->allowed) = false;
+ object_unref(OBJECT(accel));
}
return ret;
}