[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 09/41] hw/core/topo: Support topology index for topology device, (continued)
- [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 11/41] hw/core/topo: Add virtual method to check topology child, Zhao Liu, 2023/11/30
- [RFC 12/41] hw/core/topo: Add helpers to traverse the CPU topology tree, Zhao Liu, 2023/11/30
- [RFC 13/41] hw/core/cpu: Convert CPU from general device to topology device, Zhao Liu, 2023/11/30
- [RFC 14/41] PPC/ppc-core: Offload core-id to PPC specific core abstarction, Zhao Liu, 2023/11/30
- [RFC 15/41] hw/cpu/core: Allow to configure plugged threads for cpu-core, 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 17/41] hw/cpu/core: Convert cpu-core from general device to topology device, Zhao Liu, 2023/11/30
- [RFC 18/41] hw/cpu/cluster: Rename CPUClusterState to CPUCluster, Zhao Liu, 2023/11/30
- [RFC 22/41] hw/cpu/cluster: Convert cpu-cluster from general device to topology device,
Zhao Liu <=
- [RFC 19/41] hw/cpu/cluster: Wrap TCG related ops and props into CONFIG_TCG, 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 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 24/41] hw/cpu/socket: Abstract cpu-socket 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 26/41] hw/cpu/drawer: Abstract cpu-drawer level as topology device, Zhao Liu, 2023/11/30
- [RFC 27/41] hw/core/slot: Introduce CPU slot as the root of CPU topology, Zhao Liu, 2023/11/30
- [RFC 28/41] hw/core/slot: Maintain the core queue in CPU slot, Zhao Liu, 2023/11/30
- [RFC 29/41] hw/core/slot: Statistics topology information in CPU slot, Zhao Liu, 2023/11/30