diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2014-09-26 17:45:31 -0300 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-10-09 15:36:14 +0200 |
commit | ac2da55e01b1a84e6bba32768211201dec230232 (patch) | |
tree | 107c32c8d8667a3577146d7f151040f58dac6556 /accel.c | |
parent | f6a1ef64408a5f7f52601589fef2a850b93d817e (diff) | |
download | qemu-ac2da55e01b1a84e6bba32768211201dec230232.zip qemu-ac2da55e01b1a84e6bba32768211201dec230232.tar.gz qemu-ac2da55e01b1a84e6bba32768211201dec230232.tar.bz2 |
accel: Create accel object when initializing machine
Create an actual TYPE_ACCEL object when initializing a machine. This
will allow accelerator classes to implement some initialization on
instance_init, and to save state on the TYPE_ACCEL object.
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'accel.c')
-rw-r--r-- | accel.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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; } |