Skip to contentSkip to conversation

sparc64: T5 PMU

PATCH In review Bob Picco 2 participants 2 messages Sep 16, 2014 – Sep 17, 2014

Subsystems (2)
lore
Share & tools
lore

Bob Picco

author
#0 lore raw

PATCH v2 1/1 sparc64: T5 PMU

From: bob picco <[email protected]>

The T5 (niagara5) has different PCR related HV fast trap values and a new HV API Group. This patch utilizes these and shares when possible with niagara4.

We use the same sparc_pmu niagara4_pmu. Should there be new effort to obtain the MCU perf statistics then this would have to be changed.

---
V2: Hopefully have the programming style correct.

 arch/sparc/include/asm/hypervisor.h |   11 ++++++++
 arch/sparc/kernel/hvapi.c           |    1 +
 arch/sparc/kernel/hvcalls.S         |   16 ++++++++++++
 arch/sparc/kernel/pcr.c             |   46 +++++++++++++++++++++++++++++++---
 arch/sparc/kernel/perf_event.c      |    3 +-
 5 files changed, 72 insertions(+), 5 deletions(-)
arch/sparc/include/asm/hypervisor.h +11 -0
index 94b39ca..4f6725f 100644
@@ -2947,6 +2947,16 @@ unsigned long sun4v_vt_set_perfreg(unsigned long reg_num,
 				   unsigned long reg_val);
 #endif
 
+#define	HV_FAST_T5_GET_PERFREG		0x1a8
+#define	HV_FAST_T5_SET_PERFREG		0x1a9
+
+#ifndef	__ASSEMBLY__
+unsigned long sun4v_t5_get_perfreg(unsigned long reg_num,
+				   unsigned long *reg_val);
+unsigned long sun4v_t5_set_perfreg(unsigned long reg_num,
+				   unsigned long reg_val);
+#endif
+
 /* Function numbers for HV_CORE_TRAP.  */
 #define HV_CORE_SET_VER			0x00
 #define HV_CORE_PUTCHAR			0x01
@@ -2978,6 +2988,7 @@ unsigned long sun4v_vt_set_perfreg(unsigned long reg_num,
 #define HV_GRP_VF_CPU			0x0205
 #define HV_GRP_KT_CPU			0x0209
 #define HV_GRP_VT_CPU			0x020c
+#define HV_GRP_T5_CPU			0x0211
 #define HV_GRP_DIAG			0x0300
 
 #ifndef __ASSEMBLY__
arch/sparc/kernel/hvapi.c +1 -0
index c0a2de0..5c55145 100644
@@ -46,6 +46,7 @@ static struct api_info api_table[] = {
 	{ .group = HV_GRP_VF_CPU,				},
 	{ .group = HV_GRP_KT_CPU,				},
 	{ .group = HV_GRP_VT_CPU,				},
+	{ .group = HV_GRP_T5_CPU,				},
 	{ .group = HV_GRP_DIAG,		.flags = FLAG_PRE_API	},
 };
 
arch/sparc/kernel/hvcalls.S +16 -0
index f3ab509..caedf83 100644
@@ -821,3 +821,19 @@ ENTRY(sun4v_vt_set_perfreg)
 	retl
 	 nop
 ENDPROC(sun4v_vt_set_perfreg)
+
+ENTRY(sun4v_t5_get_perfreg)
+	mov	%o1, %o4
+	mov	HV_FAST_T5_GET_PERFREG, %o5
+	ta	HV_FAST_TRAP
+	stx	%o1, [%o4]
+	retl
+	 nop
+ENDPROC(sun4v_t5_get_perfreg)
+
+ENTRY(sun4v_t5_set_perfreg)
+	mov	HV_FAST_T5_SET_PERFREG, %o5
+	ta	HV_FAST_TRAP
+	retl
+	 nop
+ENDPROC(sun4v_t5_set_perfreg)
arch/sparc/kernel/pcr.c +42 -4

76 lines not on this page · raw message

arch/sparc/kernel/perf_event.c +2 -1
index d35c490..c9759ad 100644
@@ -1662,7 +1662,8 @@ static bool __init supported_pmu(void)
 		sparc_pmu = &niagara2_pmu;
 		return true;
 	}
-	if (!strcmp(sparc_pmu_type, "niagara4")) {
+	if (!strcmp(sparc_pmu_type, "niagara4") ||
+	    !strcmp(sparc_pmu_type, "niagara5")) {
 		sparc_pmu = &niagara4_pmu;
 		return true;
 	}
Signature · 1 line
1.7.1
maintainer
#1 lore raw

From: Bob Picco <[email protected]>
Date: Tue, 16 Sep 2014 10:09:06 -0400

Quoted 5 lines

From: bob picco <[email protected]>

The T5 (niagara5) has different PCR related HV fast trap values and a new HV API Group. This patch utilizes these and shares when possible with niagara4.

Quoted 7 lines

We use the same sparc_pmu niagara4_pmu. Should there be new effort to obtain the MCU perf statistics then this would have to be changed.

---
V2: Hopefully have the programming style correct.

Looks good, applied, although:

arch/sparc/kernel/pcr.c static int __init register_perf_hsvc(void) · line 252

Quoted 10 lines
arch/sparc/kernel/pcr.c +3 -0
@@ -215,6 +244,9 @@ static int __init register_perf_hsvc(void)
 			perf_hsvc_group = HV_GRP_VT_CPU;
 			break;
 
+		case SUN4V_CHIP_NIAGARA5:
+			perf_hsvc_group = HV_GRP_T5_CPU;
+			break;
 		default:
 			return -ENODEV;
 		}

I added an empty line bfore "default:"

Thanks!