From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50293) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tt0lK-0003Aj-QU for qemu-devel@nongnu.org; Wed, 09 Jan 2013 13:52:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tt0lJ-0005fP-0Y for qemu-devel@nongnu.org; Wed, 09 Jan 2013 13:52:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:7201) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tt0lI-0005et-Mt for qemu-devel@nongnu.org; Wed, 09 Jan 2013 13:52:28 -0500 From: Eduardo Habkost Date: Wed, 9 Jan 2013 16:53:45 -0200 Message-Id: <1357757632-1950-6-git-send-email-ehabkost@redhat.com> In-Reply-To: <1357757632-1950-1-git-send-email-ehabkost@redhat.com> References: <1357757632-1950-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [RFC 05/12] target-i386: kvm: Set vcpu_id to APIC ID instead of CPU index List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, Gleb Natapov , "Michael S. Tsirkin" , Marcelo Tosatti , Igor Mammedov , =?UTF-8?q?Andreas=20F=C3=A4rber?= 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 --- Cc: kvm@vger.kernel.org Cc: Michael S. Tsirkin Cc: Gleb Natapov Cc: Marcelo Tosatti Changes v2: - Change only i386 code (kvm_arch_vcpu_id()) Changes v3: - Get CPUState as argument instead of CPUArchState --- target-i386/kvm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 5f3f789..c440809 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) -- 1.7.11.7