From: Eduardo Habkost Date: Tue, 22 Jan 2013 20:25:02 +0000 (-0200) Subject: target-i386: kvm: Set vcpu_id to APIC ID instead of CPU index X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=83b17af5e619abdf11721826b08fa4f30e9dc4ee;p=qemu.git target-i386: kvm: Set vcpu_id to APIC ID instead of CPU index The CPU ID in KVM is supposed to be the APIC ID, so change the KVM_CREATE_VCPU call to match it. The current behavior didn't break anything yet because today the APIC ID is assumed to be equal to the CPU index, but this won't be true in the future. Signed-off-by: Eduardo Habkost Reviewed-by: Marcelo Tosatti Acked-by: Gleb Natapov Signed-off-by: Andreas Färber --- diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 5f3f7894c1..c440809cb2 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -411,9 +411,10 @@ static void cpu_update_state(void *opaque, int running, RunState state) } } -unsigned long kvm_arch_vcpu_id(CPUState *cpu) +unsigned long kvm_arch_vcpu_id(CPUState *cs) { - return cpu->cpu_index; + X86CPU *cpu = X86_CPU(cs); + return cpu->env.cpuid_apic_id; } int kvm_arch_init_vcpu(CPUState *cs)