提交 961f8395 编写于 作者: E Eduardo Habkost 提交者: Andreas Färber

cpu: Change parent type to Device

This finally makes the CPU class a subclass of the Device class,
allowing us to start using DeviceState properties on CPU subclasses.

It has no_user=1, as creating CPUs using -device doesn't work yet.
Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
Signed-off-by: NAndreas Färber <afaerber@suse.de>
上级 5d5b24d0
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#ifndef QEMU_CPU_H #ifndef QEMU_CPU_H
#define QEMU_CPU_H #define QEMU_CPU_H
#include "qom/object.h" #include "hw/qdev-core.h"
#include "qemu/thread.h" #include "qemu/thread.h"
/** /**
...@@ -46,7 +46,7 @@ typedef struct CPUState CPUState; ...@@ -46,7 +46,7 @@ typedef struct CPUState CPUState;
*/ */
typedef struct CPUClass { typedef struct CPUClass {
/*< private >*/ /*< private >*/
ObjectClass parent_class; DeviceClass parent_class;
/*< public >*/ /*< public >*/
void (*reset)(CPUState *cpu); void (*reset)(CPUState *cpu);
...@@ -66,7 +66,7 @@ struct kvm_run; ...@@ -66,7 +66,7 @@ struct kvm_run;
*/ */
struct CPUState { struct CPUState {
/*< private >*/ /*< private >*/
Object parent_obj; DeviceState parent_obj;
/*< public >*/ /*< public >*/
struct QemuThread *thread; struct QemuThread *thread;
......
...@@ -36,14 +36,16 @@ static void cpu_common_reset(CPUState *cpu) ...@@ -36,14 +36,16 @@ static void cpu_common_reset(CPUState *cpu)
static void cpu_class_init(ObjectClass *klass, void *data) static void cpu_class_init(ObjectClass *klass, void *data)
{ {
DeviceClass *dc = DEVICE_CLASS(klass);
CPUClass *k = CPU_CLASS(klass); CPUClass *k = CPU_CLASS(klass);
k->reset = cpu_common_reset; k->reset = cpu_common_reset;
dc->no_user = 1;
} }
static TypeInfo cpu_type_info = { static const TypeInfo cpu_type_info = {
.name = TYPE_CPU, .name = TYPE_CPU,
.parent = TYPE_OBJECT, .parent = TYPE_DEVICE,
.instance_size = sizeof(CPUState), .instance_size = sizeof(CPUState),
.abstract = true, .abstract = true,
.class_size = sizeof(CPUClass), .class_size = sizeof(CPUClass),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册