Received: by 10.192.165.148 with SMTP id m20csp1655810imm; Thu, 3 May 2018 03:16:15 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrLCj8MYbuLI3dW++Cbfw/s/bUITGQfzvJ7pxSXy3d9a75p6cP+YW7R4Vx78fHafSxDlN90 X-Received: by 2002:a17:902:c81:: with SMTP id 1-v6mr23018407plt.126.1525342575117; Thu, 03 May 2018 03:16:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525342575; cv=none; d=google.com; s=arc-20160816; b=BD0wulY8P7FxIbwkF8qmG4QTcTNpX0N2kPXe7Wab+bZnF3R+9MLRO8rl+notxGqmlu 51wHsyZ/46cH0J6SQAfUC5oe+Lgj6B6pCIrj4tBAJ+Nlw8QLAAL4I3sMRIdl6yYhvJ9+ +1zmwxOOHN9zixRsaO2crn561R1JWWT4wcIHR1Uc2QrJd1IkzmPrFQHHVzoZlZoRGTKC BPgXj4KG4DvOHhE4oCTfs0XZrmxb8gD8G06JeP/s4Z8yMOyvX/5tt1RY3aYIrRs9vUTO P067MSDA/FQlMDtUX1SdzYoEyKmQv+f0k6EmQB5roX5wreXJ6+v2fIXAo2r/yhUiUBBu Jx5g== 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=tZlMQvLLO/kQHgpRrUNwr43pGkhKmM0ZqLE0WCCcD1KQle5SzV2j4jbdk4A35hj3JX RwxfLTmJNHv8WqDVwrvRd6BqDfeFPtRTJKwcZQmyTKzVWuHMRMCLZtXSoGym2BmkAozt s7Sfth6qSz3YQ6thc9D6BcfU0PLA/Hj3WSk6deJlGBp3H02QihkQjS6CjFGcsVbVgc8P M/hHQN6sgu9bkyJ74b7dppHr8BeP6xYiFJuDBrNKDF8mPULCu5GMviVnn5vL3yYIUmX3 4h2H1puiCewWR8gF3/I+EvJYASw6kQWbZBEune8j4sKJs5UbCcYJgo2eSWfH+233NBXE 9i/g== 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 89si13535265pfs.362.2018.05.03.03.16.01; Thu, 03 May 2018 03:16:15 -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 S1752152AbeECKPS (ORCPT + 99 others); Thu, 3 May 2018 06:15:18 -0400 Received: from mga03.intel.com ([134.134.136.65]:44397 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751832AbeECKPK (ORCPT ); Thu, 3 May 2018 06:15:10 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 May 2018 03:15:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,358,1520924400"; d="scan'208";a="38109838" Received: from unknown (HELO skx-d.bj.intel.com) ([10.238.154.68]) by orsmga007.jf.intel.com with ESMTP; 03 May 2018 03:15:07 -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:08:38 +0800 Message-Id: <1525349323-9938-9-git-send-email-luwei.kang@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525349323-9938-1-git-send-email-luwei.kang@intel.com> References: <1525349323-9938-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