From nobody Wed Feb 11 13:07:16 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2223C6FD1D for ; Tue, 14 Mar 2023 12:07:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231594AbjCNMHT (ORCPT ); Tue, 14 Mar 2023 08:07:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231772AbjCNMHH (ORCPT ); Tue, 14 Mar 2023 08:07:07 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBFD81CBE9 for ; Tue, 14 Mar 2023 05:05:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678795440; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MkvZhNM1t39M096NVBy9IojYv95X5G5zpBGWQK5Uqpk=; b=Bwrwo/BSiPKEVyTcBSZ2wjqmB2zDc4fAlQ5wFVrChoI4VB2EGVK/4oiSU18KOa2j1G2gux NRaKIt1ofo8F34TeKR/q8O3aUiP29/TIZIsYaIqXJ5ZjayBoTClRqi206dhLsKTvFNvqmM s/DXVVPiy/YaA+JLRK/a/zUlWQEYmm4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-264-frR9oI5qOaOvDYO_c4DA6A-1; Tue, 14 Mar 2023 08:00:17 -0400 X-MC-Unique: frR9oI5qOaOvDYO_c4DA6A-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7C75D857F43; Tue, 14 Mar 2023 12:00:17 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 60BCA2A68; Tue, 14 Mar 2023 12:00:17 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: seanjc@google.com Subject: [PATCH] KVM: nVMX: remove unnecessary #ifdef Date: Tue, 14 Mar 2023 08:00:16 -0400 Message-Id: <20230314120016.3038336-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" nested_vmx_check_controls() has already run by the time KVM checks host sta= te, so the "host address space size" exit control can only be set on x86-64 hos= ts. Simplify the condition at the cost of adding some dead code to 32-bit kerne= ls. Signed-off-by: Paolo Bonzini --- arch/x86/kvm/vmx/nested.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index bceb5ad409c6..535c85a332ad 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -2902,7 +2902,7 @@ static int nested_vmx_check_address_space_size(struct= kvm_vcpu *vcpu, static int nested_vmx_check_host_state(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) { - bool ia32e; + bool ia32e =3D !!(vmcs12->vm_exit_controls & VM_EXIT_HOST_ADDR_SPACE_SIZE= ); =20 if (CC(!nested_host_cr0_valid(vcpu, vmcs12->host_cr0)) || CC(!nested_host_cr4_valid(vcpu, vmcs12->host_cr4)) || @@ -2922,12 +2922,6 @@ static int nested_vmx_check_host_state(struct kvm_vc= pu *vcpu, vmcs12->host_ia32_perf_global_ctrl))) return -EINVAL; =20 -#ifdef CONFIG_X86_64 - ia32e =3D !!(vmcs12->vm_exit_controls & VM_EXIT_HOST_ADDR_SPACE_SIZE); -#else - ia32e =3D false; -#endif - if (ia32e) { if (CC(!(vmcs12->host_cr4 & X86_CR4_PAE))) return -EINVAL; --=20 2.39.1