[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 15/16] i386: Fix pkg_id offset for EPYC cpu models
From: |
Babu Moger |
Subject: |
[PATCH v4 15/16] i386: Fix pkg_id offset for EPYC cpu models |
Date: |
Thu, 13 Feb 2020 12:18:07 -0600 |
User-agent: |
StGit/unknown-version |
If the system is numa configured the pkg_offset needs
to be adjusted for EPYC cpu models. Fix it calling the
model specific handler.
Signed-off-by: Babu Moger <address@hidden>
---
hw/i386/pc.c | 1 +
hw/i386/x86.c | 4 ++++
target/i386/cpu.c | 4 ++--
target/i386/cpu.h | 1 +
4 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 93063af6a8..e56780b1f0 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1754,6 +1754,7 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev,
env->nr_dies = x86ms->smp_dies;
env->nr_nodes = ms->numa_state->num_nodes / ms->smp.sockets;
+ env->pkg_offset = x86ms->apicid_pkg_offset(&topo_info);
/*
* If APIC ID is not set,
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index 472dc3eb77..99f2a67d69 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -106,12 +106,16 @@ void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id,
Error **errp)
Error *local_err = NULL;
CPUX86State *env = NULL;
MachineState *ms = MACHINE(x86ms);
+ X86CPUTopoInfo topo_info;
+
+ init_topo_info(&topo_info, x86ms);
cpu = object_new(MACHINE(x86ms)->cpu_type);
env = &X86_CPU(cpu)->env;
env->nr_dies = x86ms->smp_dies;
env->nr_nodes = ms->numa_state->num_nodes / ms->smp.sockets;
+ env->pkg_offset = x86ms->apicid_pkg_offset(&topo_info);
object_property_set_uint(cpu, apic_id, "apic-id", &local_err);
object_property_set_bool(cpu, true, "realized", &local_err);
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 082865d72b..b793da7c6e 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -5454,7 +5454,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index,
uint32_t count,
*ecx |= CPUID_TOPOLOGY_LEVEL_SMT;
break;
case 1:
- *eax = apicid_pkg_offset(&topo_info);
+ *eax = env->pkg_offset;
*ebx = cs->nr_cores * cs->nr_threads;
*ecx |= CPUID_TOPOLOGY_LEVEL_CORE;
break;
@@ -5488,7 +5488,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index,
uint32_t count,
*ecx |= CPUID_TOPOLOGY_LEVEL_CORE;
break;
case 2:
- *eax = apicid_pkg_offset(&topo_info);
+ *eax = env->pkg_offset;
*ebx = env->nr_dies * cs->nr_cores * cs->nr_threads;
*ecx |= CPUID_TOPOLOGY_LEVEL_DIE;
break;
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 64a1cca690..641e1cacdf 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -1604,6 +1604,7 @@ typedef struct CPUX86State {
unsigned nr_dies;
unsigned nr_nodes;
+ unsigned pkg_offset;
} CPUX86State;
struct kvm_msrs;
- [PATCH v4 05/16] machine: Add SMP Sockets in CpuTopology, (continued)
- [PATCH v4 05/16] machine: Add SMP Sockets in CpuTopology, Babu Moger, 2020/02/13
- [PATCH v4 06/16] hw/i386: Update structures for nodes_per_pkg, Babu Moger, 2020/02/13
- [PATCH v4 07/16] hw/i386: Rename apicid_from_topo_ids to x86_apicid_from_topo_ids, Babu Moger, 2020/02/13
- [PATCH v4 08/16] hw/386: Add EPYC mode topology decoding functions, Babu Moger, 2020/02/13
- [PATCH v4 09/16] target/i386: Cleanup and use the EPYC mode topology functions, Babu Moger, 2020/02/13
- [PATCH v4 10/16] hw/i386: Introduce apicid functions inside X86MachineState, Babu Moger, 2020/02/13
- [PATCH v4 11/16] target/i386: Load apicid model specific handlers from X86CPUDefinition, Babu Moger, 2020/02/13
- [PATCH v4 12/16] hw/i386: Use the apicid handlers from X86MachineState, Babu Moger, 2020/02/13
- [PATCH v4 13/16] target/i386: Add EPYC model specific handlers, Babu Moger, 2020/02/13
- [PATCH v4 14/16] hw/i386: Move arch_id decode inside x86_cpus_init, Babu Moger, 2020/02/13
- [PATCH v4 15/16] i386: Fix pkg_id offset for EPYC cpu models,
Babu Moger <=
- [PATCH v4 16/16] tests: Update the Unit tests, Babu Moger, 2020/02/13