Blame SOURCES/oprofile-aarch64.patch

d5df0a
commit 34d0065a1a790fc2be05a5ef1d8b0bbf28b814fe
d5df0a
Author: William Cohen <wcohen@redhat.com>
d5df0a
Date:   Wed Feb 12 08:05:38 2014 -0600
d5df0a
d5df0a
    Provide basic AArch64 (ARMv8) support
d5df0a
    
d5df0a
    The AArch64 (ARMv8) support is provided as an ARM variant to allow use
d5df0a
    in both 32-bit and 64-bit ARM environments.  The support in this patch
d5df0a
    is just the basic events described in the AArch64 documentation.
d5df0a
    AArch64 processor implementation may provide additional implementation
d5df0a
    specific events.  One could add code to recognize those processor
d5df0a
    specific implementations and include the armv8-pmuv3-common base
d5df0a
    events into the event sets for the processor implementations.
d5df0a
    The APM X-Gene processor type is included in this patch as an
d5df0a
    implementation, although there are no known processor-specific events
d5df0a
    to add at this time.
d5df0a
    
d5df0a
    Below is example run on the ARM Foundation simulator collecting data
d5df0a
    on a build of OProfile.
d5df0a
    
d5df0a
    $ cd oprofile
d5df0a
    $ operf make
d5df0a
    ...
d5df0a
    $ opreport -t 5
d5df0a
    Using /home/wcohen/oprofile/oprofile/oprofile_data/samples/ for samples directory.
d5df0a
    
d5df0a
    WARNING: Lost samples detected! See /home/wcohen/oprofile/oprofile/oprofile_data/samples/operf.log for details.
d5df0a
    CPU: ARM AArch64
d5df0a
    Counted CPU_CYCLES events (Cycle) with a unit mask of 0x00 (No unit mask) count 100000
d5df0a
    CPU_CYCLES:100000|
d5df0a
      samples|      %|
d5df0a
    ------------------
d5df0a
        10943 90.5877 make
d5df0a
    	CPU_CYCLES:100000|
d5df0a
    	  samples|      %|
d5df0a
    	------------------
d5df0a
    	     5281 48.2592 make
d5df0a
    	     4543 41.5151 libc-2.17.so
d5df0a
    	     1079  9.8602 kallsyms
d5df0a
    	       40  0.3655 ld-2.17.so
d5df0a
          735  6.0844 sh
d5df0a
    	CPU_CYCLES:100000|
d5df0a
    	  samples|      %|
d5df0a
    	------------------
d5df0a
    	      321 43.6735 kallsyms
d5df0a
    	      298 40.5442 libc-2.17.so
d5df0a
    	       94 12.7891 bash
d5df0a
    	       22  2.9932 ld-2.17.so
d5df0a
    
d5df0a
    Signed-off-by: William Cohen <wcohen@redhat.com>
d5df0a
d5df0a
diff --git a/events/Makefile.am b/events/Makefile.am
d5df0a
index ad45642..3e43d10 100644
d5df0a
--- a/events/Makefile.am
d5df0a
+++ b/events/Makefile.am
d5df0a
@@ -59,6 +59,8 @@ event_files = \
d5df0a
 	arm/armv7-ca7/events arm/armv7-ca7/unit_masks \
d5df0a
 	arm/armv7-ca15/events arm/armv7-ca15/unit_masks \
d5df0a
 	arm/mpcore/events arm/mpcore/unit_masks \
d5df0a
+	arm/armv8-pmuv3-common/events arm/armv8-pmuv3-common/unit_masks \
d5df0a
+	arm/armv8-xgene/events arm/armv8-xgene/unit_masks \
d5df0a
 	avr32/events avr32/unit_masks \
d5df0a
 	mips/20K/events mips/20K/unit_masks \
d5df0a
 	mips/24K/events mips/24K/unit_masks \
