[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 5/5] i386: Fix pkg_id offset EPYC
From: |
Moger, Babu |
Subject: |
[Qemu-devel] [RFC PATCH 5/5] i386: Fix pkg_id offset EPYC |
Date: |
Wed, 31 Jul 2019 23:20:51 +0000 |
Per Processor Programming Reference (PPR) for AMD Family 17h Models,
the pkg_id offset in apicid is 6. Fix the offset based on EPYC models.
Signed-off-by: Babu Moger <address@hidden>
---
target/i386/cpu.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index be4583068c..235496a9c1 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -4079,7 +4079,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index,
uint32_t count,
MachineState *ms = MACHINE(qdev_get_machine());
X86CPU *cpu = env_archcpu(env);
CPUState *cs = env_cpu(env);
- uint32_t die_offset;
+ uint32_t die_offset, pkg_offset;
uint32_t limit;
uint32_t signature[3];
@@ -4102,6 +4102,12 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index,
uint32_t count,
index = env->cpuid_level;
}
+ if (!strncmp(ms->cpu_type, "EPYC", 4))
+ pkg_offset = PKG_OFFSET_EPYC;
+ else
+ pkg_offset = apicid_pkg_offset(env->nr_dies, cs->nr_cores,
+ cs->nr_threads);
+
switch(index) {
case 0:
*eax = env->cpuid_level;
@@ -4260,8 +4266,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(env->nr_dies,
- cs->nr_cores, cs->nr_threads);
+ *eax = pkg_offset;
*ebx = cs->nr_cores * cs->nr_threads;
*ecx |= CPUID_TOPOLOGY_LEVEL_CORE;
break;
@@ -4297,8 +4302,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(env->nr_dies, cs->nr_cores,
- cs->nr_threads);
+ *eax = pkg_offset;
*ebx = env->nr_dies * cs->nr_cores * cs->nr_threads;
*ecx |= CPUID_TOPOLOGY_LEVEL_DIE;
break;
--
2.20.1
- [Qemu-devel] [RFC PATCH 0/5] APIC ID fixes for AMD EPYC CPU models, Moger, Babu, 2019/07/31
- [Qemu-devel] [RFC PATCH 1/5] hw/boards: Add sockets in CpuTopology structure, Moger, Babu, 2019/07/31
- [Qemu-devel] [RFC PATCH 3/5] i386: Use topology functions from topology.h, Moger, Babu, 2019/07/31
- [Qemu-devel] [RFC PATCH 2/5] hw/i386: Add AMD EPYC topology encoding, Moger, Babu, 2019/07/31
- [Qemu-devel] [RFC PATCH 5/5] i386: Fix pkg_id offset EPYC,
Moger, Babu <=
- [Qemu-devel] [RFC PATCH 4/5] hw/i386: Generate apicid based on cpu_type, Moger, Babu, 2019/07/31