qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v2 15/17] accel: Create accel object when initializi


From: Eduardo Habkost
Subject: [Qemu-devel] [PATCH v2 15/17] accel: Create accel object when initializing machine
Date: Fri, 29 Aug 2014 17:31:48 -0300

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 <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]