Received: by 10.213.65.68 with SMTP id h4csp865450imn; Tue, 20 Mar 2018 18:14:03 -0700 (PDT) X-Google-Smtp-Source: AG47ELtFdhMJ6HMS+088rxSEICIgCCQBd9oCAgbWwhpbkSOQ1uCiatCeKSr9wISX7y/MRp1IW2aY X-Received: by 2002:a17:902:b608:: with SMTP id b8-v6mr18862112pls.392.1521594843297; Tue, 20 Mar 2018 18:14:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521594843; cv=none; d=google.com; s=arc-20160816; b=qc2GKwciGQJhDf9C8lMWgXyr4G94RsLYG4e09IJfCb7RWfp6FImqMaAMiX15ORqdva q1Mz3kBkVdeyG9DfIEudisJqpkknRK3OzM3lVb6aRdlvf+F4iZq1GK2mnAuD+xB7i9d6 aYgKKhP1bcBWVYZAGXlLK06XePcJd7xmV4hDExKun37X41Sj/DX/i7yTzekG6qywbzzF wNrkHSsWXrUpBlzJnJffuZQiynliWSQ1sC4SW9LkGeflp08uhkb0Fg6YkzTMGzenLvJn LbLMcd8kh3DZzWPjjyl1mFDbsHOE18ta1jyNLUBpQypwL+reawyi84pPFnSXYtYH50rX Ewvg== 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=78P8iNh3RGJlTXjykLamwXbf74yF0u1k/6091vGSBSQ=; b=qsNd/nVPVHsCgZcX/Fg5E/I/4EqXEEuH0uRsXRBqrInWmHWSO38ZJ1KglWhh0uFLaf od4zmWXi+Lq/ECXJorbhIVRrM8V0KZX2DVj1M7GUhfOfs8lQ/pxPdedMb4OKoAqzAgOU pLcZNjZ2ZAaxXXTsidLFsoeAGC6r2iu6S3WOIChMhs0WM9gCPOs4UCcOBtNq2Rq4EWFx NSSAYISUksys/ZpNvz5giEbOpR0MbSwvUbIncHIDWrWU4VmnuiSZctgkI+RWAN8y4xbf SPKZYA0FeP7VGZgvFsoo15wO0w9wKbuVQve7RkX3ndN13C31FnX24AedVioe86PFT/Q/ moLA== 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 e1-v6si2809694ple.428.2018.03.20.18.13.49; Tue, 20 Mar 2018 18:14:03 -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 S1751983AbeCUBLe (ORCPT + 99 others); Tue, 20 Mar 2018 21:11:34 -0400 Received: from mga09.intel.com ([134.134.136.24]:19664 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751557AbeCUBLU (ORCPT ); Tue, 20 Mar 2018 21:11:20 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Mar 2018 18:11:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,338,1517904000"; d="scan'208";a="39779373" Received: from vmm.bj.intel.com ([10.238.135.172]) by fmsmga001.fm.intel.com with ESMTP; 20 Mar 2018 18:11:18 -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, Chao Peng , Luwei Kang Subject: [PATCH v6 06/11] KVM: x86: Add Intel processor trace context for each vcpu Date: Tue, 20 Mar 2018 19:21:53 +0800 Message-Id: <1521544918-31084-7-git-send-email-luwei.kang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521544918-31084-1-git-send-email-luwei.kang@intel.com> References: <1521544918-31084-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 84c4c6d..940df0e 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -596,6 +596,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; @@ -692,6 +709,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