Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2644625rda; Wed, 25 Oct 2023 08:27:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEe1WtSj2deadK9DI8/JL31n79OEsw+x9//RfpiLkC1ePXfdUbVZBC9QQoGF4XZk/9PVupq X-Received: by 2002:a17:907:74a:b0:9c7:4c3e:4267 with SMTP id xc10-20020a170907074a00b009c74c3e4267mr11754346ejb.25.1698247641019; Wed, 25 Oct 2023 08:27:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698247641; cv=none; d=google.com; s=arc-20160816; b=kzPa5rUgXE/L9Muk/ZlyziE49MokwdGFvZxcgER8k+KJ2CwcQZ5KIwzgqB2tYjvw+r NKhR9x08OvfJj0Qn9/YRLz7w4KTOrPhgmGKLf5ojdJhOLZ7O83gFXKZfyjlGMw/CGbo/ 89TZSV9aZCPrPoNzBOnGOlDCPE884T6wqYgGWgtUfJvmQL6qLrTy4AfcX5fxquaig1Lb huKBfhG2spNYFXw5Dpi7wkd3T/AGw+CkhCkmwdN1x47AZcrPkKqY0a/MHvtbGTiLpuJ9 txJN6/lCbcCD5gopMF6IGpeGSgHQzRNpCQVYHnSajvOEC3MZeRxehPMAigISxrn7nSud vydQ== 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=DJT1dzs0rA2lb6ZxEiA/GvslNdAfBFWFuffs3fDq6+g=; fh=WR6Fy7kGCroNKSS5jHjX5LaQseGeTC3TD3lkK7gcJQQ=; b=qw4CpiIYvmPqyB6iQDtOQP4p+fFg70Ro0HWMb0n+FPKTgx8G7QJtZeb0ELz41IF2uI suHjnwR7W2Rxgz6K2F4E+TvOYey2whlkAobHXC+WNn3jnfRh7JGmD2AY3idFLHs5eK2D kYFlRR6gd86KsxJyk3ToiUJG6Zmri8NbVSriMwnLalJGyZDxwFz3KAwRmUMqUOrSnVmb Y+KP34TTKztro/ofeoHEKh+8sRcDkKCIul6vrbbcqR7BbHiivUcurCBpK7hUF5iDuOcn rF8ZJWbpYcD180rGaYgNLKtv8/Fe9ASs9pQR92ZXxnxkL9VvheMrlU5QDNNd6Shv44B4 k5Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GEJf0ZU2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id dn16-20020a17090794d000b009b2fa1c02b3si5805689ejc.1036.2023.10.25.08.27.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 08:27:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GEJf0ZU2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 16CC78093480; Wed, 25 Oct 2023 08:27:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343986AbjJYP1B (ORCPT + 99 others); Wed, 25 Oct 2023 11:27:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343827AbjJYP0d (ORCPT ); Wed, 25 Oct 2023 11:26:33 -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 836A3196 for ; Wed, 25 Oct 2023 08:24:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698247467; 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=DJT1dzs0rA2lb6ZxEiA/GvslNdAfBFWFuffs3fDq6+g=; b=GEJf0ZU2E30fAEIkuJCZHyzQ7LY1LQQ6boc4eyh5CIE/eCmZYAFz9QczLi4wc7AblRy9+4 p/qaHTfWGg4/MPYC2crP5C4msloPxOk8dazUlKmXSD1q4kd50YLU4HL53SzLDHSGsZK7fm MU1m4W34m4OJT5linob/3TzlhsFOCtU= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-222-B0mAP7kiPwqGwTY9gHC4Bw-1; Wed, 25 Oct 2023 11:24:23 -0400 X-MC-Unique: B0mAP7kiPwqGwTY9gHC4Bw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 257163827962; Wed, 25 Oct 2023 15:24:23 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.226.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id 397422166B26; Wed, 25 Oct 2023 15:24:22 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson , Maxim Levitsky Cc: linux-kernel@vger.kernel.org Subject: [PATCH 13/14] KVM: nVMX: hyper-v: Hide more stuff under CONFIG_KVM_HYPERV Date: Wed, 25 Oct 2023 17:24:05 +0200 Message-ID: <20231025152406.1879274-14-vkuznets@redhat.com> In-Reply-To: <20231025152406.1879274-1-vkuznets@redhat.com> References: <20231025152406.1879274-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.6 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email 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 (howler.vger.email [0.0.0.0]); Wed, 25 Oct 2023 08:27:15 -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. Reviewed-by: Maxim Levitsky 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 fa04aa38ad52..4777d867419c 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -6642,6 +6642,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 @@ -6651,6 +6652,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 27411665bef9..6e0ff015c5ff 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -4826,7 +4826,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