[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC 22/41] hw/cpu/cluster: Convert cpu-cluster from general device to t
From: |
Zhao Liu |
Subject: |
[RFC 22/41] hw/cpu/cluster: Convert cpu-cluster from general device to topology device |
Date: |
Thu, 30 Nov 2023 22:41:44 +0800 |
From: Zhao Liu <zhao1.liu@intel.com>
Convert cpu-cluster to topology device then user could create cluster
level topology from cli and later the cpu-clusters could be added into
topology tree.
In addition, mark the cpu-cluster as DEVICE_CATEGORY_CPU_DEF category to
indicate it belongs to the basic CPU definition and should be created
from cli before board initialization.
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
hw/cpu/cluster.c | 11 +++++++++--
include/hw/cpu/cluster.h | 7 +++++--
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/hw/cpu/cluster.c b/hw/cpu/cluster.c
index 8a666c27d151..adf0ef23e8d4 100644
--- a/hw/cpu/cluster.c
+++ b/hw/cpu/cluster.c
@@ -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,
};
diff --git a/include/hw/cpu/cluster.h b/include/hw/cpu/cluster.h
index b3185e2f2566..888993c36da4 100644
--- a/include/hw/cpu/cluster.h
+++ b/include/hw/cpu/cluster.h
@@ -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;
--
2.34.1
- [RFC 19/41] hw/cpu/cluster: Wrap TCG related ops and props into CONFIG_TCG, (continued)
- [RFC 19/41] hw/cpu/cluster: Wrap TCG related ops and props into CONFIG_TCG, Zhao Liu, 2023/11/30
- [RFC 20/41] hw/cpu/cluster: Descript cluster is not only used for TCG in comment, Zhao Liu, 2023/11/30
- [RFC 23/41] hw/cpu/die: Abstract cpu-die level as topology device, Zhao Liu, 2023/11/30
- [RFC 25/41] hw/cpu/book: Abstract cpu-book level as topology device, Zhao Liu, 2023/11/30
- [RFC 34/41] hw/core/topo: Implement user-child to collect topology device from cli, Zhao Liu, 2023/11/30
- [RFC 35/41] hw/i386: Make x86_cpu_new() private in x86.c, Zhao Liu, 2023/11/30
- [RFC 37/41] hw/i386: Allow i386 to create new CPUs from QOM topology, Zhao Liu, 2023/11/30
- [RFC 38/41] hw/i386: Wrap apic id and topology sub ids assigning as helpers, Zhao Liu, 2023/11/30
- [RFC 01/41] qdev: Introduce new device category to cover basic topology device, Zhao Liu, 2023/11/30
- [RFC 21/41] hw/cpu/cluster: Allow cpu-cluster to be created by -device, Zhao Liu, 2023/11/30
- [RFC 22/41] hw/cpu/cluster: Convert cpu-cluster from general device to topology device,
Zhao Liu <=
- [RFC 27/41] hw/core/slot: Introduce CPU slot as the root of CPU topology, Zhao Liu, 2023/11/30
- [RFC 07/41] qdev: Introduce parent option in -device, Zhao Liu, 2023/11/30
- [RFC 30/41] hw/core/slot: Check topology child to be added under CPU slot, Zhao Liu, 2023/11/30
- [RFC 04/41] qom/object: Introduce helper to resolve path from non-direct parent, Zhao Liu, 2023/11/30
- [RFC 06/41] qdev: Introduce user-child interface to collect devices from -device, Zhao Liu, 2023/11/30
- [RFC 09/41] hw/core/topo: Support topology index for topology device, Zhao Liu, 2023/11/30
- [RFC 10/41] hw/core/topo: Add virtual method to update topology info for parent, Zhao Liu, 2023/11/30
- [RFC 16/41] PPC/ppc-core: Limit plugged-threads and nr-threads to be equal, Zhao Liu, 2023/11/30
- [RFC 24/41] hw/cpu/socket: Abstract cpu-socket level as topology device, Zhao Liu, 2023/11/30
- [RFC 26/41] hw/cpu/drawer: Abstract cpu-drawer level as topology device, Zhao Liu, 2023/11/30