Skip to content

Commit

Permalink
cpu: Change parent type to Device
Browse files Browse the repository at this point in the history
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: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
  • Loading branch information
ehabkost authored and afaerber committed Jan 8, 2013
1 parent 5d5b24d commit 961f839
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions include/qom/cpu.h
Expand Up @@ -20,7 +20,7 @@
#ifndef QEMU_CPU_H
#define QEMU_CPU_H

#include "qom/object.h"
#include "hw/qdev-core.h"
#include "qemu/thread.h"

/**
Expand All @@ -46,7 +46,7 @@ typedef struct CPUState CPUState;
*/
typedef struct CPUClass {
/*< private >*/
ObjectClass parent_class;
DeviceClass parent_class;
/*< public >*/

void (*reset)(CPUState *cpu);
Expand All @@ -66,7 +66,7 @@ struct kvm_run;
*/
struct CPUState {
/*< private >*/
Object parent_obj;
DeviceState parent_obj;
/*< public >*/

struct QemuThread *thread;
Expand Down
6 changes: 4 additions & 2 deletions qom/cpu.c
Expand Up @@ -36,14 +36,16 @@ static void cpu_common_reset(CPUState *cpu)

static void cpu_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
CPUClass *k = CPU_CLASS(klass);

k->reset = cpu_common_reset;
dc->no_user = 1;
}

static TypeInfo cpu_type_info = {
static const TypeInfo cpu_type_info = {
.name = TYPE_CPU,
.parent = TYPE_OBJECT,
.parent = TYPE_DEVICE,
.instance_size = sizeof(CPUState),
.abstract = true,
.class_size = sizeof(CPUClass),
Expand Down

0 comments on commit 961f839

Please sign in to comment.