From 198a650fca26195a3c069b2dd7ec74a17ed0f15c Mon Sep 17 00:00:00 2001
From: Luming Yu <luming.yu@intel.com>
Date: Fri, 29 Sep 2017 22:10:03 +0800
Subject: [PATCH v1 7/9] early pt: enable early pt psb packet

enable PSB packet

Signed-off-by: Luming Yu <luming.yu@intel.com>
---
 arch/x86/events/intel/early_pt.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/x86/events/intel/early_pt.c b/arch/x86/events/intel/early_pt.c
index 01570d2..645d2ca 100644
--- a/arch/x86/events/intel/early_pt.c
+++ b/arch/x86/events/intel/early_pt.c
@@ -57,6 +57,7 @@ static unsigned mtc_freq_mask = 0;
 static unsigned addr_range_num = 0;
 
 static int mtc_freq = 0;
+static int psb_freq = 0;
 
 static unsigned long pt_addr0_start = 0, pt_addr0_end = 0;
 static unsigned long pt_addr1_start = 0, pt_addr1_end = 0;
@@ -202,6 +203,9 @@ static int start_early_pt(void *arg)
 	if (mtc_freq && ((1U << (mtc_freq - 1)) & mtc_freq_mask))
 		val |= ((mtc_freq - 1) << 14) | MTC_EN;
 
+	if (psb_freq && ((1U << (psb_freq - 1)) & psb_freq_mask))
+		val |= (psb_freq -1) << 24;
+
 	if (wrmsrl_safe(MSR_IA32_RTIT_CTL, val) < 0) {
 		pr_info("early_pt start failed on cpu[%d]\n", cpu);
 		__this_cpu_write(early_pt_running, false);
@@ -413,3 +417,10 @@ static int __init early_pt_mtc_freq_setup(char *arg)
 	return 0;
 }
 early_param("mtc_freq", early_pt_mtc_freq_setup);
+
+static int __init early_pt_psb_freq_setup(char *arg)
+{
+	sscanf(arg, "%d", &psb_freq);
+	return 0;
+}
+early_param("psb_freq", early_pt_psb_freq_setup);
-- 
2.7.5

