Received: by 10.223.185.116 with SMTP id b49csp2080791wrg; Sun, 4 Mar 2018 17:58:21 -0800 (PST) X-Google-Smtp-Source: AG47ELvi1UAUBgWWa2YId3cd5ECQ7/E/0z2hGP4ZSKVXCaTZx9DsCtG1ZnASyOQHcQnAXI3DgrDv X-Received: by 10.98.86.151 with SMTP id h23mr13513741pfj.79.1520215101602; Sun, 04 Mar 2018 17:58:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520215101; cv=none; d=google.com; s=arc-20160816; b=YWK5h1v5y3g92gA+As/kktbGhr9dlshsSJFhi3X6YNfylp4n/RSWM0iPcV85vKpdii zy4G8p2kA1fZFYMsIfyHpHr78vlj8PO3uUkM4ehq3bRJlHYwToAjedQT9+fop33QqSPg GjV875QgfkVuPWBUUanrHJ/Np7IzzMLx/8uOAC1YIXOpOf+VtzVcABCnYTCFKgldOEbK ixtKhW0UeNfHTmBVBqTaOnX0oIRBpw5vU5Z5AfAMR6C0bSjvubTaVfUHJP4ZhS6szNDi zDa2bbAgBwPlZv9MXW/S2wUySyUgU25HTfZk7MKEhE2J2YVIZ5ckUlJG1VTOnmQxJ4gn gPXQ== 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=4Vdm1vOp72CGDAgjWQ01sbKvfn34Bcx9u+L8j/VK4ZI=; b=NQOE8cM6omyomby7FJ1OG3i4BnTRlmbFF44NNWZbfbMUg6BHxd5KIUG+pT86xxM+1m Av9m2v8BOMaVaRwcgNnJwB1yt4d8ltBTYjZvkfRsUGrSzJeKDXg4oeJhYyVx/+3Dkv5S W/EQ8hSAIY4xXRpViDCdFaBLLp8VOYUuMHyg94cJyEcmmZMGrSyt+6bU3rhcmpqTR/hP 2viDB1tiIEFtzU3Ul8kZiqsYZJL0fCECeWCae2NIuetkpbmJ/mXJVGQ+ZOZfWBkNMK3M KudwCiVqDidxbCjSZ9rCh21FctVkNStic12pb0/RfDbfcLt5WhYKgwq1MaHfniZ0jKuV o7tg== 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 h3-v6si8540180plb.725.2018.03.04.17.58.07; Sun, 04 Mar 2018 17:58:21 -0800 (PST) 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 S932637AbeCEB5Q (ORCPT + 99 others); Sun, 4 Mar 2018 20:57:16 -0500 Received: from mga14.intel.com ([192.55.52.115]:39574 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932119AbeCEB5H (ORCPT ); Sun, 4 Mar 2018 20:57:07 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Mar 2018 17:57:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,425,1515484800"; d="scan'208";a="21986085" Received: from vmm.bj.intel.com ([10.238.135.172]) by fmsmga008.fm.intel.com with ESMTP; 04 Mar 2018 17:57:04 -0800 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 v5 06/11] KVM: x86: Add Intel processor trace context for each vcpu Date: Sun, 4 Mar 2018 20:07:16 +0800 Message-Id: <1520165241-15819-7-git-send-email-luwei.kang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520165241-15819-1-git-send-email-luwei.kang@intel.com> References: <1520165241-15819-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 7a0e48c..3d0de12 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -589,6 +589,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; @@ -685,6 +702,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