[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 02/10] i386/cpu: Drop the variable smp_cores and smp_threads i
From: |
Xiaoyao Li |
Subject: |
[PATCH v2 02/10] i386/cpu: Drop the variable smp_cores and smp_threads in x86_cpu_pre_plug() |
Date: |
Thu, 19 Dec 2024 06:01:17 -0500 |
No need to define smp_cores and smp_threads, just using ms->smp.cores
and ms->smp.threads is straightforward. It's also consistent with other
checks of socket/die/module.
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
hw/i386/x86-common.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c
index 3f7818269234..32a8d7a9db87 100644
--- a/hw/i386/x86-common.c
+++ b/hw/i386/x86-common.c
@@ -248,8 +248,6 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev,
CPUX86State *env = &cpu->env;
MachineState *ms = MACHINE(hotplug_dev);
X86MachineState *x86ms = X86_MACHINE(hotplug_dev);
- unsigned int smp_cores = ms->smp.cores;
- unsigned int smp_threads = ms->smp.threads;
X86CPUTopoInfo topo_info;
if (!object_dynamic_cast(OBJECT(cpu), ms->cpu_type)) {
@@ -329,17 +327,17 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev,
if (cpu->core_id < 0) {
error_setg(errp, "CPU core-id is not set");
return;
- } else if (cpu->core_id > (smp_cores - 1)) {
+ } else if (cpu->core_id > (ms->smp.cores - 1)) {
error_setg(errp, "Invalid CPU core-id: %u must be in range 0:%u",
- cpu->core_id, smp_cores - 1);
+ cpu->core_id, ms->smp.cores - 1);
return;
}
if (cpu->thread_id < 0) {
error_setg(errp, "CPU thread-id is not set");
return;
- } else if (cpu->thread_id > (smp_threads - 1)) {
+ } else if (cpu->thread_id > (ms->smp.threads - 1)) {
error_setg(errp, "Invalid CPU thread-id: %u must be in range 0:%u",
- cpu->thread_id, smp_threads - 1);
+ cpu->thread_id, ms->smp.threads - 1);
return;
}
--
2.34.1
- [PATCH v2 00/10] i386: Track X86CPUTopoInfo in CPUX86State and track features in env->features[], Xiaoyao Li, 2024/12/19
- [PATCH v2 01/10] i386/cpu: Extract a common fucntion to setup value of MSR_CORE_THREAD_COUNT, Xiaoyao Li, 2024/12/19
- [PATCH v2 04/10] i386/topology: Update the comment of x86_apicid_from_topo_ids(), Xiaoyao Li, 2024/12/19
- [PATCH v2 03/10] i386/cpu: Drop cores_per_pkg in cpu_x86_cpuid(), Xiaoyao Li, 2024/12/19
- [PATCH v2 05/10] i386/topology: Introduce helpers for various topology info of different level, Xiaoyao Li, 2024/12/19
- [PATCH v2 06/10] i386/cpu: Track a X86CPUTopoInfo directly in CPUX86State, Xiaoyao Li, 2024/12/19
- [PATCH v2 02/10] i386/cpu: Drop the variable smp_cores and smp_threads in x86_cpu_pre_plug(),
Xiaoyao Li <=
- [PATCH v2 07/10] i386/cpu: Hoist check of CPUID_EXT3_TOPOEXT against threads_per_core, Xiaoyao Li, 2024/12/19
- [PATCH v2 08/10] cpu: Remove nr_cores from struct CPUState, Xiaoyao Li, 2024/12/19
- [PATCH v2 09/10] i386/cpu: Set up CPUID_HT in x86_cpu_expand_features() instead of cpu_x86_cpuid(), Xiaoyao Li, 2024/12/19
- [PATCH v2 10/10] i386/cpu: Set and track CPUID_EXT3_CMP_LEG in env->features[FEAT_8000_0001_ECX], Xiaoyao Li, 2024/12/19