[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 16/17] accel: Save AccelState on MachineState whe
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PATCH v2 16/17] accel: Save AccelState on MachineState when initializing |
Date: |
Fri, 29 Aug 2014 17:31:49 -0300 |
This will allow machine initialization code to get the accelerator
object if necessary.
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 66ee1fa..2e1ea76 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
- [Qemu-devel] [PATCH v2 05/17] accel: Move accel name lookup to separate function, (continued)
- [Qemu-devel] [PATCH v2 05/17] accel: Move accel name lookup to separate function, Eduardo Habkost, 2014/08/29
- [Qemu-devel] [PATCH v2 08/17] accel: Move KVM accel registration to kvm-all.c, Eduardo Habkost, 2014/08/29
- [Qemu-devel] [PATCH v2 06/17] accel: Use QOM classes for accel types, Eduardo Habkost, 2014/08/29
- [Qemu-devel] [PATCH v2 09/17] accel: Move Xen registration code to xen-common.c, Eduardo Habkost, 2014/08/29
- [Qemu-devel] [PATCH v2 10/17] accel: Move qtest accel registration to qtest.c, Eduardo Habkost, 2014/08/29
- [Qemu-devel] [PATCH v2 11/17] accel: Remove tcg_available() function, Eduardo Habkost, 2014/08/29
- [Qemu-devel] [PATCH v2 12/17] accel: Move accel init/allowed code to separate function, Eduardo Habkost, 2014/08/29
- [Qemu-devel] [PATCH v2 13/17] accel: Rename 'init' method to 'init_machine', Eduardo Habkost, 2014/08/29
- [Qemu-devel] [PATCH v2 14/17] accel: Pass MachineState object to accel init functions, Eduardo Habkost, 2014/08/29
- [Qemu-devel] [PATCH v2 15/17] accel: Create accel object when initializing machine, Eduardo Habkost, 2014/08/29
- [Qemu-devel] [PATCH v2 16/17] accel: Save AccelState on MachineState when initializing,
Eduardo Habkost <=
- [Qemu-devel] [PATCH v2 17/17] kvm: Make KVMState be the TYPE_KVM_ACCEL instance struct, Eduardo Habkost, 2014/08/29