From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB1A4C4338F for ; Fri, 6 Aug 2021 06:22:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 82B0461164 for ; Fri, 6 Aug 2021 06:22:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243336AbhHFGVL (ORCPT ); Fri, 6 Aug 2021 02:21:11 -0400 Received: from mga05.intel.com ([192.55.52.43]:11288 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229581AbhHFGVG (ORCPT ); Fri, 6 Aug 2021 02:21:06 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10067"; a="299904801" X-IronPort-AV: E=Sophos;i="5.84,299,1620716400"; d="scan'208";a="299904801" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Aug 2021 23:20:51 -0700 X-IronPort-AV: E=Sophos;i="5.84,299,1620716400"; d="scan'208";a="481283967" Received: from zengguan-mobl.ccr.corp.intel.com (HELO [10.238.0.133]) ([10.238.0.133]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Aug 2021 23:20:46 -0700 Subject: Re: [PATCH v3 3/6] KVM: VMX: Detect Tertiary VM-Execution control when setup VMCS config To: Sean Christopherson Cc: Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , "kvm@vger.kernel.org" , Dave Hansen , "Luck, Tony" , Kan Liang , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Kim Phillips , Jarkko Sakkinen , Jethro Beekman , "Huang, Kai" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "Hu, Robert" , "Gao, Chao" , Robert Hoo References: <20210805151317.19054-1-guang.zeng@intel.com> <20210805151317.19054-4-guang.zeng@intel.com> From: Zeng Guang Message-ID: <561628db-6155-8e31-6f07-3c7f18810e65@intel.com> Date: Fri, 6 Aug 2021 14:20:38 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/6/2021 6:35 AM, Sean Christopherson wrote: > On Thu, Aug 05, 2021, Zeng Guang wrote: >> +u64 vmx_tertiary_exec_control(struct vcpu_vmx *vmx) > Make this static and drop the declaration from vmx.h, there's no nested user (yet), > and I'm also working on a patch to rework how prepare_vmcs02_early() gets KVMs > desires without having to call these heleprs, i.e. I want to bury all of these in > vmx.c. OK. Thus it could be static. >> +{ >> + return vmcs_config.cpu_based_3rd_exec_ctrl; >> +} >> + >> /* >> * Adjust a single secondary execution control bit to intercept/allow an >> * instruction in the guest. This is usually done based on whether or not a >> @@ -4319,6 +4354,9 @@ static void init_vmcs(struct vcpu_vmx *vmx) >> secondary_exec_controls_set(vmx, vmx->secondary_exec_control); >> } >> >> + if (cpu_has_tertiary_exec_ctrls()) >> + tertiary_exec_controls_set(vmx, vmx_tertiary_exec_control(vmx)); >> + >> if (kvm_vcpu_apicv_active(&vmx->vcpu)) { >> vmcs_write64(EOI_EXIT_BITMAP0, 0); >> vmcs_write64(EOI_EXIT_BITMAP1, 0); >> diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h >> index 945c6639ce24..448006bd8fa7 100644 >> --- a/arch/x86/kvm/vmx/vmx.h >> +++ b/arch/x86/kvm/vmx/vmx.h >> @@ -478,6 +478,7 @@ static inline u32 vmx_vmexit_ctrl(void) >> >> u32 vmx_exec_control(struct vcpu_vmx *vmx); >> u32 vmx_pin_based_exec_ctrl(struct vcpu_vmx *vmx); >> +u64 vmx_tertiary_exec_control(struct vcpu_vmx *vmx); >> >> static inline struct kvm_vmx *to_kvm_vmx(struct kvm *kvm) >> { >> -- >> 2.25.1 >>