From patchwork Tue Jan 22 20:25:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 214643 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C0C0B2C008C for ; Wed, 23 Jan 2013 07:24:21 +1100 (EST) Received: from localhost ([::1]:58433 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxkOJ-0008TA-R2 for incoming@patchwork.ozlabs.org; Tue, 22 Jan 2013 15:24:19 -0500 Received: from eggs.gnu.org ([208.118.235.92]:47036) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxkNv-0008Qv-3J for qemu-devel@nongnu.org; Tue, 22 Jan 2013 15:23:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TxkNq-0000CL-TI for qemu-devel@nongnu.org; Tue, 22 Jan 2013 15:23:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60012) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxkNq-0000BV-KM for qemu-devel@nongnu.org; Tue, 22 Jan 2013 15:23:50 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0MKNn9u017921 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 22 Jan 2013 15:23:49 -0500 Received: from blackpad.lan.raisama.net (vpn1-7-132.gru2.redhat.com [10.97.7.132]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0MKNmE0003046; Tue, 22 Jan 2013 15:23:48 -0500 Received: by blackpad.lan.raisama.net (Postfix, from userid 500) id 00E98201593; Tue, 22 Jan 2013 18:25:33 -0200 (BRST) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Tue, 22 Jan 2013 18:25:02 -0200 Message-Id: <1358886309-26258-3-git-send-email-ehabkost@redhat.com> In-Reply-To: <1358886309-26258-1-git-send-email-ehabkost@redhat.com> References: <1358886309-26258-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kvm@vger.kernel.org, Gleb Natapov , "Michael S. Tsirkin" , Marcelo Tosatti , Igor Mammedov , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH for-1.4 qom-cpu 2/9] target-i386: kvm: Set vcpu_id to APIC ID instead of CPU index X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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)