Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Jan 2012 07:33:07 +0000 (UTC)
From:      Fabien Thomas <fabient@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r229469 - head/sys/dev/hwpmc
Message-ID:  <201201040733.q047X7wK066297@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: fabient
Date: Wed Jan  4 07:33:06 2012
New Revision: 229469
URL: http://svn.freebsd.org/changeset/base/229469

Log:
  Add missing MSR programming for some events.
  
  Submitted by:	Davide Italiano <davide.italiano@gmail.com>
  MFC after:	3 days

Modified:
  head/sys/dev/hwpmc/hwpmc_uncore.c
  head/sys/dev/hwpmc/hwpmc_uncore.h
  head/sys/dev/hwpmc/pmc_events.h

Modified: head/sys/dev/hwpmc/hwpmc_uncore.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_uncore.c	Wed Jan  4 07:25:10 2012	(r229468)
+++ head/sys/dev/hwpmc/hwpmc_uncore.c	Wed Jan  4 07:33:06 2012	(r229469)
@@ -545,8 +545,14 @@ static struct ucp_event_descr ucp_events
 
     UCPDESCR(0CH_01H, 0x0C, 0x01, UCP_F_FM | UCP_F_WM),
     UCPDESCR(0CH_02H, 0x0C, 0x02, UCP_F_FM | UCP_F_WM),
-    UCPDESCR(0CH_04H, 0x0C, 0x04, UCP_F_FM | UCP_F_WM),
-    UCPDESCR(0CH_08H, 0x0C, 0x08, UCP_F_FM | UCP_F_WM),
+    UCPDESCR(0CH_04H_E, 0x0C, 0x04, UCP_F_FM | UCP_F_WM),
+    UCPDESCR(0CH_04H_F, 0x0C, 0x04, UCP_F_FM | UCP_F_WM),
+    UCPDESCR(0CH_04H_M, 0x0C, 0x04, UCP_F_FM | UCP_F_WM),
+    UCPDESCR(0CH_04H_S, 0x0C, 0x04, UCP_F_FM | UCP_F_WM),
+    UCPDESCR(0CH_08H_E, 0x0C, 0x08, UCP_F_FM | UCP_F_WM),
+    UCPDESCR(0CH_08H_F, 0x0C, 0x08, UCP_F_FM | UCP_F_WM),
+    UCPDESCR(0CH_08H_M, 0x0C, 0x08, UCP_F_FM | UCP_F_WM),
+    UCPDESCR(0CH_08H_S, 0x0C, 0x08, UCP_F_FM | UCP_F_WM),
 
     UCPDESCR(20H_01H, 0x20, 0x01, UCP_F_FM | UCP_F_I7 | UCP_F_WM),
     UCPDESCR(20H_02H, 0x20, 0x02, UCP_F_FM | UCP_F_I7 | UCP_F_WM),
@@ -965,6 +971,36 @@ ucp_start_pmc(int cpu, int ri)
 	PMCDBG(MDP,STA,2, "ucp-start/2 cpu=%d ri=%d evselmsr=0x%x evsel=0x%x",
 	    cpu, ri, UCP_EVSEL0 + ri, evsel);
 
