From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= Subject: Re: [PATCH] target-i386: cpu: fix --disable-kvm compilation Date: Fri, 02 Nov 2012 17:54:19 +0100 Message-ID: <5093FABB.8090005@suse.de> References: <20121102160538.GD3149@otherpad.lan.raisama.net> <1351873515-28522-1-git-send-email-ehabkost@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: qemu-devel@nongnu.org, Marcelo Tosatti , aliguori@us.ibm.com, kvm@vger.kernel.org, Avi Kivity To: Eduardo Habkost Return-path: Received: from cantor2.suse.de ([195.135.220.15]:38008 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759448Ab2KBQyY (ORCPT ); Fri, 2 Nov 2012 12:54:24 -0400 In-Reply-To: <1351873515-28522-1-git-send-email-ehabkost@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Am 02.11.2012 17:25, schrieb Eduardo Habkost: > This fixes the following: > target-i386/cpu.o: In function `kvm_cpu_fill_host': > target-i386/cpu.c:783: undefined reference to `kvm_state' >=20 > I didn't notice the problem before because GCC was optimizing the ent= ire > kvm_cpu_fill_host() function out (because all calls are conditional o= n > kvm_enabled()). >=20 > * cpu_x86_fill_model_id() is used only if CONFIG_KVM is set, so #ifde= f it > entirely to avoid compiler warnings. >=20 > * kvm_cpu_fill_host() should be called only if KVM is enabled, so > use #ifdef CONFIG_KVM around the entire function body. >=20 > Reported-by: Andreas F=C3=A4rber > Signed-off-by: Eduardo Habkost Acked-by: Andreas F=C3=A4rber If no one objects to this solution, unless Marcelo or Avi beat me, I'll send out an urgent pull request as requested by Anthony. Thanks, Andreas > --- > target-i386/cpu.c | 4 ++++ > 1 file changed, 4 insertions(+) >=20 > 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[] =3D { > }, > }; > =20 > +#ifdef CONFIG_KVM > static int cpu_x86_fill_model_id(char *str) > { > uint32_t eax =3D 0, ebx =3D 0, ecx =3D 0, edx =3D 0; > @@ -772,6 +773,7 @@ static int cpu_x86_fill_model_id(char *str) > } > return 0; > } > +#endif > =20 > /* 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 =3D kvm_state; > uint32_t eax =3D 0, ebx =3D 0, ecx =3D 0, edx =3D 0; > =20 > @@ -838,6 +841,7 @@ static void kvm_cpu_fill_host(x86_def_t *x86_cpu_= def) > * unsupported ones later. > */ > x86_cpu_def->svm_features =3D -1; > +#endif /* CONFIG_KVM */ > } > =20 > static int unavailable_host_feature(struct model_features_t *f, uint= 32_t mask) >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3= =BCrnberg