Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp245163rdg; Tue, 10 Oct 2023 09:04:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGDLzjufFF4TQxR+0NnKCgkWyA05ZEnv3n6wyBWiNSX19JoLWalSjH7y2m3hHvI/a7XSyQr X-Received: by 2002:a17:90a:8a85:b0:274:abbc:4ef2 with SMTP id x5-20020a17090a8a8500b00274abbc4ef2mr14922501pjn.30.1696953886068; Tue, 10 Oct 2023 09:04:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696953886; cv=none; d=google.com; s=arc-20160816; b=bmeyPhHOwa4weDJ4Ae5P12gBHdEpbsyW10ttCqsh4xHTjJnorCq+nyYcO/ga/TdgKC 6eCf4UKhDoB/c0rTYfsG+zcA1AcDI3NnlLkqp/h1OONYCYFfNKUU+oAaxY6KnDYdWQ6x H+2O8QmfIDT/K7LiLpN4Z8mqamtSB/PQZ2M729LDplLUbNuQ7FDA0OmMHVIGn7sHGROs VNpAJ+4h0mdxrsAsCeK4EQK49zHuO7hgUG9KtfrK2JtT9vbVhBtYwORrMihQLYBJhapa /bmK1JM8g0s4U3DyvYex7cjohqo4SERvl/JfkWMFv2BQnYny8egZ8gsoFIbWUaIprnyd XFsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NWcz0QuaamBHPubxsGVpnjxU2WbSV2mTYTPQXIgc2HM=; fh=SJRVlyvhIPEM+1ZkklEUy6ba01ZQIQ4PgkK8h+im/FM=; b=kp7LHbKFua07flh0hzVmhK9nbKvpBvN4WW4PXkndm+YAEjTg/PZHdifa/maTShHkWp qvFY0v+L4Z2zJjDWwI6SYEXCVK+GfL4DFIDk3zRbEX9tFa7SNxB5Y6ASUcAAu5uAC29h mlFpG3iSkjY2O3mndVowD+nMl3qBNu3MY1AddrskcQ6Kkre75UpfX5IJ6Cdnjwt03uaM Yr1Cd8S4vU/8iPEvGbBPmWZ8ve5EKy9RpZveZn7LMg8Nz0u4shqNkz27HedBySQMyRaK xaPLZQ6Ip9uI0CiWj9LHcik7K1reT1RkupN4j+N3F3widifQF9ThOZkIsNO5mR0/vB6S l2wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fM9xEkGq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id p8-20020a17090ab90800b0027749a98350si1192051pjr.159.2023.10.10.09.04.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 09:04:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fM9xEkGq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 8F10A801F762; Tue, 10 Oct 2023 09:04:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233956AbjJJQEa (ORCPT + 99 others); Tue, 10 Oct 2023 12:04:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233751AbjJJQEI (ORCPT ); Tue, 10 Oct 2023 12:04:08 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11196E0 for ; Tue, 10 Oct 2023 09:03:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696953801; 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: in-reply-to:in-reply-to:references:references; bh=NWcz0QuaamBHPubxsGVpnjxU2WbSV2mTYTPQXIgc2HM=; b=fM9xEkGqk0JhjrT7bI7TF5mXuTYO/Yu/y6sLBEV2x0Ze6CsESKVF+Ge/6zjqFyo3PwV3u2 j+r9/lesM/xAtdgv6xcQiLZxUMjcwt1y2XlgM5/9F+U9KSV1bid1Ru5TMfBdQmNLvo4q/X CkowttAiaTomHJ2Slb840srgjGXClTs= 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-617-bo9lrJ0uMFeRNKVEJqenWQ-1; Tue, 10 Oct 2023 12:03:13 -0400 X-MC-Unique: bo9lrJ0uMFeRNKVEJqenWQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EAA2485A5BE; Tue, 10 Oct 2023 16:03:12 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.226.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 26FBE1B94; Tue, 10 Oct 2023 16:03:12 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson Cc: linux-kernel@vger.kernel.org Subject: [PATCH RFC 10/11] KVM: nVMX: hyper-v: Hide more stuff under CONFIG_KVM_HYPERV Date: Tue, 10 Oct 2023 18:02:59 +0200 Message-ID: <20231010160300.1136799-11-vkuznets@redhat.com> In-Reply-To: <20231010160300.1136799-1-vkuznets@redhat.com> References: <20231010160300.1136799-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 10 Oct 2023 09:04:41 -0700 (PDT) 'hv_evmcs_vmptr'/'hv_evmcs_map'/'hv_evmcs' fields in 'struct nested_vmx' should not be used when !CONFIG_KVM_HYPERV, hide them when !CONFIG_KVM_HYPERV. No functional change intended. Signed-off-by: Vitaly Kuznetsov --- arch/x86/kvm/vmx/nested.c | 2 ++ arch/x86/kvm/vmx/vmx.c | 3 +++ arch/x86/kvm/vmx/vmx.h | 2 ++ 3 files changed, 7 insertions(+) diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index d539904d8f1e..10cb35cd7a19 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -6650,6 +6650,7 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu, return -EINVAL; set_current_vmptr(vmx, kvm_state->hdr.vmx.vmcs12_pa); +#ifdef CONFIG_KVM_HYPERV } else if (kvm_state->flags & KVM_STATE_NESTED_EVMCS) { /* * nested_vmx_handle_enlightened_vmptrld() cannot be called @@ -6659,6 +6660,7 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu, */ vmx->nested.hv_evmcs_vmptr = EVMPTR_MAP_PENDING; kvm_make_request(KVM_REQ_GET_NESTED_STATE_PAGES, vcpu); +#endif } else { return -EINVAL; } diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 04eb5d4d28bc..3b1bd3d97150 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -4834,7 +4834,10 @@ static void __vmx_vcpu_reset(struct kvm_vcpu *vcpu) vmx->nested.posted_intr_nv = -1; vmx->nested.vmxon_ptr = INVALID_GPA; vmx->nested.current_vmptr = INVALID_GPA; + +#ifdef CONFIG_KVM_HYPERV vmx->nested.hv_evmcs_vmptr = EVMPTR_INVALID; +#endif vcpu->arch.microcode_version = 0x100000000ULL; vmx->msr_ia32_feature_control_valid_bits = FEAT_CTL_LOCKED; diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h index c2130d2c8e24..55addb8eef01 100644 --- a/arch/x86/kvm/vmx/vmx.h +++ b/arch/x86/kvm/vmx/vmx.h @@ -241,9 +241,11 @@ struct nested_vmx { bool guest_mode; } smm; +#ifdef CONFIG_KVM_HYPERV gpa_t hv_evmcs_vmptr; struct kvm_host_map hv_evmcs_map; struct hv_enlightened_vmcs *hv_evmcs; +#endif }; struct vcpu_vmx { -- 2.41.0