qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RFC 16/25] accel: Save AccelState on MachineState when ini


From: Eduardo Habkost
Subject: [Qemu-devel] [RFC 16/25] accel: Save AccelState on MachineState when initializing
Date: Wed, 9 Jul 2014 19:04:13 -0300

Signed-off-by: Eduardo Habkost <address@hidden>
---
 hw/core/accel.c         | 3 +++
 include/hw/boards.h     | 1 +
 include/qemu/typedefs.h | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/hw/core/accel.c b/hw/core/accel.c
index b86773d..268ecee 100644
--- a/hw/core/accel.c
+++ b/hw/core/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;
@@ -64,9 +65,11 @@ static int accel_init_machine(AccelClass *acc, MachineState 
*ms)
     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));
     }
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 605a970..1cff2b4 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -132,6 +132,7 @@ struct MachineState {
     char *kernel_cmdline;
     char *initrd_filename;
     const char *cpu_model;
+    AccelState *accelerator;
 };
 
 #endif
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index 04df51b..446af93 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -30,6 +30,8 @@ typedef struct MemoryListener MemoryListener;
 
 typedef struct MemoryMappingList MemoryMappingList;
 
+typedef struct AccelState AccelState;
+
 typedef struct QEMUMachine QEMUMachine;
 typedef struct MachineClass MachineClass;
 typedef struct MachineState MachineState;
-- 
1.9.3




reply via email to

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