|
|
cd9d16 |
From 7a890dc5d4e79e4ced03aa9d3665c9a1df3e448e Mon Sep 17 00:00:00 2001
|
|
|
cd9d16 |
From: Bharata B Rao <bharata.rao@gmail.com>
|
|
|
cd9d16 |
Date: Wed, 2 Nov 2011 14:16:08 +0530
|
|
|
cd9d16 |
Subject: [PATCH] Fix X86 CPU topology in KVM mode
|
|
|
cd9d16 |
MIME-Version: 1.0
|
|
|
cd9d16 |
Content-Type: text/plain; charset=UTF-8
|
|
|
cd9d16 |
Content-Transfer-Encoding: 8bit
|
|
|
cd9d16 |
|
|
|
cd9d16 |
apic id returned to guest kernel in ebx for cpuid(function=1) depends on
|
|
|
cd9d16 |
CPUX86State->cpuid_apic_id which gets populated after the cpuid information
|
|
|
cd9d16 |
is cached in the host kernel. This results in broken CPU topology in guest.
|
|
|
cd9d16 |
|
|
|
cd9d16 |
Fix this by setting cpuid_apic_id before cpuid information is passed to
|
|
|
cd9d16 |
the host kernel. This is done by moving the setting of cpuid_apic_id
|
|
|
cd9d16 |
to cpu_x86_init() where it will work for both KVM as well as TCG modes.
|
|
|
cd9d16 |
|
|
|
cd9d16 |
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
|
|
|
cd9d16 |
Signed-off-by: Bharata B Rao <bharata.rao@gmail.com>
|
|
|
cd9d16 |
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
|
|
|
cd9d16 |
(cherry picked from commit f2209eb854a016eabc444b45f6d6b1636949141f)
|
|
|
cd9d16 |
|
|
|
cd9d16 |
Signed-off-by: Bruce Rogers <brogers@suse.com>
|
|
|
cd9d16 |
Signed-off-by: Andreas Färber <afaerber@suse.de>
|
|
|
cd9d16 |
---
|
|
|
cd9d16 |
hw/pc.c | 1 -
|
|
|
cd9d16 |
target-i386/helper.c | 1 +
|
|
|
cd9d16 |
2 files changed, 1 insertion(+), 1 deletion(-)
|
|
|
cd9d16 |
|
|
|
cd9d16 |
diff --git a/hw/pc.c b/hw/pc.c
|
|
|
cd9d16 |
index a3e8539..14ce684 100644
|
|
|
cd9d16 |
--- a/hw/pc.c
|
|
|
cd9d16 |
+++ b/hw/pc.c
|
|
|
cd9d16 |
@@ -931,7 +931,6 @@ static CPUState *pc_new_cpu(const char *cpu_model)
|
|
|
cd9d16 |
exit(1);
|
|
|
cd9d16 |
}
|
|
|
cd9d16 |
if ((env->cpuid_features & CPUID_APIC) || smp_cpus > 1) {
|
|
|
cd9d16 |
- env->cpuid_apic_id = env->cpu_index;
|
|
|
cd9d16 |
env->apic_state = apic_init(env, env->cpuid_apic_id);
|
|
|
cd9d16 |
}
|
|
|
cd9d16 |
qemu_register_reset(pc_cpu_reset, env);
|
|
|
cd9d16 |
diff --git a/target-i386/helper.c b/target-i386/helper.c
|
|
|
cd9d16 |
index e9be104..829c1da 100644
|
|
|
cd9d16 |
--- a/target-i386/helper.c
|
|
|
cd9d16 |
+++ b/target-i386/helper.c
|
|
|
cd9d16 |
@@ -1258,6 +1258,7 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
|
|
|
cd9d16 |
cpu_x86_close(env);
|
|
|
cd9d16 |
return NULL;
|
|
|
cd9d16 |
}
|
|
|
cd9d16 |
+ env->cpuid_apic_id = env->cpu_index;
|
|
|
cd9d16 |
mce_init(env);
|
|
|
cd9d16 |
|
|
|
cd9d16 |
qemu_init_vcpu(env);
|
|
|
cd9d16 |
--
|
|
|
cd9d16 |
1.7.11.2
|
|
|
cd9d16 |
|