d5df0a
diff --git a/events/arm/armv8-pmuv3-common/events b/events/arm/armv8-pmuv3-common/events
d5df0a
new file mode 100644
d5df0a
index 0000000..3cdff03
d5df0a
--- /dev/null
d5df0a
+++ b/events/arm/armv8-pmuv3-common/events
d5df0a
@@ -0,0 +1,38 @@
d5df0a
+#
d5df0a
+# Copyright (c) Red Hat, 2014.
d5df0a
+# Contributed by William Cohen <wcohen@redhat.com>
d5df0a
+#
d5df0a
+# ARMv8 pmu v3 architected events
d5df0a
+
d5df0a
+event:0x00 um:zero minimum:500 name:SW_INCR : Instruction architecturally executed, condition code check pass, software increment
d5df0a
+event:0x01 um:zero minimum:5000 name:L1I_CACHE_REFILL : Level 1 instruction cache refill
d5df0a
+event:0x02 um:zero minimum:5000 name:L1I_TLB_REFILL : Level 1 instruction TLB refill
d5df0a
+event:0x03 um:zero minimum:5000 name:L1D_CACHE_REFILL : Level 1 data cache refill
d5df0a
+event:0x04 um:zero minimum:5000 name:L1D_CACHE : Level 1 data cache access
d5df0a
+event:0x05 um:zero minimum:5000 name:L1D_TLB_REFILL : Level 1 data TLB refill
d5df0a
+event:0x06 um:zero minimum:100000 name:LD_RETIRED : Instruction architecturally executed, condition code check pass, load
d5df0a
+event:0x07 um:zero minimum:100000 name:ST_RETIRED : Instruction architecturally executed, condition code check pass, store
d5df0a
+event:0x08 um:zero minimum:100000 name:INST_RETIRED : Instruction architecturally executed
d5df0a
+event:0x09 um:zero minimum:500 name:EXC_TAKEN : Exception taken
d5df0a
+event:0x0A um:zero minimum:500 name:EXC_RETURN : Instruction architecturally executed, condition code check pass, exception return
d5df0a
+event:0x0B um:zero minimum:500 name:CID_WRITE_RETIRED : Instruction architecturally executed, condition code check pass, write to CONTEXTIDR
d5df0a
+event:0x0C um:zero minimum:5000 name:PC_WRITE_RETIRED : Instruction architecturally executed, condition code check pass, software change of the PC
d5df0a
+event:0x0D um:zero minimum:5000 name:BR_IMMED_RETIRED : Instruction architecturally executed, immediate branch
d5df0a
+event:0x0E um:zero minimum:5000 name:BR_RETURN_RETIRED : Instruction architecturally executed, condition code check pass, procedure return
d5df0a
+event:0x0F um:zero minimum:500 name:UNALIGNED_LDST_RETIRED : Instruction architecturally executed, condition code check pass, unaligned load or store
d5df0a
+event:0x10 um:zero minimum:5000 name:BR_MIS_PRED : Mispredicted or not predicted branch speculatively executed
d5df0a
+event:0x11 um:zero minimum:100000 name:CPU_CYCLES : Cycle
d5df0a
+event:0x12 um:zero minimum:5000 name:BR_PRED : Predictable branch speculatively executed
d5df0a
+event:0x13 um:zero minimum:100000 name:MEM_ACCESS : Data memory access
d5df0a
+event:0x14 um:zero minimum:5000 name:L1I_CACHE : Level 1 instruction cache access
d5df0a
+event:0x15 um:zero minimum:5000 name:L1D_CACHE_WB : Level 1 data cache write-back
d5df0a
+event:0x16 um:zero minimum:5000 name:L2D_CACHE : Level 2 data cache access
d5df0a
+event:0x17 um:zero minimum:5000 name:L2D_CACHE_REFILL : Level 2 data cache refill
d5df0a
+event:0x18 um:zero minimum:5000 name:L2D_CACHE_WB : Level 2 data cache write-back
d5df0a
+event:0x19 um:zero minimum:5000 name:BUS_ACCESS : Bus access
d5df0a
+event:0x1A um:zero minimum:500 name:MEMORY_ERROR : Local memory error
d5df0a
+event:0x1B um:zero minimum:100000 name:INST_SPEC : Operation speculatively executed
d5df0a
+event:0x1C um:zero minimum:5000 name:TTBR_WRITE_RETIRED : Instruction architecturally executed, condition code check pass, write to TTBR
d5df0a
+event:0x1D um:zero minimum:5000 name:BUS_CYCLES : Bus cycle
d5df0a
+event:0x1F um:zero minimum:5000 name:L1D_CACHE_ALLOCATE : Level 1 data cache allocation without refill
d5df0a
+event:0x20 um:zero minimum:5000 name:L2D_CACHE_ALLOCATE : Level 2 data cache allocation without refill
d5df0a
diff --git a/events/arm/armv8-pmuv3-common/unit_masks b/events/arm/armv8-pmuv3-common/unit_masks
d5df0a
new file mode 100644
d5df0a
index 0000000..7666c35
d5df0a
--- /dev/null
d5df0a
+++ b/events/arm/armv8-pmuv3-common/unit_masks
d5df0a
@@ -0,0 +1,4 @@
d5df0a
+# ARMv8 architected events unit masks
d5df0a
+#
d5df0a
+name:zero type:mandatory default:0x00
d5df0a
+	0x00 No unit mask
d5df0a
diff --git a/events/arm/armv8-xgene/events b/events/arm/armv8-xgene/events
d5df0a
new file mode 100644
d5df0a
index 0000000..3e28463
d5df0a
--- /dev/null
d5df0a
+++ b/events/arm/armv8-xgene/events
d5df0a
@@ -0,0 +1,7 @@
d5df0a
+#
d5df0a
+# Copyright (c) Red Hat, 2014.
d5df0a
+# Contributed by William Cohen <wcohen@redhat.com>
d5df0a
+#
d5df0a
+# Basic ARM V8 events
d5df0a
+#
d5df0a
+include:arm/armv8-pmuv3-common
d5df0a
diff --git a/events/arm/armv8-xgene/unit_masks b/events/arm/armv8-xgene/unit_masks
d5df0a
new file mode 100644
d5df0a
index 0000000..9ace2eb
d5df0a
--- /dev/null
d5df0a
+++ b/events/arm/armv8-xgene/unit_masks
d5df0a
@@ -0,0 +1,3 @@
d5df0a
+# ARMv8 architected events unit masks
d5df0a
+#
d5df0a
+include:arm/armv8-pmuv3-common
d5df0a
diff --git a/libop/op_cpu_type.c b/libop/op_cpu_type.c
d5df0a
index 1ae2913..0cfb4ea 100644
d5df0a
--- a/libop/op_cpu_type.c
d5df0a
+++ b/libop/op_cpu_type.c
d5df0a
@@ -129,6 +129,7 @@ static struct cpu_descr const cpu_descrs[MAX_CPU_TYPE] = {
d5df0a
 	{ "ppc64 POWER8", "ppc64/power8", CPU_PPC64_POWER8, 6 },
d5df0a
 	{ "Intel Silvermont microarchitecture", "i386/silvermont", CPU_SILVERMONT, 2 },
d5df0a
 	{ "Intel Broadwell microarchitecture", "i386/broadwell", CPU_BROADWELL, 4 },
d5df0a
+	{ "APM X-Gene", "arm/armv8-xgene", CPU_ARM_V8_APM_XGENE, 6 },
d5df0a
 };
d5df0a
  
d5df0a
 static size_t const nr_cpu_descrs = sizeof(cpu_descrs) / sizeof(struct cpu_descr);
d5df0a
@@ -395,6 +396,11 @@ static op_cpu _get_arm_cpu_type(void)
d5df0a
 		case 0xc0f:
d5df0a
 			return op_get_cpu_number("arm/armv7-ca15");
d5df0a
 		}
