Skip to content

Commit

Permalink
target-i386: kvm: Set vcpu_id to APIC ID instead of CPU index
Browse files Browse the repository at this point in the history
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 <ehabkost@redhat.com>
Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
Acked-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
  • Loading branch information
ehabkost authored and afaerber committed Jan 27, 2013
1 parent b164e48 commit 83b17af
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions target-i386/kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 83b17af

Please sign in to comment.