[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 22/28] accel: Create accel object when initializing m
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 22/28] accel: Create accel object when initializing machine |
Date: |
Thu, 9 Oct 2014 12:17:29 +0200 |
From: Eduardo Habkost <address@hidden>
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 <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
accel.c | 7 +++++++
include/hw/boards.h | 1 +
include/qemu/typedefs.h | 2 ++
3 files changed, 10 insertions(+)
diff --git a/accel.c b/accel.c
index 6087ab3..74e41da 100644
--- a/accel.c
+++ b/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;
@@ -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;
}
diff --git a/include/hw/boards.h b/include/hw/boards.h
index dfb6718..8f0eeaf 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -133,6 +133,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.8.3.1
- [Qemu-devel] [PULL 01/28] qemu-char: Make the filename size for a chardev a #define, (continued)
- [Qemu-devel] [PULL 01/28] qemu-char: Make the filename size for a chardev a #define, Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 02/28] qemu-char: Rework qemu_chr_open_socket() for reconnect, Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 03/28] qemu-char: Move some items into TCPCharDriver, Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 04/28] qemu-char: set socket filename to disconnected when not connected, Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 05/28] qemu-char: Add reconnecting to client sockets, Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 06/28] qemu-char: Print the remote and local addresses for a socket, Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 17/28] accel: Move qtest accel registration to qtest.c, Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 18/28] accel: Remove tcg_available() function, Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 19/28] accel: Move accel init/allowed code to separate function, Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 20/28] accel: Rename 'init' method to 'init_machine', Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 22/28] accel: Create accel object when initializing machine,
Paolo Bonzini <=
- [Qemu-devel] [PULL 21/28] accel: Pass MachineState object to accel init functions, Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 26/28] qemu-error: Add error_vreport(), Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 27/28] qemu-sockets: Add error to non-blocking connect handler, Paolo Bonzini, 2014/10/09
- [Qemu-devel] [PULL 23/28] kvm: Make KVMState be the TYPE_KVM_ACCEL instance struct, Paolo Bonzini, 2014/10/09
- Re: [Qemu-devel] [PULL 23/28] kvm: Make KVMState be the TYPE_KVM_ACCEL instance struct, Gonglei, 2014/10/10
[Qemu-devel] [PULL 28/28] qemu-char: Fix reconnect socket error reporting, Paolo Bonzini, 2014/10/09