Received: by 10.192.165.148 with SMTP id m20csp1659200imm; Thu, 3 May 2018 03:20:09 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrvtlHvRzBymsx/OCNcE/mjzRgm63hTqa2uu+V5g5PgHEqYZ2kGtCrGBY0NdfV8jsTnKMcq X-Received: by 10.98.19.6 with SMTP id b6mr22124896pfj.58.1525342809778; Thu, 03 May 2018 03:20:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525342809; cv=none; d=google.com; s=arc-20160816; b=LxI/wWIP1NozFEOSe1LxErlxU8gMGo+9FMNTBwsNv22/pwcRc7Ta6nNYEWO3hvH0QE klt78FsC/udoYPkmtjPPv6jdjbM7i3gKQbRD9kwCVAzARsgEap6uye1eEc3OrfoKApP7 VWnDeKxfPbY/QY02zVH+3hihQ00hDGWCLfniPrJvc/ukf/Dl3ehO7Q0OLhmRIjIpaFbO qdyI1+ZrWUhJTvUGqg/p59e4lzrUJiyWNTCq6y5baJjYH54YZU6KL2bZC2BRlV84IbS/ jufAZw0TvTGZ6dl7hkZvgs2xUbO02xDPIOSYnVnQxEVyPqG36dTynTRWmjaHxys5O9QL Sjdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=jo6R8/49aJTRwlI2ZsBiCidDDFOwYAsydIOKd3g9I9A=; b=LmQd610w9xmxek237Qw+Owf23yKiq9JVvsIrDGL1lwQ5ZJu3r6Kr+RkDlyDrCcNBf2 8b17OihIRuaLqaxcaZ7resTFhKInsCqPydLmxhSjP1auP8w9/OiiHiQYuWVasdwcOKar lXHsJLS/KxghtX1iI+Eamwdi9CndD1HNqcjqpzamycpjCIAz6kELPq3VODvUNGjv8+A2 Gg9cNV1RTOdJyAvdb2yF1AEMv/E7IYuiZFVzZ2ifNiB4swm5DDb+XDYC8S0mQX5FhOk+ 3feeygoNQLBZ23AGwzYAErr62ONAHhglDHmFvQNGpCcODvKlvGoGkD6TCB1Gc7nJ4pcz FUqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p83si13609951pfl.279.2018.05.03.03.19.55; Thu, 03 May 2018 03:20:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752304AbeECKTb (ORCPT + 99 others); Thu, 3 May 2018 06:19:31 -0400 Received: from mga06.intel.com ([134.134.136.31]:65500 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752244AbeECKTX (ORCPT ); Thu, 3 May 2018 06:19:23 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 May 2018 03:19:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,358,1520924400"; d="scan'208";a="36546539" Received: from unknown (HELO skx-d.bj.intel.com) ([10.238.154.68]) by fmsmga007.fm.intel.com with ESMTP; 03 May 2018 03:19:20 -0700 From: Luwei Kang To: kvm@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, pbonzini@redhat.com, rkrcmar@redhat.com, linux-kernel@vger.kernel.org, joro@8bytes.org, peterz@infradead.org, chao.p.peng@linux.intel.com, Luwei Kang Subject: [PATCH v7 08/13] KVM: x86: Add Intel processor trace context for each vcpu Date: Thu, 3 May 2018 20:13:23 +0800 Message-Id: <1525349608-10352-9-git-send-email-luwei.kang@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525349608-10352-1-git-send-email-luwei.kang@intel.com> References: <1525349608-10352-1-git-send-email-luwei.kang@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chao Peng Add a data structure to save Intel Processor Trace context. It mainly include the value of Intel PT host/guest MSRs and guest CPUID information. Signed-off-by: Chao Peng Signed-off-by: Luwei Kang --- arch/x86/kvm/vmx.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 27cf417..9a5c26d 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -597,6 +597,23 @@ static inline int pi_test_sn(struct pi_desc *pi_desc) (unsigned long *)&pi_desc->control); } +struct pt_ctx { + u64 ctl; + u64 status; + u64 output_base; + u64 output_mask; + u64 cr3_match; + u64 addrs[MSR_IA32_RTIT_ADDR_COUNT]; +}; + +struct pt_desc { + u64 ctl_bitmask; + u32 range_cnt; + u32 caps[PT_CPUID_REGS_NUM * PT_CPUID_LEAVES]; + struct pt_ctx host; + struct pt_ctx guest; +}; + struct vcpu_vmx { struct kvm_vcpu vcpu; unsigned long host_rsp; @@ -693,6 +710,8 @@ struct vcpu_vmx { */ u64 msr_ia32_feature_control; u64 msr_ia32_feature_control_valid_bits; + + struct pt_desc pt_desc; }; enum segment_cache_field { -- 1.8.3.1