@@ -70,10 +70,37 @@ inline void init_apicid_topo_info(X86ApicidTopoInfo *apicid_topo,
{
MachineState *ms = MACHINE(x86ms);
+ /*
+ * At present, the packages and dies in the hybrid CPU topology are the
+ * same, so the numbers of dies in one package and the numbers of modules
+ * in the dies are also the same.
+ */
apicid_topo->max_dies = machine_topo_get_dies(ms);
apicid_topo->max_modules = machine_topo_get_clusters(ms);
- apicid_topo->max_cores = machine_topo_get_smp_cores(ms);
- apicid_topo->max_threads = machine_topo_get_smp_threads(ms);
+
+ if (machine_topo_is_smp(ms)) {
+ apicid_topo->max_cores = machine_topo_get_smp_cores(ms);
+ apicid_topo->max_threads = machine_topo_get_smp_threads(ms);
+ } else {
+ int max_cores = 0;
+ int max_threads = 0;
+ int nr_clusters = machine_topo_get_clusters(ms);
+ int nr_cores, nr_threads;
+
+ for (int i = 0; i < nr_clusters; i++) {
+ nr_cores = machine_topo_get_cores(ms, i);
+ max_cores = max_cores > nr_cores ? max_cores : nr_cores;
+
+ for (int j = 0; j < nr_cores; j++) {
+ nr_threads = machine_topo_get_threads(ms, i, j);
+ max_threads = max_threads > nr_threads ?
+ max_threads : nr_threads;
+ }
+ }
+
+ apicid_topo->max_cores = max_cores;
+ apicid_topo->max_threads = max_threads;
+ }
}
/*