Received: by 10.223.185.116 with SMTP id b49csp2082531wrg; Sun, 4 Mar 2018 18:00:59 -0800 (PST) X-Google-Smtp-Source: AG47ELsv7u3wG2EXlkEctnpszmiSx5N4pBEnkV90SzkSyEApUdpkWeocHsBnX/hyWP548KMnkIAE X-Received: by 2002:a17:902:7686:: with SMTP id m6-v6mr11778710pll.199.1520215259503; Sun, 04 Mar 2018 18:00:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520215259; cv=none; d=google.com; s=arc-20160816; b=sfNp363ouPlx+VheFuO/RFyvZ8PNC+keaQzQr4dIun3lDWJAORnH9NlhJtFI4IvK1b qRy3uUEwSPd42K6xkFOH8Mj7DmHuF97ldWtHmCWPJ4JoXBhy90+DJ9wq87aIvenZtL/v KqnLYO6gO88ejGUZlQZs5gktYZPSvMLCJVcgUyTvQDGpw4viE7Yo0HC1HCVdoiep2VCK Zx/5dTSjq64+RXgFTqpkFCk1wzEU9NAibxqH+i0hDgq/4y1MilYDxcVFa8Fd4HKxLjP/ fafWSI1BA1SKLiwrHLhnSqR9sx3U9uIi1N2+JYv6huovaK6rDOt7XdrgLTknrAzsOGZH j8/w== 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=QECcpKbKdOJE/kxzU72GmTSi2EqkZYoD23VgT0J47Do=; b=QcCcWdbfSPa9ThiUv3OMMYD4WtMsH8vBPnkuVfNZtyFdUTOcnD4D9VIwQzqX/iPUq9 zk8GsVeVXsQua1LxQvYVKT2HZpUJXcWotAAd+OqzmRjlJSQmY+SxFiu+VH1oR4axHrjk AQJr4LaaavJwetHRyqzZVbvlmjd2+GoaKYfOTep+2DXsPXBhBD53djV3D03+3fzEw1aJ GWJ7oBuAaj9YjFTtk1IFDvAtqRKIy3I+vHFaHnXl86I0LVTFd7rhw/OPggsiMbRykpTf zZvFwQBkkmN4nUFG0S9gQeC0ni/Oz8m1fQBVkn4hnCCcevR4y5dNzgKOByhYX1Ml/DAa Bmqg== 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 w9si1998651pgq.815.2018.03.04.18.00.45; Sun, 04 Mar 2018 18:00:59 -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 S932472AbeCEB4z (ORCPT + 99 others); Sun, 4 Mar 2018 20:56:55 -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 S932119AbeCEB4v (ORCPT ); Sun, 4 Mar 2018 20:56:51 -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:56:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,425,1515484800"; d="scan'208";a="21986047" Received: from vmm.bj.intel.com ([10.238.135.172]) by fmsmga008.fm.intel.com with ESMTP; 04 Mar 2018 17:56:48 -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 01/11] perf/x86/intel/pt: Move Intel-PT MSR bit definitions to a public header Date: Sun, 4 Mar 2018 20:07:11 +0800 Message-Id: <1520165241-15819-2-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 Intel Processor Trace virtualization enabling in guest need to use these MSR bits, so move them to public header msr-index.h. Introduce RTIT_CTL_FABRIC_EN and sync the definitions to latest spec. Signed-off-by: Chao Peng Signed-off-by: Luwei Kang --- arch/x86/events/intel/pt.c | 4 ++-- arch/x86/events/intel/pt.h | 37 ------------------------------------- arch/x86/include/asm/msr-index.h | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c index 81fd41d..6d6dd4f 100644 --- a/arch/x86/events/intel/pt.c +++ b/arch/x86/events/intel/pt.c @@ -271,7 +271,7 @@ static int __init pt_pmu_hw_init(void) return ret; } -#define RTIT_CTL_CYC_PSB (RTIT_CTL_CYCLEACC | \ +#define RTIT_CTL_CYC_PSB (RTIT_CTL_CYC_EN | \ RTIT_CTL_CYC_THRESH | \ RTIT_CTL_PSB_FREQ) @@ -293,7 +293,7 @@ static int __init pt_pmu_hw_init(void) #define PT_CONFIG_MASK (RTIT_CTL_TRACEEN | \ RTIT_CTL_TSC_EN | \ - RTIT_CTL_DISRETC | \ + RTIT_CTL_DIS_RETC | \ RTIT_CTL_BRANCH_EN | \ RTIT_CTL_CYC_PSB | \ RTIT_CTL_MTC | \ diff --git a/arch/x86/events/intel/pt.h b/arch/x86/events/intel/pt.h index 0eb41d0..0050ca1 100644 --- a/arch/x86/events/intel/pt.h +++ b/arch/x86/events/intel/pt.h @@ -20,43 +20,6 @@ #define __INTEL_PT_H__ /* - * PT MSR bit definitions - */ -#define RTIT_CTL_TRACEEN BIT(0) -#define RTIT_CTL_CYCLEACC BIT(1) -#define RTIT_CTL_OS BIT(2) -#define RTIT_CTL_USR BIT(3) -#define RTIT_CTL_PWR_EVT_EN BIT(4) -#define RTIT_CTL_FUP_ON_PTW BIT(5) -#define RTIT_CTL_CR3EN BIT(7) -#define RTIT_CTL_TOPA BIT(8) -#define RTIT_CTL_MTC_EN BIT(9) -#define RTIT_CTL_TSC_EN BIT(10) -#define RTIT_CTL_DISRETC BIT(11) -#define RTIT_CTL_PTW_EN BIT(12) -#define RTIT_CTL_BRANCH_EN BIT(13) -#define RTIT_CTL_MTC_RANGE_OFFSET 14 -#define RTIT_CTL_MTC_RANGE (0x0full << RTIT_CTL_MTC_RANGE_OFFSET) -#define RTIT_CTL_CYC_THRESH_OFFSET 19 -#define RTIT_CTL_CYC_THRESH (0x0full << RTIT_CTL_CYC_THRESH_OFFSET) -#define RTIT_CTL_PSB_FREQ_OFFSET 24 -#define RTIT_CTL_PSB_FREQ (0x0full << RTIT_CTL_PSB_FREQ_OFFSET) -#define RTIT_CTL_ADDR0_OFFSET 32 -#define RTIT_CTL_ADDR0 (0x0full << RTIT_CTL_ADDR0_OFFSET) -#define RTIT_CTL_ADDR1_OFFSET 36 -#define RTIT_CTL_ADDR1 (0x0full << RTIT_CTL_ADDR1_OFFSET) -#define RTIT_CTL_ADDR2_OFFSET 40 -#define RTIT_CTL_ADDR2 (0x0full << RTIT_CTL_ADDR2_OFFSET) -#define RTIT_CTL_ADDR3_OFFSET 44 -#define RTIT_CTL_ADDR3 (0x0full << RTIT_CTL_ADDR3_OFFSET) -#define RTIT_STATUS_FILTEREN BIT(0) -#define RTIT_STATUS_CONTEXTEN BIT(1) -#define RTIT_STATUS_TRIGGEREN BIT(2) -#define RTIT_STATUS_BUFFOVF BIT(3) -#define RTIT_STATUS_ERROR BIT(4) -#define RTIT_STATUS_STOPPED BIT(5) - -/* * Single-entry ToPA: when this close to region boundary, switch * buffers to avoid losing data. */ diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index c9084de..c1fb2d2 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -106,7 +106,43 @@ #define MSR_PEBS_LD_LAT_THRESHOLD 0x000003f6 #define MSR_IA32_RTIT_CTL 0x00000570 +#define RTIT_CTL_TRACEEN BIT(0) +#define RTIT_CTL_CYC_EN BIT(1) +#define RTIT_CTL_OS BIT(2) +#define RTIT_CTL_USR BIT(3) +#define RTIT_CTL_PWR_EVT_EN BIT(4) +#define RTIT_CTL_FUP_ON_PTW BIT(5) +#define RTIT_CTL_FABRIC_EN BIT(6) +#define RTIT_CTL_CR3_FILTER BIT(7) +#define RTIT_CTL_TOPA BIT(8) +#define RTIT_CTL_MTC_EN BIT(9) +#define RTIT_CTL_TSC_EN BIT(10) +#define RTIT_CTL_DIS_RETC BIT(11) +#define RTIT_CTL_PTW_EN BIT(12) +#define RTIT_CTL_BRANCH_EN BIT(13) +#define RTIT_CTL_MTC_RANGE_OFFSET 14 +#define RTIT_CTL_MTC_RANGE (0x0full << RTIT_CTL_MTC_RANGE_OFFSET) +#define RTIT_CTL_CYC_THRESH_OFFSET 19 +#define RTIT_CTL_CYC_THRESH (0x0full << RTIT_CTL_CYC_THRESH_OFFSET) +#define RTIT_CTL_PSB_FREQ_OFFSET 24 +#define RTIT_CTL_PSB_FREQ (0x0full << RTIT_CTL_PSB_FREQ_OFFSET) +#define RTIT_CTL_ADDR0_OFFSET 32 +#define RTIT_CTL_ADDR0 (0x0full << RTIT_CTL_ADDR0_OFFSET) +#define RTIT_CTL_ADDR1_OFFSET 36 +#define RTIT_CTL_ADDR1 (0x0full << RTIT_CTL_ADDR1_OFFSET) +#define RTIT_CTL_ADDR2_OFFSET 40 +#define RTIT_CTL_ADDR2 (0x0full << RTIT_CTL_ADDR2_OFFSET) +#define RTIT_CTL_ADDR3_OFFSET 44 +#define RTIT_CTL_ADDR3 (0x0full << RTIT_CTL_ADDR3_OFFSET) #define MSR_IA32_RTIT_STATUS 0x00000571 +#define RTIT_STATUS_FILTEREN BIT(0) +#define RTIT_STATUS_CONTEXTEN BIT(1) +#define RTIT_STATUS_TRIGGEREN BIT(2) +#define RTIT_STATUS_BUFFOVF BIT(3) +#define RTIT_STATUS_ERROR BIT(4) +#define RTIT_STATUS_STOPPED BIT(5) +#define RTIT_STATUS_BYTECNT_OFFSET 32 +#define RTIT_STATUS_BYTECNT (0x1ffffull << RTIT_STATUS_BYTECNT_OFFSET) #define MSR_IA32_RTIT_ADDR0_A 0x00000580 #define MSR_IA32_RTIT_ADDR0_B 0x00000581 #define MSR_IA32_RTIT_ADDR1_A 0x00000582 @@ -115,6 +151,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 -- 1.8.3.1