qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC 30/52] i386: Drop nr_dies and nr_modules CPUX86State


From: Zhao Liu
Subject: [RFC 30/52] i386: Drop nr_dies and nr_modules CPUX86State
Date: Mon, 13 Feb 2023 17:50:13 +0800

From: Zhao Liu <zhao1.liu@intel.com>

Since CPUState has the complete topology information, there's no need
to keep i386 architecture specific topology.

This avoids the fragmentation of topological information.

Co-Developed-by: Zhuocheng Ding <zhuocheng.ding@intel.com>
Signed-off-by: Zhuocheng Ding <zhuocheng.ding@intel.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 hw/i386/x86.c         | 4 ----
 target/i386/cpu.c     | 7 +++----
 target/i386/cpu.h     | 8 --------
 target/i386/kvm/kvm.c | 2 +-
 4 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index 91da2486d99e..52f7a19ceb7c 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -280,7 +280,6 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev,
     CPUArchId *cpu_slot;
     X86CPUTopoIDs topo_ids;
     X86CPU *cpu = X86_CPU(dev);
-    CPUX86State *env = &cpu->env;
     MachineState *ms = MACHINE(hotplug_dev);
     X86MachineState *x86ms = X86_MACHINE(hotplug_dev);
     X86CPUTopoInfo topo_info;
@@ -304,9 +303,6 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev,
 
     init_topo_info(&topo_info, x86ms);
 
-    env->nr_dies = machine_topo_get_dies(ms);
-    env->nr_modules = machine_topo_get_clusters(ms);
-
     /*
      * If APIC ID is not set,
      * set it based on socket/die/cluster/core/thread properties.
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index fcea4ea1a7e2..2188097c3ee1 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -5499,7 +5499,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, 
uint32_t count,
         break;
     case 0x1F:
         /* V2 Extended Topology Enumeration Leaf */
-        if (env->nr_dies < 2) {
+        if (cs->topo.dies_per_socket < 2) {
             *eax = *ebx = *ecx = *edx = 0;
             break;
         }
@@ -6227,6 +6227,7 @@ static void x86_cpu_enable_xsave_components(X86CPU *cpu)
 void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
 {
     CPUX86State *env = &cpu->env;
+    CPUState *cs = env_cpu(env);
     FeatureWord w;
     int i;
     GList *l;
@@ -6316,7 +6317,7 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
          * cpu->vendor_cpuid_only has been unset for compatibility with older
          * machine types.
          */
-        if ((env->nr_dies > 1) &&
+        if ((cs->topo.dies_per_socket > 1) &&
             (IS_INTEL_CPU(env) || !cpu->vendor_cpuid_only)) {
             x86_cpu_adjust_level(cpu, &env->cpuid_min_level, 0x1F);
         }
@@ -6840,8 +6841,6 @@ static void x86_cpu_initfn(Object *obj)
     X86CPUClass *xcc = X86_CPU_GET_CLASS(obj);
     CPUX86State *env = &cpu->env;
 
-    env->nr_dies = 1;
-    env->nr_modules = 1;
     cpu_set_cpustate_pointers(cpu);
 
     object_property_add(obj, "feature-words", "X86CPUFeatureWordInfo",
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index aa7e96c586c7..30b2aa6ab10d 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -1825,14 +1825,6 @@ typedef struct CPUArchState {
     uint32_t umwait;
 
     TPRAccess tpr_access_type;
-
-    /* Number of dies per package. */
-    unsigned nr_dies;
-    /*
-     * Number of modules per die. Module level in x86 cpu topology is
-     * corresponding to smp.clusters.
-     */
-    unsigned nr_modules;
 } CPUX86State;
 
 struct kvm_msrs;
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 77a8c381a73a..687c56825693 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -1859,7 +1859,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
             break;
         }
         case 0x1f:
-            if (env->nr_dies < 2) {
+            if (cs->topo.dies_per_socket < 2) {
                 break;
             }
             /* fallthrough */
-- 
2.34.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]