Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp792975pxb; Tue, 12 Apr 2022 13:36:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2rVPoZmkq1dZW7MFJ3IKqJn1ej+DRpC7Gk5DQ9lH5WO6j/Y8xH2HwmD6VBFYQD4GSBmDf X-Received: by 2002:a05:6a00:1307:b0:4b0:b1c:6fd9 with SMTP id j7-20020a056a00130700b004b00b1c6fd9mr6289504pfu.27.1649795793468; Tue, 12 Apr 2022 13:36:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649795793; cv=none; d=google.com; s=arc-20160816; b=WDI5HiEiGkMCtA3qCrrWnv/ANVGaN++3B6Is6hvcFgIIcZzZv4jBCacYOPWR3sIW6a 2rCQ19iR8K+c61B8ZSHhqKCyjjq4wudLn+J1sRpcOby2RsUq/iJafMXGqQGA6yEUxg0k AeOSc0+wk84LF3QuJCO3sKKTIFVc4vc03yPKVwcngVrmMNUR8mqLU+D1luHrWlpigpOI rvD0Wkd4bTzv2j2tePRON2B8yRfsOAxCnFFxg7HEwvWJC+E02OEcartRwPqx7yj0/Q52 kLkjlUg+ZoEjRJlPL8lbaJ9KaznbWv/igjG5fy/W5YT3rg6f/KwTCEjmsk23hIW3z04U OGkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=sOEy7vBFvRbkBcV0Pw3Sg2v4q84EAy4DNofmZg1ItIA=; b=YR4+kKmcMXBbqKCu/NMfLYYTXmBtRe7ZDSlJOuuSL4hnKClAA/E1xf6Xsd8/0rbXJh QQJb9E4sUTsR1yscIeAWGOp41lvqbyn52JaK7KTDwwEGbIZjieFgVM2HNPHXsfwo1/Dx Yre9rFwO7bQ/7tnM4E0yfXTYA1A5kWedV9ZxAGJiQmG686RaCaswE0FSE3mlbwFAHl0b N/7xXrmtbF1cEyOp78pU9rgCzyMuq5b9wbijCZ7eEKZb06lh/6sdjzWQI5z4Qh8Nnn2h LuDYNEmLV6VgQ9zra7WijtpMOoAE+M2A3G3REItWTwF8RsvJaK2vqEaaSOFgE+Yk6OGZ Uuig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=iCb4GzRi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i11-20020a170902c94b00b001570e00e0cesi5360855pla.536.2022.04.12.13.36.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 13:36:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=iCb4GzRi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 919D885653; Tue, 12 Apr 2022 13:10:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344504AbiDKJj0 (ORCPT + 99 others); Mon, 11 Apr 2022 05:39:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344580AbiDKJjW (ORCPT ); Mon, 11 Apr 2022 05:39:22 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8D91403F4; Mon, 11 Apr 2022 02:36:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649669812; x=1681205812; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=1FfTghodE/lp1El9D6x6y9QyfhA09HoGqoypZzcTnLQ=; b=iCb4GzRist2FdOYlDLFyChvR074jP3KG0FBaNZoshgaqtyolEzFJgjSG mkNxBQkzqecGgpacY/lMbPJZJT2Zd4UWS1BYVFaaCHxRTXiwoPNFocFmX 6Cv5fZ1fJlFsg03cnZqvnhhFdxWIF9V/qeHHnke/WmcL6XYn7/tM5O+5i 9egbUI86RxyzR48UkvdbtaCkOvFmL16eYCzmnSQt8g79v0cS22qaX4Ibv RpR5xQM864Ek+qYz2e7Yl4by+q0rsPRWTOpuAv1sPwxrBU9+T4L3dThu0 JZ1XSsmQGebr9fAkT7vC/E4GCB6U99CjyT2lZ1tq45w4tfgjNJJgORXBM Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10313"; a="260923467" X-IronPort-AV: E=Sophos;i="5.90,251,1643702400"; d="scan'208";a="260923467" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Apr 2022 02:36:52 -0700 X-IronPort-AV: E=Sophos;i="5.90,251,1643702400"; d="scan'208";a="572050495" Received: from arthur-vostro-3668.sh.intel.com ([10.239.13.120]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Apr 2022 02:36:46 -0700 From: Zeng Guang To: Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, Dave Hansen , Tony Luck , Kan Liang , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Kim Phillips , Jarkko Sakkinen , Jethro Beekman , Kai Huang Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Robert Hu , Gao Chao , Zeng Guang , Robert Hoo Subject: [PATCH v8 4/9] KVM: VMX: Report tertiary_exec_control field in dump_vmcs() Date: Mon, 11 Apr 2022 17:04:42 +0800 Message-Id: <20220411090447.5928-5-guang.zeng@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220411090447.5928-1-guang.zeng@intel.com> References: <20220411090447.5928-1-guang.zeng@intel.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Robert Hoo Add tertiary_exec_control field report in dump_vmcs(). Meanwhile, reorganize the dump output of VMCS category as follows. Before change: *** Control State *** PinBased=0x000000ff CPUBased=0xb5a26dfa SecondaryExec=0x061037eb EntryControls=0000d1ff ExitControls=002befff After change: *** Control State *** CPUBased=0xb5a26dfa SecondaryExec=0x061037eb TertiaryExec=0x0000000000000010 PinBased=0x000000ff EntryControls=0000d1ff ExitControls=002befff Reviewed-by: Maxim Levitsky Signed-off-by: Robert Hoo Signed-off-by: Zeng Guang --- arch/x86/kvm/vmx/vmx.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 961e61044341..f439abd52bad 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -5867,6 +5867,7 @@ void dump_vmcs(struct kvm_vcpu *vcpu) struct vcpu_vmx *vmx = to_vmx(vcpu); u32 vmentry_ctl, vmexit_ctl; u32 cpu_based_exec_ctrl, pin_based_exec_ctrl, secondary_exec_control; + u64 tertiary_exec_control; unsigned long cr4; int efer_slot; @@ -5880,9 +5881,16 @@ void dump_vmcs(struct kvm_vcpu *vcpu) cpu_based_exec_ctrl = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL); pin_based_exec_ctrl = vmcs_read32(PIN_BASED_VM_EXEC_CONTROL); cr4 = vmcs_readl(GUEST_CR4); - secondary_exec_control = 0; + if (cpu_has_secondary_exec_ctrls()) secondary_exec_control = vmcs_read32(SECONDARY_VM_EXEC_CONTROL); + else + secondary_exec_control = 0; + + if (cpu_has_tertiary_exec_ctrls()) + tertiary_exec_control = vmcs_read64(TERTIARY_VM_EXEC_CONTROL); + else + tertiary_exec_control = 0; pr_err("VMCS %p, last attempted VM-entry on CPU %d\n", vmx->loaded_vmcs->vmcs, vcpu->arch.last_vmentry_cpu); @@ -5982,9 +5990,10 @@ void dump_vmcs(struct kvm_vcpu *vcpu) vmx_dump_msrs("host autoload", &vmx->msr_autoload.host); pr_err("*** Control State ***\n"); - pr_err("PinBased=%08x CPUBased=%08x SecondaryExec=%08x\n", - pin_based_exec_ctrl, cpu_based_exec_ctrl, secondary_exec_control); - pr_err("EntryControls=%08x ExitControls=%08x\n", vmentry_ctl, vmexit_ctl); + pr_err("CPUBased=0x%08x SecondaryExec=0x%08x TertiaryExec=0x%016llx\n", + cpu_based_exec_ctrl, secondary_exec_control, tertiary_exec_control); + pr_err("PinBased=0x%08x EntryControls=%08x ExitControls=%08x\n", + pin_based_exec_ctrl, vmentry_ctl, vmexit_ctl); pr_err("ExceptionBitmap=%08x PFECmask=%08x PFECmatch=%08x\n", vmcs_read32(EXCEPTION_BITMAP), vmcs_read32(PAGE_FAULT_ERROR_CODE_MASK), -- 2.27.0