Blame SOURCES/oprofile-aarch64.patch

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