Blame SOURCES/oprofile-aarch64.patch

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