> Hi, > > I see that x86 CPU topology inside VM is not showing up as specified. > With some debugging, I found out that the root cause for this: qemu is > not enumerating the apic ids correctly for vcpus. I made the below > hackish change to get it working. Has anybody else seen this problem > ? This patch is on qemu-kvm-0.14.1. Using 2.6.39 for guest. > > *************************** > Fix apic id enumeration > > apic id returned to guest kernel in ebx for cpuid(function=1) depends > on > CPUX86State->cpuid_apic_id which gets populated after the cpuid > information > is cached in the host kernel. > > Fix this by setting cpuid_apic_id before cpuid information is passed > to > the host kernel. >
> Index: qemu-kvm-0.14.1/hw/pc.c > =================================================================== > --- qemu-kvm-0.14.1.orig/hw/pc.c > +++ qemu-kvm-0.14.1/hw/pc.c Please post a patch against qemu.git master branch. > > + if (env->cpuid_features & CPUID_APIC) > + env->cpuid_apic_id = env->cpu_index; > + qemu coding style requires braces even around single statements in if () blocks.