Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp724657iog; Wed, 29 Jun 2022 08:58:05 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tQSOsVWYxi4FtgfY9+Evts43hoE7cn51QZ9HCVNgJqn6MdtWysA0Bs4a23fkpSsjYlb8P7 X-Received: by 2002:a17:90a:fe16:b0:1ec:a69e:d135 with SMTP id ck22-20020a17090afe1600b001eca69ed135mr6587795pjb.31.1656518285701; Wed, 29 Jun 2022 08:58:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656518285; cv=none; d=google.com; s=arc-20160816; b=wWNu6+Gpjnxhaljhn0lYXDqoZeu0+fSj/CHqzVUXsiidyLMZNgFLxF56AJVylulVSt BKdFFS1DEXBcG3DYSVDBpgQK9mmD8MfJpC1NEjWiEIIaPt4byNwfY+83Fw7dIyM4I9tA 2FCpB2SEp3N6lqufKjtN96i2Mp/jL8/iBD9Is0zyqgzfT/YBpL2lH/TUsqwYG6AUdSmd m8N9kzWYJrTrk6aOeCalZvBVFzW2lz6TREBBc9leEiMsNPDwWM0nixNC6L0DsoBWHRkH spBJr8YK1lUmz02/EL9zfI3/L3i5zCse8g8RyVuDQEO1dX3bncrKMrDTHFtL1ZxMjFGr SNWw== 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=qg4VAqoRxLU9S6SiCst12xv/W6F6a5KULdlIKyb1Uj0=; b=urVQZ4/DaOsjekx1yH60xihWSUwpHYpVuJyqviQJPsYc6G/GJLqOvm/g2DihqhP7Wy x0tpk9ylwn1BAxq8Y0qA16r7LyFfLYyPNHUAgZOG17XQpRkd4qEOynKt24mXu+N+l8c3 dogYWgCHNwzEkc1QaZSKbTRfAnJ35N9ZisLLnrh7jim8HSy4/HfbBaDLb3VXG+OOxTBD aioXo+Qd1RNVfwfgFlCIG8L2nkmK1/SM56mLUhQFLKByXYYlWyk4tozkVtJbvdK2Q2tr 37zppRZXR9UK4CXNCSwczw6W0lwFb3NvaFwdfnYBR7eqUZcaBM1MJVLjpxg9bW3s3qZn UilA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SviMFuPC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q8-20020a056a00150800b005253f921dd5si177040pfu.368.2022.06.29.08.57.53; Wed, 29 Jun 2022 08:58:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SviMFuPC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233958AbiF2PIW (ORCPT + 99 others); Wed, 29 Jun 2022 11:08:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233986AbiF2PHV (ORCPT ); Wed, 29 Jun 2022 11:07:21 -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 ESMTP id E03472BB2C for ; Wed, 29 Jun 2022 08:07:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656515238; 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=qg4VAqoRxLU9S6SiCst12xv/W6F6a5KULdlIKyb1Uj0=; b=SviMFuPC5Auo3fCY7E4ixIcRuUXxEKCKvg6SdXX3PdudrV3pTsP9vlykYWLMH67aynwMuA 9PTW6zI8frzDdAc+O4hESBO8m+6BMUTpeQ312Kf25gvmefSs4rkTF2Pf6+cfyjbyVA73I0 qZaBte8MFzlmcyJ6Q6bz2XZU/DtLwFs= 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-244-gkiJ03skMrKmby9IoTycjg-1; Wed, 29 Jun 2022 11:07:13 -0400 X-MC-Unique: gkiJ03skMrKmby9IoTycjg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DDD8B1019C8E; Wed, 29 Jun 2022 15:07:12 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.40.192.126]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B5BD40EC002; Wed, 29 Jun 2022 15:07:10 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson Cc: Anirudh Rayabharam , Wanpeng Li , Jim Mattson , Maxim Levitsky , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 19/28] KVM: VMX: Add missing VMEXIT controls to vmcs_config Date: Wed, 29 Jun 2022 17:06:16 +0200 Message-Id: <20220629150625.238286-20-vkuznets@redhat.com> In-Reply-To: <20220629150625.238286-1-vkuznets@redhat.com> References: <20220629150625.238286-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 As a preparation to reusing the result of setup_vmcs_config() in nested VMX MSR setup, add the VMEXIT controls which KVM doesn't use but supports for nVMX to KVM_OPT_VMX_VM_EXIT_CONTROLS and filter them out in vmx_vmexit_ctrl(). No functional change intended. Signed-off-by: Vitaly Kuznetsov --- arch/x86/kvm/vmx/vmx.c | 4 ++++ arch/x86/kvm/vmx/vmx.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index b1bc85d8744d..e5ab77ed37e4 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -4197,6 +4197,10 @@ static u32 vmx_vmexit_ctrl(void) { u32 vmexit_ctrl = vmcs_config.vmexit_ctrl; + /* Not used by KVM but supported for nesting. */ + vmexit_ctrl &= ~(VM_EXIT_SAVE_IA32_PAT | VM_EXIT_SAVE_IA32_EFER | + VM_EXIT_SAVE_VMX_PREEMPTION_TIMER); + if (vmx_pt_mode_is_system()) vmexit_ctrl &= ~(VM_EXIT_PT_CONCEAL_PIP | VM_EXIT_CLEAR_IA32_RTIT_CTL); diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h index 2a5dbb8330a9..d4503a38735b 100644 --- a/arch/x86/kvm/vmx/vmx.h +++ b/arch/x86/kvm/vmx/vmx.h @@ -499,8 +499,11 @@ static inline u8 vmx_get_rvi(void) #endif #define KVM_OPT_VMX_VM_EXIT_CONTROLS \ (VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL | \ + VM_EXIT_SAVE_IA32_PAT | \ VM_EXIT_LOAD_IA32_PAT | \ + VM_EXIT_SAVE_IA32_EFER | \ VM_EXIT_LOAD_IA32_EFER | \ + VM_EXIT_SAVE_VMX_PREEMPTION_TIMER | \ VM_EXIT_CLEAR_BNDCFGS | \ VM_EXIT_PT_CONCEAL_PIP | \ VM_EXIT_CLEAR_IA32_RTIT_CTL) -- 2.35.3