From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] arch/x86/kvm/x86.c: remove a superfluous test for !X86_64 Date: Mon, 28 Apr 2014 10:41:42 +0200 Message-ID: <535E1446.5020301@redhat.com> References: <1398612730-6684-1-git-send-email-toralf.foerster@gmx.de> <535D24F9.7080605@redhat.com> <535D37DE.5050303@gmx.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org To: =?UTF-8?B?VG9yYWxmIEbDtnJzdGVy?= Return-path: Received: from mx1.redhat.com ([209.132.183.28]:52534 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753004AbaD1Ilt (ORCPT ); Mon, 28 Apr 2014 04:41:49 -0400 In-Reply-To: <535D37DE.5050303@gmx.de> Sender: kvm-owner@vger.kernel.org List-ID: Il 27/04/2014 19:01, Toralf F=C3=B6rster ha scritto: > On 04/27/2014 05:40 PM, Paolo Bonzini wrote: >> Il 27/04/2014 17:32, Toralf F=C3=B6rster ha scritto: >>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c >>> index 8b8fc0b..a6ca7e0 100644 >>> --- a/arch/x86/kvm/x86.c >>> +++ b/arch/x86/kvm/x86.c >>> @@ -5680,15 +5680,17 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu) >>> kvm_x86_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l); >>> longmode =3D is_long_mode(vcpu) && cs_l =3D=3D 1; >>> >>> +#ifdef CONFIG_X86_64 >>> if (!longmode) { >>> +#endif >> >> This is ugly... > +1 > >> >>> param =3D ((u64)kvm_register_read(vcpu, VCPU_REGS_RDX) << = 32) | >>> (kvm_register_read(vcpu, VCPU_REGS_RAX) & 0xffffffff); >>> ingpa =3D ((u64)kvm_register_read(vcpu, VCPU_REGS_RBX) << = 32) | >>> (kvm_register_read(vcpu, VCPU_REGS_RCX) & 0xffffffff); >>> outgpa =3D ((u64)kvm_register_read(vcpu, VCPU_REGS_RDI) <<= 32) | >>> (kvm_register_read(vcpu, VCPU_REGS_RSI) & 0xffffffff); >>> - } >>> #ifdef CONFIG_X86_64 >> >> ... can you just remove this #ifdef instead? It will be dead code, = but >> the compiler will detect it as such and remove it. >> > > ok, but VCPU_REGS_R8 is #ifdef'ed in arch/x86/include/asm/kvm_host.h = around line 120 and therefore I get : > > tfoerste@n22 ~/devel/linux $ sudo make modules > ... > CHK include/config/kernel.release > CHK include/generated/uapi/linux/version.h > CHK include/generated/utsrelease.h > CALL scripts/checksyscalls.sh > CC [M] arch/x86/kvm/x86.o > arch/x86/kvm/x86.c: In function =E2=80=98kvm_hv_hypercall=E2=80=99: > arch/x86/kvm/x86.c:5694:36: error: =E2=80=98VCPU_REGS_R8=E2=80=99 und= eclared (first use in this function) > arch/x86/kvm/x86.c:5694:36: note: each undeclared identifier is repor= ted only once for each function it appears in > make[2]: *** [arch/x86/kvm/x86.o] Error 1 > make[1]: *** [arch/x86/kvm] Error 2 > make: *** [arch/x86] Error 2 You can just BUG() in the #else then if you really feel like fixing thi= s: } else { #ifdef CONFIG_X86_64 ... #else BUG(); #endif Paolo > >> Paolo >> >>> + } >>> else { >>> param =3D kvm_register_read(vcpu, VCPU_REGS_RCX); >>> ingpa =3D kvm_register_read(vcpu, VCPU_REGS_RDX); >> >> > >