[PATCH] 1/2 Oprofile support for Power9

Will Schmidt <[email protected]>
Newsgroups gmane.linux.oprofile
Message-ID <[email protected]>
Hi, 

Add initial support for PPC64/Power9 to oprofile.
This includes the documentation updates to indicate "power9",
the PVR values, and all the other updates that will be necessary.
(This is based on a review of changes made when Power8 support
was initially added).
The long-ish event list follows as a subsequent patch.
    
Signed-off-by:  Will Schmidt <[email protected]>

--


diff --git a/doc/oprofile.xml b/doc/oprofile.xml
index 325ef6f..01930ab 100644
--- a/doc/oprofile.xml
+++ b/doc/oprofile.xml
@@ -486,7 +486,7 @@ can be used for <command>ocount</command>, minus the <emphasis>count</emphasis>
 <row><entry>Hammer</entry><entry>x86-64/hammer</entry><entry>CPU_CLK_UNHALTED:100000:0:1:1</entry></row>
 <row><entry>Family10h</entry><entry>x86-64/family10</entry><entry>CPU_CLK_UNHALTED:100000:0:1:1</entry></row>
 <row><entry>Family11h</entry><entry>x86-64/family11h</entry><entry>CPU_CLK_UNHALTED:100000:0:1:1</entry></row>
-<row><entry>IBM pseries</entry><entry>ppc64/power{ 4|5|6|7|8|970 }</entry><entry>CYCLES:100000:0:1:1</entry></row>
+<row><entry>IBM pseries</entry><entry>ppc64/power{ 4|5|6|7|8|9|970 }</entry><entry>CYCLES:100000:0:1:1</entry></row>
 <row><entry>IBM s390</entry><entry>s390/{ z10|z196|zEC12 }</entry><entry>HWSAMPLING:4127518:0:1:1</entry></row>
 </tbody>
 </tgroup>
diff --git a/events/Makefile.am b/events/Makefile.am
index db43550..b8f06af 100644
--- a/events/Makefile.am
+++ b/events/Makefile.am
@@ -29,6 +29,7 @@ event_files = \
 	ppc64/power6/events ppc64/power6/event_mappings ppc64/power6/unit_masks \
 	ppc64/power7/events ppc64/power7/event_mappings ppc64/power7/unit_masks \
 	ppc64/power8/events ppc64/power8/unit_masks \
+	ppc64/power9/events ppc64/power9/unit_masks \
 	ppc64/970/events ppc64/970/event_mappings ppc64/970/unit_masks \
 	ppc64/970MP/events ppc64/970MP/event_mappings ppc64/970MP/unit_masks \
 	x86-64/hammer/events x86-64/hammer/unit_masks \
diff --git a/events/ppc64/power9/events b/events/ppc64/power9/events
new file mode 100644
index 0000000..a2071e7
--- /dev/null
+++ b/events/ppc64/power9/events
@@ -0,0 +1,8 @@
+
+#  Copyright OProfile authors
+#  Copyright (c) International Business Machines, 2017.
+#  Contributed by Will Schmidt <[email protected]>.
+#
+#  IBM POWER9 Events
+
+include:ppc64/architected_events_v1
diff --git a/events/ppc64/power9/unit_masks b/events/ppc64/power9/unit_masks
new file mode 100644
index 0000000..e384695
--- /dev/null
+++ b/events/ppc64/power9/unit_masks
@@ -0,0 +1,9 @@
+#
+# Copyright OProfile authors
+# Copyright (c) International Business Machines, 2017.
+# Contributed by Will Schmidt <[email protected]>
+#
+# ppc64 POWER9 possible unit masks
+#
+name:zero type:mandatory default:0x0
+	0x0 No unit mask
diff --git a/libop/op_cpu_type.c b/libop/op_cpu_type.c
index 3d3c9c8..7acecda 100644
--- a/libop/op_cpu_type.c
+++ b/libop/op_cpu_type.c
@@ -119,6 +119,7 @@ static struct cpu_descr const cpu_descrs[MAX_CPU_TYPE] = {
 	{ "Intel Goldmont microarchitecture", "i386/goldmont", CPU_GOLDMONT, 4 },
 	{ "IBM z13", "s390/z13", CPU_S390_Z13, 1 },
 	{ "ARM Cortex-A17", "arm/armv7-ca17", CPU_ARM_V7_CA17, 7 },
+	{ "ppc64 POWER9", "ppc64/power9", CPU_PPC64_POWER9, 6 },
 };
  
 static size_t const nr_cpu_descrs = sizeof(cpu_descrs) / sizeof(struct cpu_descr);
@@ -292,6 +293,8 @@ static op_cpu _try_ppc64_arch_generic_cpu(void)
 			 */
 			if ((strcmp(platform, "power7") == 0) && (strcmp(base_platform, "power8") == 0))
 				cpu_type = CPU_PPC64_POWER8;
+			else if ((strcmp(platform, "power8") == 0) && (strcmp(base_platform, "power9") == 0))
+				cpu_type = CPU_PPC64_POWER9;
 			else
 				cpu_type = CPU_PPC64_ARCH_V1;
 		}
diff --git a/libop/op_cpu_type.h b/libop/op_cpu_type.h
index 78eb9bc..39b7726 100644
--- a/libop/op_cpu_type.h
+++ b/libop/op_cpu_type.h
@@ -105,6 +105,7 @@ typedef enum {
 	CPU_GOLDMONT, /** < Intel Goldmont microarchitecture */
 	CPU_S390_Z13, /** < IBM z13 */
 	CPU_ARM_V7_CA17, /* ARM Cortex-A17 */
+	CPU_PPC64_POWER9, /**< ppc64 POWER8 family */
 	MAX_CPU_TYPE
 } op_cpu;
 
diff --git a/libop/op_events.c b/libop/op_events.c
index 0c7e9bc..0ba57e0 100644
--- a/libop/op_events.c
+++ b/libop/op_events.c
@@ -1259,6 +1259,7 @@ void op_default_event(op_cpu cpu_type, struct op_default_event_descr * descr)
 		case CPU_PPC64_POWER7:
 		case CPU_PPC64_ARCH_V1:
 		case CPU_PPC64_POWER8:
+		case CPU_PPC64_POWER9:
 			descr->name = "CYCLES";
 			break;
 
diff --git a/utils/ophelp.c b/utils/ophelp.c
index ff4e3f1..6eb299c 100644
--- a/utils/ophelp.c
+++ b/utils/ophelp.c
@@ -680,6 +680,12 @@ int main(int argc, char const * argv[])
 			"See Power ISA 2.07 at https://www.power.org/\n\n";
 		break;
 
+	case CPU_PPC64_POWER9:
+		event_doc =
+			"This processor type is fully supported with operf.\n"
+			"See Power ISA 3.0 at https://www.power.org/\n\n";
+		break;
+
 	case CPU_MIPS_20K:
 		event_doc =
 			"See Programming the MIPS64 20Kc Processor Core User's "



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.