d5df0a
+	} else if (vendorid == 0x50) {	/* Applied Micro Circuits Corporation */
d5df0a
+		switch (cpuid) {
d5df0a
+		case 0x000:
d5df0a
+			return op_get_cpu_number("arm/armv8-xgene");
d5df0a
+		}
d5df0a
 	} else if (vendorid == 0x69) {	/* Intel xscale */
d5df0a
 		switch (cpuid >> 9) {
d5df0a
 		case 1:
d5df0a
@@ -631,7 +637,8 @@ static op_cpu __get_cpu_type_alt_method(void)
d5df0a
 	if (strncmp(uname_info.machine, "ppc64", 5) == 0) {
d5df0a
 		return _get_ppc64_cpu_type();
d5df0a
 	}
d5df0a
-	if (strncmp(uname_info.machine, "arm", 3) == 0) {
d5df0a
+	if (strncmp(uname_info.machine, "arm", 3) == 0 ||
d5df0a
+	    strncmp(uname_info.machine, "aarch64", 7) == 0) {
d5df0a
 		return _get_arm_cpu_type();
d5df0a
 	}
d5df0a
 	if (strncmp(uname_info.machine, "tile", 4) == 0) {
d5df0a
diff --git a/libop/op_cpu_type.h b/libop/op_cpu_type.h
d5df0a
index 67e16de..7c478ad 100644
d5df0a
--- a/libop/op_cpu_type.h
d5df0a
+++ b/libop/op_cpu_type.h
d5df0a
@@ -109,6 +109,7 @@ typedef enum {
d5df0a
 	CPU_PPC64_POWER8, /**< ppc64 POWER8 family */
d5df0a
 	CPU_SILVERMONT, /** < Intel Silvermont microarchitecture */
d5df0a
 	CPU_BROADWELL, /** < Intel Broadwell (Core-M) microarchitecture */
d5df0a
+	CPU_ARM_V8_APM_XGENE, /* APM X-Gene */
d5df0a
 	MAX_CPU_TYPE
d5df0a
 } op_cpu;
d5df0a
 
d5df0a
diff --git a/libop/op_events.c b/libop/op_events.c
d5df0a
index 358a154..e0d3ed5 100644
d5df0a
--- a/libop/op_events.c
d5df0a
+++ b/libop/op_events.c
d5df0a
@@ -1253,6 +1253,7 @@ void op_default_event(op_cpu cpu_type, struct op_default_event_descr * descr)
d5df0a
 		case CPU_AVR32:
d5df0a
 		case CPU_ARM_SCORPION:
d5df0a
 		case CPU_ARM_SCORPIONMP:
d5df0a
+		case CPU_ARM_V8_XGENE:
d5df0a
 			descr->name = "CPU_CYCLES";
d5df0a
 			break;
d5df0a
 
d5df0a
diff --git a/utils/opcontrol b/utils/opcontrol
d5df0a
index 38bb1ac..04a4a91 100755
d5df0a
--- a/utils/opcontrol
d5df0a
+++ b/utils/opcontrol
d5df0a
@@ -400,6 +400,11 @@ do_init()
d5df0a
 				do_deinit
d5df0a
 				exit 1
d5df0a
 				;;
d5df0a
+		        aarch64/*)
d5df0a
+				echo "*** ARM AArch64 processors are not supported with opcontrol.  Please use operf instead. ***"
d5df0a
+				do_deinit
d5df0a
+				exit 1
d5df0a
+				;;
d5df0a
 		esac
d5df0a
 	fi
d5df0a
 
d5df0a
diff --git a/utils/ophelp.c b/utils/ophelp.c
d5df0a
index af4c1e5..35f47bc 100644
d5df0a
--- a/utils/ophelp.c
d5df0a
+++ b/utils/ophelp.c
d5df0a
@@ -656,6 +656,13 @@ int main(int argc, char const * argv[])
d5df0a
 			"Cortex A15 DDI (ARM DDI 0438F, revision r3p1)\n";
d5df0a
 		break;
d5df0a
 
d5df0a
+	case CPU_ARM_V8_APM_XGENE:
d5df0a
+		event_doc =
d5df0a
+			"See ARM Architecture Reference Manual \n"
d5df0a
+			"ARMv8, for ARMv8-A architecture profile\n"
d5df0a
+			"DDI (ARM DDI0487A.a)\n";
d5df0a
+		break;
d5df0a
+
d5df0a
 	case CPU_PPC64_PA6T:
d5df0a
 		event_doc =
d5df0a
 			"See PA6T Power Implementation Features Book IV\n"
d5df0a
 
d5df0a
d5df0a
commit a5eec42a9324915947e78634ddcce55b159a5dd2
d5df0a
Author: Maynard Johnson <maynardj@us.ibm.com>
d5df0a
Date:   Wed Feb 12 08:29:15 2014 -0600
d5df0a
d5df0a
    Minor fixup for previous commit
d5df0a
    
d5df0a
    The previous commit for the new APM X-Gene (AaArch64 ARMv8)
d5df0a
    processor went through a number of iterations before acceptance.
d5df0a
    I missed changing one of the references to the new CPU type
d5df0a
    from CPU_ARM_V8_XGENE to CPU_ARM_V8_APM_XGENE when I committed it.
d5df0a
    This patch fixes that.
d5df0a
    
d5df0a
    Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
d5df0a
d5df0a
diff --git a/libop/op_events.c b/libop/op_events.c
d5df0a
index e0d3ed5..77fc8a5 100644
d5df0a
--- a/libop/op_events.c
d5df0a
+++ b/libop/op_events.c
d5df0a
@@ -1253,7 +1253,7 @@ void op_default_event(op_cpu cpu_type, struct op_default_event_descr * descr)
d5df0a
 		case CPU_AVR32:
d5df0a
 		case CPU_ARM_SCORPION:
d5df0a
 		case CPU_ARM_SCORPIONMP:
d5df0a
-		case CPU_ARM_V8_XGENE:
d5df0a
+		case CPU_ARM_V8_APM_XGENE
d5df0a
 			descr->name = "CPU_CYCLES";
d5df0a
 			break;
d5df0a
 
d5df0a
commit c4e390042458aee07016da0cab251b0ad67b8d2b
d5df0a
Author: William Cohen <wcohen@redhat.com>
d5df0a
Date:   Wed Feb 12 11:56:39 2014 -0500
d5df0a
d5df0a
    Add missing ':' on case statement for CPU_ARM_V8_APM_XGENE
d5df0a
d5df0a
diff --git a/libop/op_events.c b/libop/op_events.c
d5df0a
index 77fc8a5..968ff04 100644
d5df0a
--- a/libop/op_events.c
d5df0a
+++ b/libop/op_events.c
d5df0a
@@ -1253,7 +1253,7 @@ void op_default_event(op_cpu cpu_type, struct op_default_event_descr * descr)
d5df0a
 		case CPU_AVR32:
d5df0a
 		case CPU_ARM_SCORPION:
d5df0a
 		case CPU_ARM_SCORPIONMP:
d5df0a
-		case CPU_ARM_V8_APM_XGENE
d5df0a
+		case CPU_ARM_V8_APM_XGENE:
d5df0a
 			descr->name = "CPU_CYCLES";
d5df0a
 			break;
d5df0a
 
d5df0a
From 40adac210cf9ac8d79a90609c91b8ee5e05b8a2f Mon Sep 17 00:00:00 2001
d5df0a
From: William Cohen <wcohen@redhat.com>
d5df0a
Date: Mon, 21 Jul 2014 14:36:23 -0400
d5df0a
Subject: [PATCH 1/2] Add oprofile support for ARM Cortex A57 microarchitecture
d5df0a
d5df0a
This patch adds the event list of the ARM Cortex A57 architecture.
d5df0a
d5df0a
The patch is very straight forward: just add the model numbers and
d5df0a
type in the usual places and add the event list.
d5df0a
d5df0a
Passes make check
d5df0a
d5df0a
Signed-off-by: William Cohen <wcohen@redhat.com>
d5df0a
---
d5df0a
 events/Makefile.am               |  1 +
d5df0a
 events/arm/armv8-ca57/events     | 67 ++++++++++++++++++++++++++++++++++++++++
d5df0a
 events/arm/armv8-ca57/unit_masks |  3 ++
d5df0a
 libop/op_cpu_type.c              |  3 ++
d5df0a
 libop/op_cpu_type.h              |  1 +
d5df0a
 libop/op_events.c                |  1 +
d5df0a
 utils/ophelp.c                   |  6 ++++
d5df0a
 7 files changed, 82 insertions(+)
d5df0a
 create mode 100644 events/arm/armv8-ca57/events
d5df0a
 create mode 100644 events/arm/armv8-ca57/unit_masks
d5df0a
d5df0a
diff --git a/events/Makefile.am b/events/Makefile.am
d5df0a
index f6fd3d7..b4bca1e 100644
d5df0a
--- a/events/Makefile.am
d5df0a
+++ b/events/Makefile.am
d5df0a
@@ -62,6 +62,7 @@ event_files = \
d5df0a
 	arm/mpcore/events arm/mpcore/unit_masks \
d5df0a
 	arm/armv8-pmuv3-common/events arm/armv8-pmuv3-common/unit_masks \
d5df0a
 	arm/armv8-xgene/events arm/armv8-xgene/unit_masks \
d5df0a
+	arm/armv8-ca57/events arm/armv8-ca57/unit_masks \
d5df0a
 	avr32/events avr32/unit_masks \
d5df0a
 	mips/20K/events mips/20K/unit_masks \
d5df0a
 	mips/24K/events mips/24K/unit_masks \
d5df0a
diff --git a/events/arm/armv8-ca57/events b/events/arm/armv8-ca57/events
d5df0a
new file mode 100644
d5df0a
index 0000000..62974c1
d5df0a
--- /dev/null
d5df0a
+++ b/events/arm/armv8-ca57/events
d5df0a
@@ -0,0 +1,67 @@
d5df0a
+#
d5df0a
+# Copyright (c) Red Hat, 2014.
d5df0a
+# Contributed by William Cohen <wcohen@redhat.com>
d5df0a
+#
d5df0a
+# ARM Cortex A57 events
d5df0a
+# From Cortex A57 TRM
d5df0a
+#
d5df0a
+include:arm/armv8-pmuv3-common
d5df0a
+event:0x40 um:zero minimum:10007 name:L1D_CACHE_LD : Level 1 data cache access - Read
d5df0a
+event:0x41 um:zero minimum:10007 name:L1D_CACHE_ST : Level 1 data cache access - Write
d5df0a
+event:0x42 um:zero minimum:10007 name:L1D_CACHE_REFILL_LD : Level 1 data cache refill - Read
d5df0a
+event:0x43 um:zero minimum:10007 name:L1D_CACHE_REFILL_ST : Level 1 data cache refill - Write
d5df0a
+event:0x46 um:zero minimum:10007 name:L1D_CACHE_WB_VICTIM : Level 1 data cache Write-back - Victim
d5df0a
+event:0x47 um:zero minimum:10007 name:L1D_CACHE_WB_CLEAN : Level 1 data cache Write-back - Cleaning event:and coherency
d5df0a
+event:0x48 um:zero minimum:10007 name:L1D_CACHE_INVAL : Level 1 data cache invalidate
d5df0a
+event:0x4C um:zero minimum:10007 name:L1D_TLB_REFILL_LD : Level 1 data TLB refill - Read
d5df0a
+event:0x4D um:zero minimum:10007 name:L1D_TLB_REFILL_ST : Level 1 data TLB refill - Write
d5df0a
+event:0x50 um:zero minimum:10007 name:L2D_CACHE_LD : Level 2 data cache access - Read
d5df0a
+event:0x51 um:zero minimum:10007 name:L2D_CACHE_ST : Level 2 data cache access - Write
d5df0a
+event:0x52 um:zero minimum:10007 name:L2D_CACHE_REFILL_LD : Level 2 data cache refill - Read
d5df0a
+event:0x53 um:zero minimum:10007 name:L2D_CACHE_REFILL_ST : Level 2 data cache refill - Write
d5df0a
+event:0x56 um:zero minimum:10007 name:L2D_CACHE_WB_VICTIM : Level 2 data cache Write-back - Victim
d5df0a
+event:0x57 um:zero minimum:10007 name:L2D_CACHE_WB_CLEAN : Level 2 data cache Write-back - Cleaning and coherency
d5df0a
+event:0x58 um:zero minimum:10007 name:L2D_CACHE_INVAL : Level 2 data cache invalidate
d5df0a
+event:0x60 um:zero minimum:10007 name:BUS_ACCESS_LD : Bus access - Read
d5df0a
+event:0x61 um:zero minimum:10007 name:BUS_ACCESS_ST : Bus access - Write
d5df0a
+event:0x62 um:zero minimum:10007 name:BUS_ACCESS_SHARED : Bus access - Normal
d5df0a
+event:0x63 um:zero minimum:10007 name:BUS_ACCESS_NOT_SHARED : Bus access - Not normal
d5df0a
+event:0x64 um:zero minimum:10007 name:BUS_ACCESS_NORMAL : Bus access - Normal
d5df0a
+event:0x65 um:zero minimum:10007 name:BUS_ACCESS_PERIPH : Bus access - Peripheral
d5df0a
+event:0x66 um:zero minimum:10007 name:MEM_ACCESS_LD : Data memory access - Read
d5df0a
+event:0x67 um:zero minimum:10007 name:MEM_ACCESS_ST : Data memory access - Write
d5df0a
+event:0x68 um:zero minimum:10007 name:UNALIGNED_LD_SPEC : Unaligned access - Read
d5df0a
+event:0x69 um:zero minimum:10007 name:UNALIGNED_ST_SPEC : Unaligned access - Write
d5df0a
+event:0x6A um:zero minimum:10007 name:UNALIGNED_LDST_SPEC : Unaligned access
d5df0a
+event:0x6C um:zero minimum:10007 name:LDREX_SPEC : Exclusive operation speculatively executed - LDREX
d5df0a
+event:0x6D um:zero minimum:10007 name:STREX_PASS_SPEC : Exclusive instruction speculatively executed - STREX pass
d5df0a
+event:0x6E um:zero minimum:10007 name:STREX_FAIL_SPEC : Exclusive operation speculatively executed - STREX fail
d5df0a
+event:0x70 um:zero minimum:10007 name:LD_SPEC : Operation speculatively executed - Load
d5df0a
+event:0x71 um:zero minimum:10007 name:ST_SPEC : Operation speculatively executed - Store
d5df0a
+event:0x72 um:zero minimum:10007 name:LDST_SPEC : Operation speculatively executed - Load or store
d5df0a
+event:0x73 um:zero minimum:10007 name:DP_SPEC : Operation speculatively executed - Integer data processing
d5df0a
+event:0x74 um:zero minimum:10007 name:ASE_SPEC : Operation speculatively executed - Advanced SIMD
d5df0a
+event:0x75 um:zero minimum:10007 name:VFP_SPEC : Operation speculatively executed - VFP
d5df0a
+event:0x76 um:zero minimum:10007 name:PC_WRITE_SPEC : Operation speculatively executed - Software change of the PC
d5df0a
+event:0x77 um:zero minimum:10007 name:CRYPTO_SPEC : Operation speculatively executed, crypto data processing
d5df0a
+event:0x78 um:zero minimum:10007 name:BR_IMMED_SPEC : Branch speculatively executed - Immediate branch
d5df0a
+event:0x79 um:zero minimum:10007 name:BR_RETURN_SPEC : Branch speculatively executed - Procedure return
d5df0a
+event:0x7A um:zero minimum:10007 name:BR_INDIRECT_SPEC : Branch speculatively executed - Indirect branch
d5df0a
+event:0x7C um:zero minimum:10007 name:ISB_SPEC : Barrier speculatively executed - ISB
d5df0a
+event:0x7D um:zero minimum:10007 name:DSB_SPEC : Barrier speculatively executed - DSB
d5df0a
+event:0x7E um:zero minimum:10007 name:DMB_SPEC : Barrier speculatively executed - DMB
d5df0a
+event:0x81 um:zero minimum:10007 name:EXC_UNDEF : Exception taken, other synchronous
d5df0a
+event:0x82 um:zero minimum:10007 name:EXC_SVC : Exception taken, Supervisor Call
d5df0a
+event:0x83 um:zero minimum:10007 name:EXC_PABORT : Exception taken, Instruction Abort
d5df0a
+event:0x84 um:zero minimum:10007 name:EXC_DABORT : Exception taken, Data Abort or SError
d5df0a
+event:0x86 um:zero minimum:10007 name:EXC_IRQ : Exception taken, IRQ
d5df0a
+event:0x87 um:zero minimum:10007 name:EXC_FIQ : Exception taken, FIQ
d5df0a
+event:0x88 um:zero minimum:10007 name:EXC_SMC : Exception taken, Secure Monitor Call
d5df0a
+event:0x8A um:zero minimum:10007 name:EXC_HVC : Exception taken, Hypervisor Call
d5df0a
+event:0x8B um:zero minimum:10007 name:EXC_TRAP_PABORT : Exception taken, Instruction Abort not taken locally
d5df0a
+event:0x8C um:zero minimum:10007 name:EXC_TRAP_DABORT : Exception taken, Data Abort, or SError not taken locally
d5df0a
+event:0x8D um:zero minimum:10007 name:EXC_TRAP_OTHER : Exception taken – Other traps not taken locally
d5df0a
+event:0x8E um:zero minimum:10007 name:EXC_TRAP_IRQ : Exception taken, IRQ not taken locally
d5df0a
+event:0x8F um:zero minimum:10007 name:EXC_TRAP_FIQ : Exception taken, FIQ not taken locally
d5df0a
+event:0x90 um:zero minimum:10007 name:RC_LD_SPEC : Release consistency instruction speculatively executed – Load-Acquire
d5df0a
+event:0x91 um:zero minimum:10007 name:RC_ST_SPEC : Release consistency instruction speculatively executed – Store-Release
d5df0a
diff --git a/events/arm/armv8-ca57/unit_masks b/events/arm/armv8-ca57/unit_masks
d5df0a
new file mode 100644
d5df0a
index 0000000..5d69263
d5df0a
--- /dev/null
d5df0a
+++ b/events/arm/armv8-ca57/unit_masks
d5df0a
@@ -0,0 +1,3 @@
d5df0a
+# ARMv8 Cortex A57 unit masks
d5df0a
+#
d5df0a
+include:arm/armv8-pmuv3-common
d5df0a
diff --git a/libop/op_cpu_type.c b/libop/op_cpu_type.c
d5df0a
index bce230a..163bd1c 100644
d5df0a
--- a/libop/op_cpu_type.c
d5df0a
+++ b/libop/op_cpu_type.c
d5df0a
@@ -131,6 +131,7 @@ static struct cpu_descr const cpu_descrs[MAX_CPU_TYPE] = {
d5df0a
 	{ "Intel Silvermont microarchitecture", "i386/silvermont", CPU_SILVERMONT, 2 },
d5df0a
 	{ "Intel Broadwell microarchitecture", "i386/broadwell", CPU_BROADWELL, 4 },
d5df0a
 	{ "APM X-Gene", "arm/armv8-xgene", CPU_ARM_V8_APM_XGENE, 6 },
d5df0a
+	{ "ARM Cortex-A57", "arm/armv8-ca57", CPU_ARM_V8_CA57, 6},
d5df0a
 };
d5df0a
  
d5df0a
 static size_t const nr_cpu_descrs = sizeof(cpu_descrs) / sizeof(struct cpu_descr);
d5df0a
@@ -396,6 +397,8 @@ static op_cpu _get_arm_cpu_type(void)
d5df0a
 			return op_get_cpu_number("arm/armv7-ca9");
d5df0a
 		case 0xc0f:
d5df0a
 			return op_get_cpu_number("arm/armv7-ca15");
d5df0a
+		case 0xd07:
d5df0a
+			return op_get_cpu_number("arm/armv8-ca57");
d5df0a
 		}
d5df0a
 	} else if (vendorid == 0x50) {	/* Applied Micro Circuits Corporation */
d5df0a
 		switch (cpuid) {
d5df0a
diff --git a/libop/op_cpu_type.h b/libop/op_cpu_type.h
d5df0a
index 3754156..aebd7f6 100644
d5df0a
--- a/libop/op_cpu_type.h
d5df0a
+++ b/libop/op_cpu_type.h
d5df0a
@@ -111,6 +111,7 @@ typedef enum {
d5df0a
 	CPU_SILVERMONT, /** < Intel Silvermont microarchitecture */
d5df0a
 	CPU_BROADWELL, /** < Intel Broadwell (Core-M) microarchitecture */
d5df0a
 	CPU_ARM_V8_APM_XGENE, /* APM X-Gene */
d5df0a
+	CPU_ARM_V8_CA57, /* ARM Cortex-A57 */
d5df0a
 	MAX_CPU_TYPE
d5df0a
 } op_cpu;
d5df0a
 
d5df0a
diff --git a/libop/op_events.c b/libop/op_events.c
d5df0a
index b8900a5..d5249b7 100644
d5df0a
--- a/libop/op_events.c
d5df0a
+++ b/libop/op_events.c
d5df0a
@@ -1255,6 +1255,7 @@ void op_default_event(op_cpu cpu_type, struct op_default_event_descr * descr)
d5df0a
 		case CPU_ARM_SCORPION:
d5df0a
 		case CPU_ARM_SCORPIONMP:
d5df0a
 		case CPU_ARM_V8_APM_XGENE:
d5df0a
+		case CPU_ARM_V8_CA57:
d5df0a
 			descr->name = "CPU_CYCLES";
d5df0a
 			break;
d5df0a
 
d5df0a
diff --git a/utils/ophelp.c b/utils/ophelp.c
d5df0a
index bf3fbcb..a5edf56 100644
d5df0a
--- a/utils/ophelp.c
d5df0a
+++ b/utils/ophelp.c
d5df0a
@@ -664,6 +664,12 @@ int main(int argc, char const * argv[])
d5df0a
 			"DDI (ARM DDI0487A.a)\n";
d5df0a
 		break;
d5df0a
 
d5df0a
+	case CPU_ARM_V8_CA57:
d5df0a
+		event_doc =
d5df0a
+			"See Cortex-A57 MPCore Technical Reference Manual\n"
d5df0a
+			"Cortex A57 DDI (ARM DDI 0488D, revision r1p1)\n";
d5df0a
+		break;
d5df0a
+
d5df0a
 	case CPU_PPC64_PA6T:
d5df0a
 		event_doc =
d5df0a
 			"See PA6T Power Implementation Features Book IV\n"
d5df0a
-- 
d5df0a
1.9.3
d5df0a
d5df0a
From 78db0d3eb65e6005931b0402484e759c35df79f1 Mon Sep 17 00:00:00 2001
d5df0a
From: William Cohen <wcohen@redhat.com>
d5df0a
Date: Wed, 23 Jul 2014 23:25:21 -0400
d5df0a
Subject: [PATCH] Add oprofile support for ARM Cortex A53 microarchitecture
d5df0a
d5df0a
This patch adds the event list of the ARM Cortex A53 architecture.
d5df0a
d5df0a
The patch is very straight forward: just add the model numbers and
d5df0a
type in the usual places and add the event list.
d5df0a
d5df0a
Passes make check
d5df0a
d5df0a
Signed-off-by: William Cohen <wcohen@redhat.com>
d5df0a
---
d5df0a
 events/Makefile.am               |  1 +
d5df0a
 events/arm/armv8-ca53/events     | 38 ++++++++++++++++++++++++++++++++++++++
d5df0a
 events/arm/armv8-ca53/unit_masks |  3 +++
d5df0a
 libop/op_cpu_type.c              |  3 +++
d5df0a
 libop/op_cpu_type.h              |  1 +
d5df0a
 libop/op_events.c                |  1 +
d5df0a
 utils/ophelp.c                   |  6 ++++++
d5df0a
 7 files changed, 53 insertions(+)
d5df0a
 create mode 100644 events/arm/armv8-ca53/events
d5df0a
 create mode 100644 events/arm/armv8-ca53/unit_masks
d5df0a
d5df0a
diff --git a/events/Makefile.am b/events/Makefile.am
d5df0a
index b4bca1e..67be125 100644
d5df0a
--- a/events/Makefile.am
d5df0a
+++ b/events/Makefile.am
d5df0a
@@ -63,6 +63,7 @@ event_files = \
d5df0a
 	arm/armv8-pmuv3-common/events arm/armv8-pmuv3-common/unit_masks \
d5df0a
 	arm/armv8-xgene/events arm/armv8-xgene/unit_masks \
d5df0a
 	arm/armv8-ca57/events arm/armv8-ca57/unit_masks \
d5df0a
+	arm/armv8-ca53/events arm/armv8-ca53/unit_masks \
d5df0a
 	avr32/events avr32/unit_masks \
d5df0a
 	mips/20K/events mips/20K/unit_masks \
d5df0a
 	mips/24K/events mips/24K/unit_masks \
d5df0a
diff --git a/events/arm/armv8-ca53/events b/events/arm/armv8-ca53/events
d5df0a
new file mode 100644
d5df0a
index 0000000..5e1b4d8
d5df0a
--- /dev/null
d5df0a
+++ b/events/arm/armv8-ca53/events
d5df0a
@@ -0,0 +1,38 @@
d5df0a
+#
d5df0a
+# Copyright (c) Red Hat, 2014.
d5df0a
+# Contributed by William Cohen <wcohen@redhat.com>
d5df0a
+#
d5df0a
+# ARM Cortex A53 events
d5df0a
+# From Cortex A53 TRM
d5df0a
+#
d5df0a
+include:arm/armv8-pmuv3-common
d5df0a
+event:0x60 um:zero minimum:10007 name:BUS_ACCESS_LD : Bus access - Read
d5df0a
+event:0x61 um:zero minimum:10007 name:BUS_ACCESS_ST : Bus access - Write
d5df0a
+event:0x7A um:zero minimum:10007 name:BR_INDIRECT_SPEC : Branch speculatively executed - Indirect branch
d5df0a
+event:0x86 um:zero minimum:10007 name:EXC_IRQ : Exception taken, IRQ
d5df0a
+event:0x87 um:zero minimum:10007 name:EXC_FIQ : Exception taken, FIQ
d5df0a
+event:0xC0 um:zero minimum:10007 name:EXT_MEM_REQ : External memory request
d5df0a
+event:0xC1 um:zero minimum:10007 name:EXT_MEM_REQ_NC : Non-cacheable external memory request
d5df0a
+event:0xC2 um:zero minimum:10007 name:PREFETCH_LINEFILL : Linefill because of prefetch
d5df0a
+event:0xC3 um:zero minimum:10007 name:PREFETCH_LINEFILL_DROP : Instruction Cache Throttle occurred
d5df0a
+event:0xC4 um:zero minimum:10007 name:READ_ALLOC_ENTER : Entering read allocate mode
d5df0a
+event:0xC5 um:zero minimum:10007 name:READ_ALLOC : Read allocate mode
d5df0a
+event:0xC6 um:zero minimum:10007 name:PRE_DECODE_ERR : Pre-decode error
d5df0a
+event:0xC7 um:zero minimum:10007 name:STALL_SB_FULL : Data Write operation that stalls the pipeline because the store buffer is full
d5df0a
+event:0xC8 um:zero minimum:10007 name:EXT_SNOOP : SCU Snooped data from another CPU for this CPU
d5df0a
+event:0xC9 um:zero minimum:10007 name:BR_COND : Conditional branch executed
d5df0a
+event:0xCA um:zero minimum:10007 name:BR_INDIRECT_MISPRED : Indirect branch mispredicted
d5df0a
+event:0xCB um:zero minimum:10007 name:BR_INDIRECT_MISPRED_ADDR : Indirect branch mispredicted because of address miscompare
d5df0a
+event:0xCC um:zero minimum:10007 name:BR_COND_MISPRED : Conditional branch mispredicted
d5df0a
+event:0xD0 um:zero minimum:10007 name:L1I_CACHE_ERR : L1 Instruction Cache (data or tag) memory error
d5df0a
+event:0xD1 um:zero minimum:10007 name:L1D_CACHE_ERR : L1 Data Cache (data, tag or dirty) memory error, correctable or non-correctable
d5df0a
+event:0xD2 um:zero minimum:10007 name:TLB_ERR : TLB memory error
d5df0a
+event:0xE0 um:zero minimum:10007 name:OTHER_IQ_DEP_STALL : Cycles that the DPU IQ is empty and that is not because of a recent micro-TLB miss, instruction cache miss or pre-decode error
d5df0a
+event:0xE1 um:zero minimum:10007 name:IC_DEP_STALL : Cycles the DPU IQ is empty and there is an instruction cache miss being processed
d5df0a
+event:0xE2 um:zero minimum:10007 name:IUTLB_DEP_STALL : Cycles the DPU IQ is empty and there is an instruction micro-TLB miss being processed
d5df0a
+event:0xE3 um:zero minimum:10007 name:DECODE_DEP_STALL : Cycles the DPU IQ is empty and there is a pre-decode error being processed
d5df0a
+event:0xE4 um:zero minimum:10007 name:OTHER_INTERLOCK_STALL : Cycles there is an interlock other than  Advanced SIMD/Floating-point instructions or load/store instruction
d5df0a
+event:0xE5 um:zero minimum:10007 name:AGU_DEP_STALL : Cycles there is an interlock for a load/store instruction waiting for data to calculate the address in the AGU
d5df0a
+event:0xE6 um:zero minimum:10007 name:SIMD_DEP_STALL : Cycles there is an interlock for an Advanced SIMD/Floating-point operation.
d5df0a
+event:0xE7 um:zero minimum:10007 name:LD_DEP_STALL : Cycles there is a stall in the Wr stage because of a load miss
d5df0a
+event:0xE8 um:zero minimum:10007 name:ST_DEP_STALL : Cycles there is a stall in the Wr stage because of a store
d5df0a
diff --git a/events/arm/armv8-ca53/unit_masks b/events/arm/armv8-ca53/unit_masks
d5df0a
new file mode 100644
d5df0a
index 0000000..42b12b4
d5df0a
--- /dev/null
d5df0a
+++ b/events/arm/armv8-ca53/unit_masks
d5df0a
@@ -0,0 +1,3 @@
d5df0a
+# ARMv8 Cortex A53 unit masks
d5df0a
+#
d5df0a
+include:arm/armv8-pmuv3-common
d5df0a
diff --git a/libop/op_cpu_type.c b/libop/op_cpu_type.c
d5df0a
index 163bd1c..055c64b 100644
d5df0a
--- a/libop/op_cpu_type.c
d5df0a
+++ b/libop/op_cpu_type.c
d5df0a
@@ -132,6 +132,7 @@ static struct cpu_descr const cpu_descrs[MAX_CPU_TYPE] = {
d5df0a
 	{ "Intel Broadwell microarchitecture", "i386/broadwell", CPU_BROADWELL, 4 },
d5df0a
	{ "APM X-Gene", "arm/armv8-xgene", CPU_ARM_V8_APM_XGENE, 6 },
d5df0a
	{ "ARM Cortex-A57", "arm/armv8-ca57", CPU_ARM_V8_CA57, 6},
d5df0a
+	{ "ARM Cortex-A53", "arm/armv8-ca53", CPU_ARM_V8_CA53, 6},
d5df0a
 };
d5df0a
  
d5df0a
 static size_t const nr_cpu_descrs = sizeof(cpu_descrs) / sizeof(struct cpu_descr);
d5df0a
@@ -399,6 +400,8 @@ static op_cpu _get_arm_cpu_type(void)
d5df0a
 			return op_get_cpu_number("arm/armv7-ca15");
d5df0a
 		case 0xd07:
d5df0a
 			return op_get_cpu_number("arm/armv8-ca57");
d5df0a
+		case 0xd03:
d5df0a
+			return op_get_cpu_number("arm/armv8-ca53");
d5df0a
 		}
d5df0a
 	} else if (vendorid == 0x50) {	/* Applied Micro Circuits Corporation */
d5df0a
 		switch (cpuid) {
d5df0a
diff --git a/libop/op_cpu_type.h b/libop/op_cpu_type.h
d5df0a
index aebd7f6..a6bb323 100644
d5df0a
--- a/libop/op_cpu_type.h
d5df0a
+++ b/libop/op_cpu_type.h
d5df0a
@@ -112,6 +112,7 @@ typedef enum {
d5df0a
 	CPU_BROADWELL, /** < Intel Broadwell (Core-M) microarchitecture */
d5df0a
 	CPU_ARM_V8_APM_XGENE, /* APM X-Gene */
d5df0a
 	CPU_ARM_V8_CA57, /* ARM Cortex-A57 */
d5df0a
+	CPU_ARM_V8_CA53, /* ARM Cortex-A53 */
d5df0a
 	MAX_CPU_TYPE
d5df0a
 } op_cpu;
d5df0a
 
d5df0a
diff --git a/libop/op_events.c b/libop/op_events.c
d5df0a
index d5249b7..bbeb212 100644
d5df0a
--- a/libop/op_events.c
d5df0a
+++ b/libop/op_events.c
d5df0a
@@ -1256,6 +1256,7 @@ void op_default_event(op_cpu cpu_type, struct op_default_event_descr * descr)
d5df0a
 		case CPU_ARM_SCORPIONMP:
d5df0a
 		case CPU_ARM_V8_APM_XGENE:
d5df0a
 		case CPU_ARM_V8_CA57:
d5df0a
+		case CPU_ARM_V8_CA53:
d5df0a
 			descr->name = "CPU_CYCLES";
d5df0a
 			break;
d5df0a
 
d5df0a
diff --git a/utils/ophelp.c b/utils/ophelp.c
d5df0a
index a5edf56..980c6dc 100644
d5df0a
--- a/utils/ophelp.c
d5df0a
+++ b/utils/ophelp.c
d5df0a
@@ -670,6 +670,12 @@ int main(int argc, char const * argv[])
d5df0a
 			"Cortex A57 DDI (ARM DDI 0488D, revision r1p1)\n";
d5df0a
 		break;
d5df0a
 
d5df0a
+	case CPU_ARM_V8_CA53:
d5df0a
+		event_doc =
d5df0a
+			"See Cortex-A53 MPCore Technical Reference Manual\n"
d5df0a
+			"Cortex A57 DDI (ARM DDI 0500D, revision r0p2)\n";
d5df0a
+		break;
d5df0a
+
d5df0a
 	case CPU_PPC64_PA6T:
d5df0a
 		event_doc =
d5df0a
 			"See PA6T Power Implementation Features Book IV\n"
d5df0a
-- 
d5df0a
1.9.3
d5df0a
d5df0a
From 76464b279cf20bb0bb40e758afb32eaf4195d861 Mon Sep 17 00:00:00 2001
d5df0a
From: Maynard Johnson <maynardj@us.ibm.com>
d5df0a
Date: Fri, 1 Aug 2014 09:06:17 -0500
d5df0a
Subject: [PATCH 1/2] Add another ARM internal mapping symbol to ignore
d5df0a
d5df0a
Ignore "$x" symbols, which can show up as internal
d5df0a
mapping symbols in binaries built on Aarch64.
d5df0a
d5df0a
Reported-byP: Andrew Haley <aph@redhat.com>
d5df0a
Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
d5df0a
---
d5df0a
 libutil++/bfd_support.cpp | 3 ++-
d5df0a
 1 file changed, 2 insertions(+), 1 deletion(-)
d5df0a
d5df0a
diff --git a/libutil++/bfd_support.cpp b/libutil++/bfd_support.cpp
d5df0a
index a3bee99..0554616 100644
d5df0a
--- a/libutil++/bfd_support.cpp
d5df0a
+++ b/libutil++/bfd_support.cpp
d5df0a
@@ -475,7 +475,8 @@ bool interesting_symbol(asymbol * sym)
d5df0a
 	/* ARM assembler internal mapping symbols aren't interesting */
d5df0a
 	if ((strcmp("$a", sym->name) == 0) ||
d5df0a
 	    (strcmp("$t", sym->name) == 0) ||
d5df0a
-	    (strcmp("$d", sym->name) == 0))
d5df0a
+	    (strcmp("$d", sym->name) == 0))||
d5df0a
+	    (strcmp("$x", sym->name) == 0))
d5df0a
 		return false;
d5df0a
 
d5df0a
 	// C++ exception stuff
d5df0a
-- 
d5df0a
1.9.3
d5df0a
d5df0a
From a4bdbc9ce94b15df3d19d60a11e4c4f2fc729cd9 Mon Sep 17 00:00:00 2001
d5df0a
From: Maynard Johnson <maynardj@us.ibm.com>
d5df0a
Date: Fri, 1 Aug 2014 09:25:55 -0500
d5df0a
Subject: [PATCH 2/2] Fix mis-placed parentheses in previous commit that caused
d5df0a
 build error
d5df0a
d5df0a
Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
d5df0a
---
d5df0a
 libutil++/bfd_support.cpp | 2 +-
d5df0a
 1 file changed, 1 insertion(+), 1 deletion(-)
d5df0a
d5df0a
diff --git a/libutil++/bfd_support.cpp b/libutil++/bfd_support.cpp
d5df0a
index 0554616..d5fd70d 100644
d5df0a
--- a/libutil++/bfd_support.cpp
d5df0a
+++ b/libutil++/bfd_support.cpp
d5df0a
@@ -475,7 +475,7 @@ bool interesting_symbol(asymbol * sym)
d5df0a
 	/* ARM assembler internal mapping symbols aren't interesting */
d5df0a
 	if ((strcmp("$a", sym->name) == 0) ||
d5df0a
 	    (strcmp("$t", sym->name) == 0) ||
d5df0a
-	    (strcmp("$d", sym->name) == 0))||
d5df0a
+	    (strcmp("$d", sym->name) == 0) ||
d5df0a
 	    (strcmp("$x", sym->name) == 0))
d5df0a
 		return false;
d5df0a
 
d5df0a
-- 
d5df0a
1.9.3
d5df0a