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.
Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> --- hw/core/accel.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/core/accel.c b/hw/core/accel.c index 98fcf0d..66ee1fa 100644 --- a/hw/core/accel.c +++ b/hw/core/accel.c @@ -60,11 +60,15 @@ 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; *(acc->allowed) = true; ret = acc->init_machine(ms); if (ret < 0) { *(acc->allowed) = false; + object_unref(OBJECT(accel)); } return ret; } -- 1.9.3