Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp255209pxt; Fri, 6 Aug 2021 00:53:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIbGEMymn97kmtmRuYM3/Cl4yvLgyZYf/ZQuEYQWw/jjM/EheBH7OPAShRSMf4BUZXYl37 X-Received: by 2002:a17:906:8248:: with SMTP id f8mr8795757ejx.229.1628236423108; Fri, 06 Aug 2021 00:53:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628236423; cv=none; d=google.com; s=arc-20160816; b=LBDoMwq/RRHBN10lPKnQL+0P3pPbwuAT3gyxhSexiMnbQsoTgAadvRJa08dY2EwBPz DZM2V/F0FNORUU0+d+YsvwW6hc/SCpvrpSpo6XoCcLXsWGmVMaHsQaLaGD30oEgpF1t2 +u08FrQpPOGdfFFmJtkXxj8RpbwnYAu3tACIvAmH7V238CTHFXPlxbgMYV+/EyMXd1/d uPrzlyQ6MxQ6mMuT+uwTdepgMftIZJg11EeB3NmiSOohs4a+xbUNruYd/Y/gkGB1VfW7 xW7jRf11ZC1o/2VBh/3NIlpwOXSKZv2l73WOFMtlM6aynJBABMkQEgKmMej54qygtw15 jnTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=BFjjZBpJMTpkSN/UwVR/wamUn3IaUQJY8QSU+IZnKBU=; b=rltt9Sn91iemvZkApdf5pXQvpDXi0U4nhwLwcwSoN/e7TF6jBS9d6OKj0/oj59x2vf wgHpW1jGeZDVxxgNXyxPQAdimgijKlPjvqPkLOx78e0BK0oAifhFpI8ABsLyPfy9InPG 7sGB0dA1gWolvJh7X/T9s6+OIlJh9+mPm+drgwC7mORwllQ4I1zmVx/N1oV8eQLhnF+E NSHb3WgcRoCezODfPjdUuoRGq7UTU5tWp7QgDxBKclHfYVocQXSgDPHsyBG/XWvNOdh/ uUsH3wDiiUvfWYSO9+dNNgHsumCAlPmDIGG7GWyU/HK7J6XA69PQFL3a3tD3R81T5EqA t4JA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ji2si7961260ejc.344.2021.08.06.00.53.20; Fri, 06 Aug 2021 00:53:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243272AbhHFGVJ (ORCPT + 99 others); Fri, 6 Aug 2021 02:21:09 -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 >>