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: 1689351 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id AC58EDF2A2 for ; Fri, 2 Nov 2012 16:24:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759643Ab2KBQYk (ORCPT ); Fri, 2 Nov 2012 12:24:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2900 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759050Ab2KBQYi (ORCPT ); Fri, 2 Nov 2012 12:24:38 -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 Cc: Marcelo Tosatti , aliguori@us.ibm.com, kvm@vger.kernel.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: =?UTF-8?q?=5BPATCH=5D=20target-i386=3A=20cpu=3A=20fix=20--disable-kvm=20compilation?= 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 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.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)