+	/* Event specific configuration. */
+	switch (pm->pm_event) {
+	case PMC_EV_UCP_EVENT_0CH_04H_E:
+		wrmsr(MSR_GQ_SNOOP_MESF,0x2);
+		break;
+	case PMC_EV_UCP_EVENT_0CH_04H_F:
+		wrmsr(MSR_GQ_SNOOP_MESF,0x8);
+		break;
+	case PMC_EV_UCP_EVENT_0CH_04H_M:
+		wrmsr(MSR_GQ_SNOOP_MESF,0x1);
+		break;
+	case PMC_EV_UCP_EVENT_0CH_04H_S:
+		wrmsr(MSR_GQ_SNOOP_MESF,0x4);
+		break;
+	case PMC_EV_UCP_EVENT_0CH_08H_E:
+		wrmsr(MSR_GQ_SNOOP_MESF,0x2);
+		break;
+	case PMC_EV_UCP_EVENT_0CH_08H_F:
+		wrmsr(MSR_GQ_SNOOP_MESF,0x8);
+		break;	
+	case PMC_EV_UCP_EVENT_0CH_08H_M:
+		wrmsr(MSR_GQ_SNOOP_MESF,0x1);
+		break;
+	case PMC_EV_UCP_EVENT_0CH_08H_S:
+		wrmsr(MSR_GQ_SNOOP_MESF,0x4);
+		break;
+	default:	
+		break;
+	}
+
 	wrmsr(UCP_EVSEL0 + ri, evsel);
 
 	do {

Modified: head/sys/dev/hwpmc/hwpmc_uncore.h
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_uncore.h	Wed Jan  4 07:25:10 2012	(r229468)
+++ head/sys/dev/hwpmc/hwpmc_uncore.h	Wed Jan  4 07:33:06 2012	(r229469)
@@ -87,11 +87,18 @@ struct pmc_md_ucp_op_pmcallocate {
 #define	UC_GLOBAL_CTRL				0x391
 #define	UC_GLOBAL_OVF_CTRL			0x393
 
+
 #define	UC_GLOBAL_STATUS_FLAG_CLRCHG		(1ULL << 63)
 #define	UC_GLOBAL_STATUS_FLAG_OVFPMI		(1ULL << 61)
 #define	UC_GLOBAL_CTRL_FLAG_FRZ			(1ULL << 63)
 #define	UC_GLOBAL_CTRL_FLAG_ENPMICORE0		(1ULL << 48)
 
+/*
+ * Model specific registers.
+ */
+
+#define MSR_GQ_SNOOP_MESF			0x301
+
 struct pmc_md_ucf_pmc {
 	uint64_t	pm_ucf_ctrl;
 };

Modified: head/sys/dev/hwpmc/pmc_events.h
==============================================================================
--- head/sys/dev/hwpmc/pmc_events.h	Wed Jan  4 07:25:10 2012	(r229468)
+++ head/sys/dev/hwpmc/pmc_events.h	Wed Jan  4 07:33:06 2012	(r229469)
@@ -2388,8 +2388,14 @@ __PMC_EV(UCP, EVENT_0BH_10H)			\
 __PMC_EV(UCP, EVENT_0BH_1FH)			\
 __PMC_EV(UCP, EVENT_0CH_01H)			\
 __PMC_EV(UCP, EVENT_0CH_02H)			\
-__PMC_EV(UCP, EVENT_0CH_04H)			\
-__PMC_EV(UCP, EVENT_0CH_08H)			\
+__PMC_EV(UCP, EVENT_0CH_04H_E)			\
+__PMC_EV(UCP, EVENT_0CH_04H_F)			\
+__PMC_EV(UCP, EVENT_0CH_04H_M)			\
+__PMC_EV(UCP, EVENT_0CH_04H_S)			\
+__PMC_EV(UCP, EVENT_0CH_08H_E)			\
+__PMC_EV(UCP, EVENT_0CH_08H_F)			\
+__PMC_EV(UCP, EVENT_0CH_08H_M)			\
+__PMC_EV(UCP, EVENT_0CH_08H_S)			\
 __PMC_EV(UCP, EVENT_20H_01H)			\
 __PMC_EV(UCP, EVENT_20H_02H)			\
 __PMC_EV(UCP, EVENT_20H_04H)			\
@@ -2789,8 +2795,14 @@ __PMC_EV_ALIAS("L3_LINES_OUT.F_STATE", U
 __PMC_EV_ALIAS("L3_LINES_OUT.ANY", UCP_EVENT_0BH_1FH)	\
 __PMC_EV_ALIAS("GQ_SNOOP.GOTO_S", UCP_EVENT_0CH_01H)	\
 __PMC_EV_ALIAS("GQ_SNOOP.GOTO_I", UCP_EVENT_0CH_02H)	\
-__PMC_EV_ALIAS("GQ_SNOOP.GOTO_S_HIT", UCP_EVENT_0CH_04H)	\
-__PMC_EV_ALIAS("GQ_SNOOP.GOTO_I_HIT", UCP_EVENT_0CH_08H)	\
+__PMC_EV_ALIAS("GQ_SNOOP.GOTO_S_HIT_E", UCP_EVENT_0CH_04H_E)	\
+__PMC_EV_ALIAS("GQ_SNOOP.GOTO_S_HIT_F", UCP_EVENT_0CH_04H_F)	\
+__PMC_EV_ALIAS("GQ_SNOOP.GOTO_S_HIT_M", UCP_EVENT_0CH_04H_M)	\
+__PMC_EV_ALIAS("GQ_SNOOP.GOTO_S_HIT_S", UCP_EVENT_0CH_04H_S)	\
+__PMC_EV_ALIAS("GQ_SNOOP.GOTO_I_HIT_E", UCP_EVENT_0CH_08H_E)	\
+__PMC_EV_ALIAS("GQ_SNOOP.GOTO_I_HIT_F", UCP_EVENT_0CH_08H_F)	\
+__PMC_EV_ALIAS("GQ_SNOOP.GOTO_I_HIT_M", UCP_EVENT_0CH_08H_M)	\
+__PMC_EV_ALIAS("GQ_SNOOP.GOTO_I_HIT_S", UCP_EVENT_0CH_08H_S)	\
 __PMC_EV_ALIAS("QHL_REQUESTS.IOH_READS", UCP_EVENT_20H_01H)	\
 __PMC_EV_ALIAS("QHL_REQUESTS.IOH_WRITES", UCP_EVENT_20H_02H)	\
 __PMC_EV_ALIAS("QHL_REQUESTS.REMOTE_READS", UCP_EVENT_20H_04H)	\



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201040733.q047X7wK066297>