From patchwork Fri Nov 2 16:25:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 196591 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 20D442C00BF for ; Sat, 3 Nov 2012 03:24:26 +1100 (EST) Received: from localhost ([::1]:59610 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TUK2i-00036D-9M for incoming@patchwork.ozlabs.org; Fri, 02 Nov 2012 12:24:24 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TUK2Z-00034u-KL for qemu-devel@nongnu.org; Fri, 02 Nov 2012 12:24:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TUK2Y-0003bI-Em for qemu-devel@nongnu.org; Fri, 02 Nov 2012 12:24:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42242) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TUK2Y-0003b5-5Z for qemu-devel@nongnu.org; Fri, 02 Nov 2012 12:24:14 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qA2GOD00018439 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 2 Nov 2012 12:24:13 -0400 Received: from blackpad.lan.raisama.net (vpn1-4-178.gru2.redhat.com [10.97.4.178]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id qA2GOCrn025213; Fri, 2 Nov 2012 12:24:12 -0400 Received: by blackpad.lan.raisama.net (Postfix, from userid 500) id A1A7E2032AB; Fri, 2 Nov 2012 14:25:34 -0200 (BRST) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Fri, 2 Nov 2012 14:25:15 -0200 Message-Id: <1351873515-28522-1-git-send-email-ehabkost@redhat.com> In-Reply-To: <20121102160538.GD3149@otherpad.lan.raisama.net> References: <20121102160538.GD3149@otherpad.lan.raisama.net> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id qA2GOD00018439 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: aliguori@us.ibm.com, Marcelo Tosatti , =?UTF-8?q?Andreas=20F=C3=A4rber?= , kvm@vger.kernel.org Subject: [Qemu-devel] =?utf-8?q?=5BPATCH=5D_target-i386=3A_cpu=3A_fix_--di?= =?utf-8?q?sable-kvm_compilation?= 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 This fixes the following: target-i386/cpu.o: In function `kvm_cpu_fill_host': target-i386/cpu.c:783: undefined reference to `kvm_state' I didn't notice the problem before because GCC was optimizing the entire kvm_cpu_fill_host() function out (because all calls are conditional on kvm_enabled()). * cpu_x86_fill_model_id() is used only if CONFIG_KVM is set, so #ifdef it entirely to avoid compiler warnings. * kvm_cpu_fill_host() should be called only if KVM is enabled, so use #ifdef CONFIG_KVM around the entire function body. Reported-by: Andreas Färber Signed-off-by: Eduardo Habkost Acked-by: Andreas Färber --- target-i386/cpu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index c46286a..e1db639 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -758,6 +758,7 @@ static x86_def_t builtin_x86_defs[] = { }, }; +#ifdef CONFIG_KVM static int cpu_x86_fill_model_id(char *str) { uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0; @@ -772,6 +773,7 @@ static int cpu_x86_fill_model_id(char *str) } return 0; } +#endif /* Fill a x86_def_t struct with information about the host CPU, and * the CPU features supported by the host hardware + host kernel @@ -780,6 +782,7 @@ static int cpu_x86_fill_model_id(char *str) */ static void kvm_cpu_fill_host(x86_def_t *x86_cpu_def) { +#ifdef CONFIG_KVM KVMState *s = kvm_state; uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0; @@ -838,6 +841,7 @@ static void kvm_cpu_fill_host(x86_def_t *x86_cpu_def) * unsupported ones later. */ x86_cpu_def->svm_features = -1; +#endif /* CONFIG_KVM */ } static int unavailable_host_feature(struct model_features_t *f, uint32_t mask)