Received: by 10.223.164.202 with SMTP id h10csp2844465wrb; Tue, 28 Nov 2017 02:12:03 -0800 (PST) X-Google-Smtp-Source: AGs4zMaHmg3Ce0j9xpnGMpdoCW3aEiLfbYTZThV39b/T7EvO5JBr5VhHhJbvup764SmEFEA18Q3r X-Received: by 10.84.168.226 with SMTP id f89mr42185225plb.176.1511863923823; Tue, 28 Nov 2017 02:12:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511863923; cv=none; d=google.com; s=arc-20160816; b=Rcp+dKwmRz6UFUSFb56p49zssgIXoul7iCgQJx5lHlABBJ8QjYCPoD1ZM79xOhepG0 NJAISmsHejNGxNbJTQV7+GIaY4dRgPvN48lkYBH60Q/2dt9Vvq5vYLxvA0yJgytxszR0 0k8ulFe6DBnUkw4JAdqof7Yh4xiXbkBgwaZRAEjRvkwVvNofU+cn0TYA5d1wf7eWHlBA /Z2e0svor6qmBFyMLCGJrrLlYwx0dvYmuhzF1vWjBu5MYzpI5K4GeNiJ2uHdlh1cO2zX SuprLg0HjQ1VzLcD4STMW1wmGP3O3lC6ZHFdtJobe9xSw7tf4jj1vnWe2teFwKa0YGjz Wm3g== 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=C0/tdMn0Q4rFU8jsburKOPWS5j/wzmQKwo8TpeYuWNQ=; b=aamXvZ+mbOvkKyQl4jOGl+QtDy/Xy6hjzDuzS5SOUAlu7xHIMvBaNKByBz2AvS56fj nTcT/sQ7Rc64nn0GxEVL239Rz8KdcpdTk3Z9NAI4cezu+pY4dhaxQv9reyF4a154A0vi sZDvOG8S63f3plsAoY6XzQY2p+Z2eyNzFW4MiH3oti67OODFokzzBuoOdA7+vdsyfR9j yf93piLJ8mWM2SDJD1RWBd2QBcnp8S8FBubMYyweT+WUX0neRpmt6+La0SVF8T4Q3Oqt w+GiwBYv6+gOJEtOaO8OVlyPcgQljswWf2r+dxzKkMlO5BruOeQrN1adXoocSv9rRBin L6YQ== 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 t11si24009991pgn.282.2017.11.28.02.11.51; Tue, 28 Nov 2017 02:12:03 -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 S1752523AbdK1KJg (ORCPT + 78 others); Tue, 28 Nov 2017 05:09:36 -0500 Received: from mga01.intel.com ([192.55.52.88]:59069 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752118AbdK1KJd (ORCPT ); Tue, 28 Nov 2017 05:09:33 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Nov 2017 02:09:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,467,1505804400"; d="scan'208";a="7939974" Received: from vmm.bj.intel.com ([10.238.135.172]) by fmsmga001.fm.intel.com with ESMTP; 28 Nov 2017 02:09:31 -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 v3 6/9] KVM: x86: Add Intel processor trace context for each vcpu Date: Tue, 28 Nov 2017 04:23:59 +0800 Message-Id: <1511814242-12949-7-git-send-email-luwei.kang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511814242-12949-1-git-send-email-luwei.kang@intel.com> References: <1511814242-12949-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 MSRs related Intel Processor Trace. Signed-off-by: Chao Peng Signed-off-by: Luwei Kang --- arch/x86/include/asm/msr-index.h | 1 + arch/x86/include/asm/vmx.h | 2 ++ arch/x86/kvm/vmx.c | 17 +++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index fd98ef0..03ffde6 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -136,6 +136,7 @@ #define MSR_IA32_RTIT_ADDR2_B 0x00000585 #define MSR_IA32_RTIT_ADDR3_A 0x00000586 #define MSR_IA32_RTIT_ADDR3_B 0x00000587 +#define MSR_IA32_RTIT_ADDR_COUNT 8 #define MSR_IA32_RTIT_CR3_MATCH 0x00000572 #define MSR_IA32_RTIT_OUTPUT_BASE 0x00000560 #define MSR_IA32_RTIT_OUTPUT_MASK 0x00000561 diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h index 27d5d37..9e828d4 100644 --- a/arch/x86/include/asm/vmx.h +++ b/arch/x86/include/asm/vmx.h @@ -240,6 +240,8 @@ enum vmcs_field { GUEST_PDPTR3_HIGH = 0x00002811, GUEST_BNDCFGS = 0x00002812, GUEST_BNDCFGS_HIGH = 0x00002813, + GUEST_IA32_RTIT_CTL = 0x00002814, + GUEST_IA32_RTIT_CTL_HIGH = 0x00002815, HOST_IA32_PAT = 0x00002c00, HOST_IA32_PAT_HIGH = 0x00002c01, HOST_IA32_EFER = 0x00002c02, diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 87a9f52..c10350b 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -581,6 +581,21 @@ 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 { + unsigned int addr_num; + struct pt_ctx host; + struct pt_ctx guest; +}; + struct vcpu_vmx { struct kvm_vcpu vcpu; unsigned long host_rsp; @@ -670,6 +685,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 From 1585312016817141781@xxx Tue Nov 28 12:15:53 +0000 2017 X-GM-THRID: 1585307957782420589 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread