[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
- [RFC 21/52] ppc: Replace MachineState.smp access with topology helpers, (continued)
- [RFC 21/52] ppc: Replace MachineState.smp access with topology helpers, Zhao Liu, 2023/02/13
- [RFC 22/52] riscv: Replace MachineState.smp access with topology helpers, Zhao Liu, 2023/02/13
- [RFC 23/52] arm: Replace MachineState.smp access with topology helpers, Zhao Liu, 2023/02/13
- [RFC 25/52] mips: Replace MachineState.smp access with topology helpers, Zhao Liu, 2023/02/13
- [RFC 26/52] hw: Replace MachineState.smp access with topology helpers for all remaining archs, Zhao Liu, 2023/02/13
- [RFC 27/52] test/test-smp-parse: Check fields of MachineState.topo.smp, Zhao Liu, 2023/02/13
- [RFC 28/52] hw/core/machine: Remove support of MachineState.smp, Zhao Liu, 2023/02/13
- [RFC 24/52] loongarch: Replace MachineState.smp access with topology helpers, Zhao Liu, 2023/02/13
- [RFC 30/52] i386: Drop nr_dies and nr_modules CPUX86State,
Zhao Liu <=
- [RFC 29/52] hw/core/cpu: Introduce TopologyState in CPUState, Zhao Liu, 2023/02/13
- [RFC 31/52] i386/cpu: Use CPUState.topo to replace X86CPUTopoInfo to get topology info, Zhao Liu, 2023/02/13
- [RFC 32/52] i386: Rename X86CPUTopoInfo and its members to reflect relationship with APIC ID, Zhao Liu, 2023/02/13
- [RFC 35/52] i386: Support APIC ID topology for hybrid CPU topology, Zhao Liu, 2023/02/13
- [RFC 33/52] i386: Rename init_topo_info() to init_apic_topo_info(), Zhao Liu, 2023/02/13
- [RFC 34/52] i386: Rename variable topo_info to apicid_topo, Zhao Liu, 2023/02/13