@@ -86,15 +86,21 @@ static void cpu_cluster_realize(DeviceState *dev, Error **errp)
if (cc->tcg_clu_ops->collect_cpus) {
cc->tcg_clu_ops->collect_cpus(cluster, errp);
}
+
+ cc->parent_realize(dev, errp);
}
static void cpu_cluster_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
+ CPUTopoClass *tc = CPU_TOPO_CLASS(klass);
CPUClusterClass *cc = CPU_CLUSTER_CLASS(klass);
+ set_bit(DEVICE_CATEGORY_CPU_DEF, dc->categories);
device_class_set_props(dc, cpu_cluster_properties);
- dc->realize = cpu_cluster_realize;
+ device_class_set_parent_realize(dc, cpu_cluster_realize,
+ &cc->parent_realize);
+ tc->level = CPU_TOPO_CLUSTER;
#ifdef CONFIG_TCG
cc->tcg_clu_ops = &common_cluster_tcg_ops;
@@ -103,8 +109,9 @@ static void cpu_cluster_class_init(ObjectClass *klass, void *data)
static const TypeInfo cpu_cluster_type_info = {
.name = TYPE_CPU_CLUSTER,
- .parent = TYPE_DEVICE,
+ .parent = TYPE_CPU_TOPO,
.instance_size = sizeof(CPUCluster),
+ .class_size = sizeof(CPUClusterClass),
.class_init = cpu_cluster_class_init,
};
@@ -20,6 +20,7 @@
#ifndef HW_CPU_CLUSTER_H
#define HW_CPU_CLUSTER_H
+#include "hw/core/cpu-topo.h"
#include "hw/qdev-core.h"
#include "qom/object.h"
@@ -84,11 +85,13 @@ struct TCGClusterOps {
struct CPUClusterClass {
/*< private >*/
- DeviceClass parent_class;
+ CPUTopoClass parent_class;
/*< public >*/
/* when TCG is not available, this pointer is NULL */
const struct TCGClusterOps *tcg_clu_ops;
+
+ DeviceRealize parent_realize;
};
/**
@@ -100,7 +103,7 @@ struct CPUClusterClass {
*/
struct CPUCluster {
/*< private >*/
- DeviceState parent_obj;
+ CPUTopoState parent_obj;
/*< public >*/
uint32_t cluster_id;