summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Medhurst2013-10-10 10:36:16 -0500
committerJon Medhurst2013-10-10 10:36:16 -0500
commit689bdf8057462a77535c1b6396410e264ae11e6b (patch)
tree634481fc93eef3aa73b4911abe9eda9fe5722bf4
parentf15a1807ecf7af6dd0cac9e175ff00bf06d7c304 (diff)
downloadarm-ds5-gator-689bdf8057462a77535c1b6396410e264ae11e6b.tar.gz
arm-ds5-gator-689bdf8057462a77535c1b6396410e264ae11e6b.tar.xz
arm-ds5-gator-689bdf8057462a77535c1b6396410e264ae11e6b.zip
gator: Version 5.16
Signed-off-by: Jon Medhurst <tixy@linaro.org>
-rwxr-xr-xREADME_Streamline.txt2
-rw-r--r--daemon/Android.mk104
-rw-r--r--daemon/Buffer.cpp14
-rw-r--r--daemon/Buffer.h5
-rw-r--r--daemon/CapturedXML.cpp8
-rw-r--r--daemon/Child.cpp3
-rw-r--r--daemon/ConfigurationXML.cpp38
-rw-r--r--daemon/ConfigurationXML.h2
-rw-r--r--daemon/Hwmon.cpp2
-rw-r--r--daemon/KMod.cpp4
-rw-r--r--daemon/OlyUtility.cpp5
-rw-r--r--daemon/Sender.cpp9
-rw-r--r--daemon/SessionData.h2
-rw-r--r--daemon/StreamlineSetup.cpp7
-rw-r--r--daemon/StreamlineSetup.h1
-rw-r--r--daemon/events-CCN-504.xml122
-rw-r--r--daemon/events-Cortex-A12.xml86
-rw-r--r--daemon/events-Linux.xml4
-rw-r--r--daemon/events-Mali-4xx.xml (renamed from daemon/events-Mali-400.xml)277
-rw-r--r--daemon/events-Mali-T6xx_hw.xml4
-rw-r--r--daemon/main.cpp115
-rw-r--r--driver/Makefile8
-rw-r--r--driver/gator.h8
-rw-r--r--driver/gator_annotate.c21
-rw-r--r--driver/gator_cookies.c8
-rw-r--r--driver/gator_events_ccn-504.c306
-rw-r--r--driver/gator_events_mali_4xx.c (renamed from driver/gator_events_mali_400.c)563
-rw-r--r--driver/gator_events_mali_4xx.h (renamed from driver/gator_events_mali_400.h)8
-rw-r--r--driver/gator_events_mali_common.c4
-rw-r--r--driver/gator_events_mali_common.h10
-rw-r--r--driver/gator_events_mali_t6xx_hw.c16
-rw-r--r--driver/gator_events_mmaped.c6
-rw-r--r--driver/gator_hrtimer_gator.c10
-rw-r--r--driver/gator_iks.c35
-rw-r--r--driver/gator_main.c99
-rw-r--r--driver/gator_marshaling.c74
-rw-r--r--driver/gator_trace_gpu.c40
-rw-r--r--driver/gator_trace_sched.c98
-rw-r--r--driver/mali/mali_mjollnir_profiling_gator_api.h164
-rw-r--r--driver/mali/mali_utgard_profiling_gator_api.h202
40 files changed, 1850 insertions, 644 deletions
diff --git a/README_Streamline.txt b/README_Streamline.txt
index 6a55f60..744c33f 100755
--- a/README_Streamline.txt
+++ b/README_Streamline.txt
@@ -117,7 +117,7 @@ There is a bug in some Linux kernels where perf misidentifies the CPU type. To s
117# ls /sys/bus/event_source/devices/ 117# ls /sys/bus/event_source/devices/
118ARMv7_Cortex_A9 breakpoint software tracepoint 118ARMv7_Cortex_A9 breakpoint software tracepoint
119 119
120To workaround the issue try upgrading to a later kernel or comment out the gator_events_perf_pmu_cpu_init(gator_cpu, type); cal in gator_events_perf_pmu.c 120To work around the issue try upgrading to a later kernel or comment out the gator_events_perf_pmu_cpu_init(gator_cpu, type); call in gator_events_perf_pmu.c
121 121
122*** Profiling the kernel (optional) *** 122*** Profiling the kernel (optional) ***
123 123
diff --git a/daemon/Android.mk b/daemon/Android.mk
index 4798a0a..a042971 100644
--- a/daemon/Android.mk
+++ b/daemon/Android.mk
@@ -1,52 +1,52 @@
1LOCAL_PATH := $(call my-dir) 1LOCAL_PATH := $(call my-dir)
2include $(CLEAR_VARS) 2include $(CLEAR_VARS)
3 3
4XML_H := $(shell cd $(LOCAL_PATH) && make events_xml.h configuration_xml.h) 4XML_H := $(shell cd $(LOCAL_PATH) && make events_xml.h configuration_xml.h)
5 5
6LOCAL_CFLAGS += -Wall -O3 -mthumb-interwork -fno-exceptions -DETCDIR=\"/etc\" -Ilibsensors 6LOCAL_CFLAGS += -Wall -O3 -mthumb-interwork -fno-exceptions -DETCDIR=\"/etc\" -Ilibsensors
7 7
8LOCAL_SRC_FILES := \ 8LOCAL_SRC_FILES := \
9 Buffer.cpp \ 9 Buffer.cpp \
10 CapturedXML.cpp \ 10 CapturedXML.cpp \
11 Child.cpp \ 11 Child.cpp \
12 Collector.cpp \ 12 Collector.cpp \
13 ConfigurationXML.cpp \ 13 ConfigurationXML.cpp \
14 Driver.cpp \ 14 Driver.cpp \
15 EventsXML.cpp \ 15 EventsXML.cpp \
16 Fifo.cpp \ 16 Fifo.cpp \
17 Hwmon.cpp \ 17 Hwmon.cpp \
18 KMod.cpp \ 18 KMod.cpp \
19 LocalCapture.cpp \ 19 LocalCapture.cpp \
20 Logging.cpp \ 20 Logging.cpp \
21 main.cpp \ 21 main.cpp \
22 OlySocket.cpp \ 22 OlySocket.cpp \
23 OlyUtility.cpp \ 23 OlyUtility.cpp \
24 Sender.cpp \ 24 Sender.cpp \
25 SessionData.cpp \ 25 SessionData.cpp \
26 SessionXML.cpp \ 26 SessionXML.cpp \
27 StreamlineSetup.cpp \ 27 StreamlineSetup.cpp \
28 libsensors/access.c \ 28 libsensors/access.c \
29 libsensors/conf-lex.c \ 29 libsensors/conf-lex.c \
30 libsensors/conf-parse.c \ 30 libsensors/conf-parse.c \
31 libsensors/data.c \ 31 libsensors/data.c \
32 libsensors/error.c \ 32 libsensors/error.c \
33 libsensors/general.c \ 33 libsensors/general.c \
34 libsensors/init.c \ 34 libsensors/init.c \
35 libsensors/sysfs.c \ 35 libsensors/sysfs.c \
36 mxml/mxml-attr.c \ 36 mxml/mxml-attr.c \
37 mxml/mxml-entity.c \ 37 mxml/mxml-entity.c \
38 mxml/mxml-file.c \ 38 mxml/mxml-file.c \
39 mxml/mxml-get.c \ 39 mxml/mxml-get.c \
40 mxml/mxml-index.c \ 40 mxml/mxml-index.c \
41 mxml/mxml-node.c \ 41 mxml/mxml-node.c \
42 mxml/mxml-private.c \ 42 mxml/mxml-private.c \
43 mxml/mxml-search.c \ 43 mxml/mxml-search.c \
44 mxml/mxml-set.c \ 44 mxml/mxml-set.c \
45 mxml/mxml-string.c 45 mxml/mxml-string.c
46 46
47LOCAL_C_INCLUDES := $(LOCAL_PATH) 47LOCAL_C_INCLUDES := $(LOCAL_PATH)
48 48
49LOCAL_MODULE := gatord 49LOCAL_MODULE := gatord
50LOCAL_MODULE_TAGS := optional 50LOCAL_MODULE_TAGS := optional
51 51
52include $(BUILD_EXECUTABLE) 52include $(BUILD_EXECUTABLE)
diff --git a/daemon/Buffer.cpp b/daemon/Buffer.cpp
index 56cf42c..c7abbf3 100644
--- a/daemon/Buffer.cpp
+++ b/daemon/Buffer.cpp
@@ -14,11 +14,7 @@
14 14
15#define mask (size - 1) 15#define mask (size - 1)
16 16
17Buffer::Buffer (const int32_t core, const int32_t buftype, const int size, sem_t *const readerSem) : core(core), buftype(buftype), size(size), readPos(0), writePos(0), commitPos(0), available(true), done(false), buf(new char[size]), 17Buffer::Buffer (const int32_t core, const int32_t buftype, const int size, sem_t *const readerSem) : core(core), buftype(buftype), size(size), readPos(0), writePos(0), commitPos(0), available(true), done(false), buf(new char[size]), commitTime(gSessionData->mLiveRate), readerSem(readerSem) {
18#ifdef GATOR_LIVE
19 commitTime(gSessionData->mLiveRate),
20#endif
21 readerSem(readerSem) {
22 if ((size & mask) != 0) { 18 if ((size & mask) != 0) {
23 logg->logError(__FILE__, __LINE__, "Buffer size is not a power of 2"); 19 logg->logError(__FILE__, __LINE__, "Buffer size is not a power of 2");
24 handleException(); 20 handleException();
@@ -110,13 +106,11 @@ void Buffer::commit (const uint64_t time) {
110 logg->logMessage("Committing data readPos: %i writePos: %i commitPos: %i", readPos, writePos, commitPos); 106 logg->logMessage("Committing data readPos: %i writePos: %i commitPos: %i", readPos, writePos, commitPos);
111 commitPos = writePos; 107 commitPos = writePos;
112 108
113#ifdef GATOR_LIVE
114 if (gSessionData->mLiveRate > 0) { 109 if (gSessionData->mLiveRate > 0) {
115 while (time > commitTime) { 110 while (time > commitTime) {
116 commitTime += gSessionData->mLiveRate; 111 commitTime += gSessionData->mLiveRate;
117 } 112 }
118 } 113 }
119#endif
120 114
121 if (!done) { 115 if (!done) {
122 frame(); 116 frame();
@@ -131,11 +125,7 @@ void Buffer::check (const uint64_t time) {
131 if (filled < 0) { 125 if (filled < 0) {
132 filled += size; 126 filled += size;
133 } 127 }
134 if (filled >= ((size * 3) / 4) 128 if (filled >= ((size * 3) / 4) || (gSessionData->mLiveRate > 0 && time >= commitTime)) {
135#ifdef GATOR_LIVE
136 || (gSessionData->mLiveRate > 0 && time >= commitTime)
137#endif
138 ) {
139 commit(time); 129 commit(time);
140 } 130 }
141} 131}
diff --git a/daemon/Buffer.h b/daemon/Buffer.h
index c460fb7..f820cfd 100644
--- a/daemon/Buffer.h
+++ b/daemon/Buffer.h
@@ -13,8 +13,6 @@
13#include <stdint.h> 13#include <stdint.h>
14#include <semaphore.h> 14#include <semaphore.h>
15 15
16#define GATOR_LIVE
17
18class Sender; 16class Sender;
19 17
20class Buffer { 18class Buffer {
@@ -56,10 +54,7 @@ private:
56 bool available; 54 bool available;
57 bool done; 55 bool done;
58 char *const buf; 56 char *const buf;
59#ifdef GATOR_LIVE
60 uint64_t commitTime; 57 uint64_t commitTime;
61#endif
62
63 sem_t *const readerSem; 58 sem_t *const readerSem;
64}; 59};
65 60
diff --git a/daemon/CapturedXML.cpp b/daemon/CapturedXML.cpp
index af726df..30c4c44 100644
--- a/daemon/CapturedXML.cpp
+++ b/daemon/CapturedXML.cpp
@@ -43,6 +43,14 @@ mxml_node_t* CapturedXML::getTree(bool includeTime) {
43 mxmlElementSetAttrf(target, "cores", "%d", gSessionData->mCores); 43 mxmlElementSetAttrf(target, "cores", "%d", gSessionData->mCores);
44 mxmlElementSetAttrf(target, "cpuid", "0x%x", gSessionData->mCpuId); 44 mxmlElementSetAttrf(target, "cpuid", "0x%x", gSessionData->mCpuId);
45 45
46 if (!gSessionData->mOneShot && (gSessionData->mSampleRate > 0)) {
47 mxmlElementSetAttr(target, "supports_live", "yes");
48 }
49
50 if (gSessionData->mLocalCapture) {
51 mxmlElementSetAttr(target, "local_capture", "yes");
52 }
53
46 mxml_node_t *counters = NULL; 54 mxml_node_t *counters = NULL;
47 for (x = 0; x < MAX_PERFORMANCE_COUNTERS; x++) { 55 for (x = 0; x < MAX_PERFORMANCE_COUNTERS; x++) {
48 const Counter & counter = gSessionData->mCounters[x]; 56 const Counter & counter = gSessionData->mCounters[x];
diff --git a/daemon/Child.cpp b/daemon/Child.cpp
index 286c7e7..c054076 100644
--- a/daemon/Child.cpp
+++ b/daemon/Child.cpp
@@ -55,6 +55,9 @@ void handleException() {
55 child->socket->receiveNBytes(&discard, 1); 55 child->socket->receiveNBytes(&discard, 1);
56 } 56 }
57 57
58 // Ensure all data is flushed
59 child->socket->shutdownConnection();
60
58 // this indirectly calls close socket which will ensure the data has been sent 61 // this indirectly calls close socket which will ensure the data has been sent
59 delete sender; 62 delete sender;
60 } 63 }
diff --git a/daemon/ConfigurationXML.cpp b/daemon/ConfigurationXML.cpp
index fb00202..2a5252a 100644
--- a/daemon/ConfigurationXML.cpp
+++ b/daemon/ConfigurationXML.cpp
@@ -27,14 +27,7 @@ ConfigurationXML::ConfigurationXML() {
27 27
28 char path[PATH_MAX]; 28 char path[PATH_MAX];
29 29
30 if (gSessionData->mConfigurationXMLPath) { 30 getPath(path);
31 strncpy(path, gSessionData->mConfigurationXMLPath, PATH_MAX);
32 } else {
33 if (util->getApplicationFullPath(path, PATH_MAX) != 0) {
34 logg->logMessage("Unable to determine the full path of gatord, the cwd will be used");
35 }
36 strncat(path, "configuration.xml", PATH_MAX - strlen(path) - 1);
37 }
38 mConfigurationXML = util->readFromDisk(path); 31 mConfigurationXML = util->readFromDisk(path);
39 32
40 for (int retryCount = 0; retryCount < 2; ++retryCount) { 33 for (int retryCount = 0; retryCount < 2; ++retryCount) {
@@ -48,12 +41,7 @@ ConfigurationXML::ConfigurationXML() {
48 41
49 int ret = parse(mConfigurationXML); 42 int ret = parse(mConfigurationXML);
50 if (ret == 1) { 43 if (ret == 1) {
51 // remove configuration.xml on disk to use the default 44 remove();
52 if (remove(path) != 0) {
53 logg->logError(__FILE__, __LINE__, "Invalid configuration.xml file detected and unable to delete it. To resolve, delete configuration.xml on disk");
54 handleException();
55 }
56 logg->logMessage("Invalid configuration.xml file detected and removed");
57 45
58 // Free the current configuration and reload 46 // Free the current configuration and reload
59 free((void*)mConfigurationXML); 47 free((void*)mConfigurationXML);
@@ -197,3 +185,25 @@ void ConfigurationXML::getDefaultConfigurationXml(const char * & xml, unsigned i
197 xml = (const char *)configuration_xml; 185 xml = (const char *)configuration_xml;
198 len = configuration_xml_len; 186 len = configuration_xml_len;
199} 187}
188
189void ConfigurationXML::getPath(char* path) {
190 if (gSessionData->mConfigurationXMLPath) {
191 strncpy(path, gSessionData->mConfigurationXMLPath, PATH_MAX);
192 } else {
193 if (util->getApplicationFullPath(path, PATH_MAX) != 0) {
194 logg->logMessage("Unable to determine the full path of gatord, the cwd will be used");
195 }
196 strncat(path, "configuration.xml", PATH_MAX - strlen(path) - 1);
197 }
198}
199
200void ConfigurationXML::remove() {
201 char path[PATH_MAX];
202 getPath(path);
203
204 if (::remove(path) != 0) {
205 logg->logError(__FILE__, __LINE__, "Invalid configuration.xml file detected and unable to delete it. To resolve, delete configuration.xml on disk");
206 handleException();
207 }
208 logg->logMessage("Invalid configuration.xml file detected and removed");
209}
diff --git a/daemon/ConfigurationXML.h b/daemon/ConfigurationXML.h
index f709ad1..eba7dc4 100644
--- a/daemon/ConfigurationXML.h
+++ b/daemon/ConfigurationXML.h
@@ -14,6 +14,8 @@
14class ConfigurationXML { 14class ConfigurationXML {
15public: 15public:
16 static void getDefaultConfigurationXml(const char * & xml, unsigned int & len); 16 static void getDefaultConfigurationXml(const char * & xml, unsigned int & len);
17 static void getPath(char* path);
18 static void remove();
17 19
18 ConfigurationXML(); 20 ConfigurationXML();
19 ~ConfigurationXML(); 21 ~ConfigurationXML();
diff --git a/daemon/Hwmon.cpp b/daemon/Hwmon.cpp
index 9475215..0792568 100644
--- a/daemon/Hwmon.cpp
+++ b/daemon/Hwmon.cpp
@@ -73,7 +73,7 @@ HwmonCounter::HwmonCounter(HwmonCounter *next, int key, const sensors_chip_name
73 73
74 len = snprintf(NULL, 0, "hwmon_%s_%d", chip_name, feature->number) + 1; 74 len = snprintf(NULL, 0, "hwmon_%s_%d", chip_name, feature->number) + 1;
75 name = new char[len]; 75 name = new char[len];
76 len = snprintf(name, len, "hwmon_%s_%d", chip_name, feature->number); 76 snprintf(name, len, "hwmon_%s_%d", chip_name, feature->number);
77 77
78 delete [] chip_name; 78 delete [] chip_name;
79 79
diff --git a/daemon/KMod.cpp b/daemon/KMod.cpp
index 04f3330..559297f 100644
--- a/daemon/KMod.cpp
+++ b/daemon/KMod.cpp
@@ -13,6 +13,7 @@
13#include <unistd.h> 13#include <unistd.h>
14 14
15#include "Collector.h" 15#include "Collector.h"
16#include "ConfigurationXML.h"
16#include "Counter.h" 17#include "Counter.h"
17#include "Logging.h" 18#include "Logging.h"
18 19
@@ -73,7 +74,8 @@ void KMod::setupCounter(Counter &counter) {
73 } 74 }
74 counter.setCount(count); 75 counter.setCount(count);
75 } else if (counter.getCount() > 0) { 76 } else if (counter.getCount() > 0) {
76 logg->logError(__FILE__, __LINE__, "Event Based Sampling is only supported with kernel versions 3.0.0 and higher with CONFIG_PERF_EVENTS=y, and CONFIG_HW_PERF_EVENTS=y\n"); 77 ConfigurationXML::remove();
78 logg->logError(__FILE__, __LINE__, "Event Based Sampling is only supported with kernel versions 3.0.0 and higher with CONFIG_PERF_EVENTS=y, and CONFIG_HW_PERF_EVENTS=y. The invalid configuration.xml has been removed.\n");
77 handleException(); 79 handleException();
78 } 80 }
79} 81}
diff --git a/daemon/OlyUtility.cpp b/daemon/OlyUtility.cpp
index b29a1e9..0b22d6e 100644
--- a/daemon/OlyUtility.cpp
+++ b/daemon/OlyUtility.cpp
@@ -83,7 +83,7 @@ int OlyUtility::getApplicationFullPath(char* fullpath, int sizeOfPath) {
83 } 83 }
84 84
85 fullpath[length] = 0; 85 fullpath[length] = 0;
86 fullpath = getPathPart(fullpath); 86 getPathPart(fullpath);
87 87
88 return 0; 88 return 0;
89} 89}
@@ -171,7 +171,7 @@ int OlyUtility::appendToDisk(const char* path, const char* data) {
171 */ 171 */
172#define TRANSFER_SIZE 1024 172#define TRANSFER_SIZE 1024
173int OlyUtility::copyFile(const char* srcFile, const char* dstFile) { 173int OlyUtility::copyFile(const char* srcFile, const char* dstFile) {
174 char* buffer = (char*)malloc(TRANSFER_SIZE); 174 char buffer[TRANSFER_SIZE];
175 FILE * f_src = fopen(srcFile,"rb"); 175 FILE * f_src = fopen(srcFile,"rb");
176 if (!f_src) { 176 if (!f_src) {
177 return 0; 177 return 0;
@@ -197,7 +197,6 @@ int OlyUtility::copyFile(const char* srcFile, const char* dstFile) {
197 } 197 }
198 fclose(f_src); 198 fclose(f_src);
199 fclose(f_dst); 199 fclose(f_dst);
200 free(buffer);
201 return 1; 200 return 1;
202} 201}
203 202
diff --git a/daemon/Sender.cpp b/daemon/Sender.cpp
index 159503f..8eb348f 100644
--- a/daemon/Sender.cpp
+++ b/daemon/Sender.cpp
@@ -93,8 +93,13 @@ void Sender::writeData(const char* data, int length, int type) {
93 logg->logMessage("Sending data with length %d", length); 93 logg->logMessage("Sending data with length %d", length);
94 if (type != RESPONSE_APC_DATA) { 94 if (type != RESPONSE_APC_DATA) {
95 // type and length already added by the Collector for apc data 95 // type and length already added by the Collector for apc data
96 mDataSocket->send((char*)&type, 1); 96 unsigned char header[5];
97 mDataSocket->send((char*)&length, sizeof(length)); 97 header[0] = type;
98 header[1] = (length >> 0) & 0xff;
99 header[2] = (length >> 8) & 0xff;
100 header[3] = (length >> 16) & 0xff;
101 header[4] = (length >> 24) & 0xff;
102 mDataSocket->send((char*)&header, sizeof(header));
98 } 103 }
99 104
100 // 100Kbits/sec * alarmDuration sec / 8 bits/byte 105 // 100Kbits/sec * alarmDuration sec / 8 bits/byte
diff --git a/daemon/SessionData.h b/daemon/SessionData.h
index 22a8af0..e72fa5d 100644
--- a/daemon/SessionData.h
+++ b/daemon/SessionData.h
@@ -16,7 +16,7 @@
16 16
17#define MAX_PERFORMANCE_COUNTERS 50 17#define MAX_PERFORMANCE_COUNTERS 50
18 18
19#define PROTOCOL_VERSION 14 19#define PROTOCOL_VERSION 16
20#define PROTOCOL_DEV 1000 // Differentiates development versions (timestamp) from release versions 20#define PROTOCOL_DEV 1000 // Differentiates development versions (timestamp) from release versions
21 21
22struct ImageLinkList { 22struct ImageLinkList {
diff --git a/daemon/StreamlineSetup.cpp b/daemon/StreamlineSetup.cpp
index e196a7d..2faada2 100644
--- a/daemon/StreamlineSetup.cpp
+++ b/daemon/StreamlineSetup.cpp
@@ -255,12 +255,7 @@ void StreamlineSetup::sendCounters() {
255void StreamlineSetup::writeConfiguration(char* xml) { 255void StreamlineSetup::writeConfiguration(char* xml) {
256 char path[PATH_MAX]; 256 char path[PATH_MAX];
257 257
258 if (gSessionData->mConfigurationXMLPath) { 258 ConfigurationXML::getPath(path);
259 strncpy(path, gSessionData->mConfigurationXMLPath, PATH_MAX);
260 } else {
261 util->getApplicationFullPath(path, PATH_MAX);
262 strncat(path, "configuration.xml", PATH_MAX - strlen(path) - 1);
263 }
264 259
265 if (util->writeToDisk(path, xml) < 0) { 260 if (util->writeToDisk(path, xml) < 0) {
266 logg->logError(__FILE__, __LINE__, "Error writing %s\nPlease verify write permissions to this path.", path); 261 logg->logError(__FILE__, __LINE__, "Error writing %s\nPlease verify write permissions to this path.", path);
diff --git a/daemon/StreamlineSetup.h b/daemon/StreamlineSetup.h
index a27a7ac..092d956 100644
--- a/daemon/StreamlineSetup.h
+++ b/daemon/StreamlineSetup.h
@@ -26,7 +26,6 @@ public:
26 StreamlineSetup(OlySocket *socket); 26 StreamlineSetup(OlySocket *socket);
27 ~StreamlineSetup(); 27 ~StreamlineSetup();
28private: 28private:
29 int mNumConnections;
30 OlySocket* mSocket; 29 OlySocket* mSocket;
31 30
32 char* readCommand(int*); 31 char* readCommand(int*);
diff --git a/daemon/events-CCN-504.xml b/daemon/events-CCN-504.xml
new file mode 100644
index 0000000..cfabf65
--- /dev/null
+++ b/daemon/events-CCN-504.xml
@@ -0,0 +1,122 @@
1 <counter_set name="CCN-504_cnt" count="4"/>
2 <category name="CCN-504" counter_set="CCN-504_cnt">
3 <event counter="CCN-504_ccnt" title="CCN-504 Clock" name="Cycles" display="hertz" units="Hz" average_selection="yes" description="The number of core clock cycles"/>
4
5 <option_set name="XP_Region">
6 <option event_delta="0x400000" name="XP 0" description="Crosspoint 0"/>
7 <option event_delta="0x410000" name="XP 1" description="Crosspoint 1"/>
8 <option event_delta="0x420000" name="XP 2" description="Crosspoint 2"/>
9 <option event_delta="0x430000" name="XP 3" description="Crosspoint 3"/>
10 <option event_delta="0x440000" name="XP 4" description="Crosspoint 4"/>
11 <option event_delta="0x450000" name="XP 5" description="Crosspoint 5"/>
12 <option event_delta="0x460000" name="XP 6" description="Crosspoint 6"/>
13 <option event_delta="0x470000" name="XP 7" description="Crosspoint 7"/>
14 <option event_delta="0x480000" name="XP 8" description="Crosspoint 8"/>
15 <option event_delta="0x490000" name="XP 9" description="Crosspoint 9"/>
16 <option event_delta="0x4A0000" name="XP 10" description="Crosspoint 10"/>
17 </option_set>
18
19 <event event="0x0801" option_set="XP_Region" title="CCN-504" name="Bus 0: REQ: H-bit" description="Bus 0: REQ: Set H-bit, signaled when this XP sets the H-bit."/>
20 <event event="0x0802" option_set="XP_Region" title="CCN-504" name="Bus 0: REQ: S-bit" description="Bus 0: REQ: Set S-bit, signaled when this XP sets the S-bit."/>
21 <event event="0x0803" option_set="XP_Region" title="CCN-504" name="Bus 0: REQ: P-Cnt" description="Bus 0: REQ: Set P-Cnt, signaled when this XP sets the P-Cnt. This is not applicable for the SNP VC."/>
22 <event event="0x0804" option_set="XP_Region" title="CCN-504" name="Bus 0: REQ: TknV" description="Bus 0: REQ: No TknV, signaled when this XP transmits a valid packet."/>
23 <event event="0x0809" option_set="XP_Region" title="CCN-504" name="Bus 1: REQ: H-bit" description="Bus 1: REQ: Set H-bit, signaled when this XP sets the H-bit."/>
24 <event event="0x080A" option_set="XP_Region" title="CCN-504" name="Bus 1: REQ: S-bit" description="Bus 1: REQ: Set S-bit, signaled when this XP sets the S-bit."/>
25 <event event="0x080B" option_set="XP_Region" title="CCN-504" name="Bus 1: REQ: P-Cnt" description="Bus 1: REQ: Set P-Cnt, signaled when this XP sets the P-Cnt. This is not applicable for the SNP VC."/>
26 <event event="0x080C" option_set="XP_Region" title="CCN-504" name="Bus 1: REQ: TknV" description="Bus 1: REQ: No TknV, signaled when this XP transmits a valid packet."/>
27 <event event="0x0811" option_set="XP_Region" title="CCN-504" name="Bus 0: RSP: H-bit" description="Bus 0: RSP: Set H-bit, signaled when this XP sets the H-bit."/>
28 <event event="0x0812" option_set="XP_Region" title="CCN-504" name="Bus 0: RSP: S-bit" description="Bus 0: RSP: Set S-bit, signaled when this XP sets the S-bit."/>
29 <event event="0x0813" option_set="XP_Region" title="CCN-504" name="Bus 0: RSP: P-Cnt" description="Bus 0: RSP: Set P-Cnt, signaled when this XP sets the P-Cnt. This is not applicable for the SNP VC."/>
30 <event event="0x0814" option_set="XP_Region" title="CCN-504" name="Bus 0: RSP: TknV" description="Bus 0: RSP: No TknV, signaled when this XP transmits a valid packet."/>
31 <event event="0x0819" option_set="XP_Region" title="CCN-504" name="Bus 1: RSP: H-bit" description="Bus 1: RSP: Set H-bit, signaled when this XP sets the H-bit."/>
32 <event event="0x081A" option_set="XP_Region" title="CCN-504" name="Bus 1: RSP: S-bit" description="Bus 1: RSP: Set S-bit, signaled when this XP sets the S-bit."/>
33 <event event="0x081B" option_set="XP_Region" title="CCN-504" name="Bus 1: RSP: P-Cnt" description="Bus 1: RSP: Set P-Cnt, signaled when this XP sets the P-Cnt. This is not applicable for the SNP VC."/>
34 <event event="0x081C" option_set="XP_Region" title="CCN-504" name="Bus 1: RSP: TknV" description="Bus 1: RSP: No TknV, signaled when this XP transmits a valid packet."/>
35 <event event="0x0821" option_set="XP_Region" title="CCN-504" name="Bus 0: SNP: H-bit" description="Bus 0: SNP: Set H-bit, signaled when this XP sets the H-bit."/>
36 <event event="0x0822" option_set="XP_Region" title="CCN-504" name="Bus 0: SNP: S-bit" description="Bus 0: SNP: Set S-bit, signaled when this XP sets the S-bit."/>
37 <event event="0x0823" option_set="XP_Region" title="CCN-504" name="Bus 0: SNP: P-Cnt" description="Bus 0: SNP: Set P-Cnt, signaled when this XP sets the P-Cnt. This is not applicable for the SNP VC."/>
38 <event event="0x0824" option_set="XP_Region" title="CCN-504" name="Bus 0: SNP: TknV" description="Bus 0: SNP: No TknV, signaled when this XP transmits a valid packet."/>
39 <event event="0x0829" option_set="XP_Region" title="CCN-504" name="Bus 1: SNP: H-bit" description="Bus 1: SNP: Set H-bit, signaled when this XP sets the H-bit."/>
40 <event event="0x082A" option_set="XP_Region" title="CCN-504" name="Bus 1: SNP: S-bit" description="Bus 1: SNP: Set S-bit, signaled when this XP sets the S-bit."/>
41 <event event="0x082B" option_set="XP_Region" title="CCN-504" name="Bus 1: SNP: P-Cnt" description="Bus 1: SNP: Set P-Cnt, signaled when this XP sets the P-Cnt. This is not applicable for the SNP VC."/>
42 <event event="0x082C" option_set="XP_Region" title="CCN-504" name="Bus 1: SNP: TknV" description="Bus 1: SNP: No TknV, signaled when this XP transmits a valid packet."/>
43 <event event="0x0831" option_set="XP_Region" title="CCN-504" name="Bus 0: DAT: H-bit" description="Bus 0: DAT: Set H-bit, signaled when this XP sets the H-bit."/>
44 <event event="0x0832" option_set="XP_Region" title="CCN-504" name="Bus 0: DAT: S-bit" description="Bus 0: DAT: Set S-bit, signaled when this XP sets the S-bit."/>
45 <event event="0x0833" option_set="XP_Region" title="CCN-504" name="Bus 0: DAT: P-Cnt" description="Bus 0: DAT: Set P-Cnt, signaled when this XP sets the P-Cnt. This is not applicable for the SNP VC."/>
46 <event event="0x0834" option_set="XP_Region" title="CCN-504" name="Bus 0: DAT: TknV" description="Bus 0: DAT: No TknV, signaled when this XP transmits a valid packet."/>
47 <event event="0x0839" option_set="XP_Region" title="CCN-504" name="Bus 1: DAT: H-bit" description="Bus 1: DAT: Set H-bit, signaled when this XP sets the H-bit."/>
48 <event event="0x083A" option_set="XP_Region" title="CCN-504" name="Bus 1: DAT: S-bit" description="Bus 1: DAT: Set S-bit, signaled when this XP sets the S-bit."/>
49 <event event="0x083B" option_set="XP_Region" title="CCN-504" name="Bus 1: DAT: P-Cnt" description="Bus 1: DAT: Set P-Cnt, signaled when this XP sets the P-Cnt. This is not applicable for the SNP VC."/>
50 <event event="0x083C" option_set="XP_Region" title="CCN-504" name="Bus 1: DAT: TknV" description="Bus 1: DAT: No TknV, signaled when this XP transmits a valid packet."/>
51 <event event="0x0871" option_set="XP_Region" title="CCN-504" name="Bus 0: DATB: H-bit" description="Bus 0: DATB: Set H-bit, signaled when this XP sets the H-bit."/>
52 <event event="0x0872" option_set="XP_Region" title="CCN-504" name="Bus 0: DATB: S-bit" description="Bus 0: DATB: Set S-bit, signaled when this XP sets the S-bit."/>
53 <event event="0x0873" option_set="XP_Region" title="CCN-504" name="Bus 0: DATB: P-Cnt" description="Bus 0: DATB: Set P-Cnt, signaled when this XP sets the P-Cnt. This is not applicable for the SNP VC."/>
54 <event event="0x0874" option_set="XP_Region" title="CCN-504" name="Bus 0: DATB: TknV" description="Bus 0: DATB: No TknV, signaled when this XP transmits a valid packet."/>
55 <event event="0x0879" option_set="XP_Region" title="CCN-504" name="Bus 1: DATB: H-bit" description="Bus 1: DATB: Set H-bit, signaled when this XP sets the H-bit."/>
56 <event event="0x087A" option_set="XP_Region" title="CCN-504" name="Bus 1: DATB: S-bit" description="Bus 1: DATB: Set S-bit, signaled when this XP sets the S-bit."/>
57 <event event="0x087B" option_set="XP_Region" title="CCN-504" name="Bus 1: DATB: P-Cnt" description="Bus 1: DATB: Set P-Cnt, signaled when this XP sets the P-Cnt. This is not applicable for the SNP VC."/>
58 <event event="0x087C" option_set="XP_Region" title="CCN-504" name="Bus 1: DATB: TknV" description="Bus 1: DATB: No TknV, signaled when this XP transmits a valid packet."/>
59
60 <option_set name="HN-F_Region">
61 <option event_delta="0x200000" name="HN-F 3" description="Fully-coherent Home Node 3"/>
62 <option event_delta="0x210000" name="HN-F 5" description="Fully-coherent Home Node 5"/>
63 <option event_delta="0x220000" name="HN-F 7" description="Fully-coherent Home Node 7"/>
64 <option event_delta="0x230000" name="HN-F 8" description="Fully-coherent Home Node 8"/>
65 <option event_delta="0x240000" name="HN-F 13" description="Fully-coherent Home Node 13"/>
66 <option event_delta="0x250000" name="HN-F 15" description="Fully-coherent Home Node 15"/>
67 <option event_delta="0x260000" name="HN-F 17" description="Fully-coherent Home Node 17"/>
68 <option event_delta="0x270000" name="HN-F 18" description="Fully-coherent Home Node 18"/>
69 </option_set>
70
71 <event event="0x0401" option_set="HN-F_Region" title="CCN-504" name="Cache Miss" description="Counts the total cache misses. This is the first time lookup result, and is high priority."/>
72 <event event="0x0402" option_set="HN-F_Region" title="CCN-504" name="L3 SF Cache Access" description="Counts the number of cache accesses. This is the first time access, and is high priority."/>
73 <event event="0x0403" option_set="HN-F_Region" title="CCN-504" name="Cache Fill" description="Counts the total allocations in the HN L3 cache, and all cache line allocations to the L3 cache."/>
74 <event event="0x0404" option_set="HN-F_Region" title="CCN-504" name="POCQ Retry" description="Counts the number of requests that have been retried."/>
75 <event event="0x0405" option_set="HN-F_Region" title="CCN-504" name="POCQ Reqs Recvd" description="Counts the number of requests received by HN."/>
76 <event event="0x0406" option_set="HN-F_Region" title="CCN-504" name="SF Hit" description="Counts the number of snoop filter hits."/>
77 <event event="0x0407" option_set="HN-F_Region" title="CCN-504" name="SF Evictions" description="Counts the number of snoop filter evictions. Cache invalidations are initiated."/>
78 <event event="0x0408" option_set="HN-F_Region" title="CCN-504" name="Snoops Sent" description="Counts the number of snoops sent. Does not differentiate between broadcast or directed snoops."/>
79 <event event="0x0409" option_set="HN-F_Region" title="CCN-504" name="Snoops Broadcast" description="Counts the number of snoop broadcasts sent."/>
80 <event event="0x040A" option_set="HN-F_Region" title="CCN-504" name="L3 Eviction" description="Counts the number of L3 evictions."/>
81 <event event="0x040B" option_set="HN-F_Region" title="CCN-504" name="L3 Fill Invalid Way" description="Counts the number of L3 fills to an invalid way."/>
82 <event event="0x040C" option_set="HN-F_Region" title="CCN-504" name="MC Retries" description="Counts the number of transactions retried by the memory controller."/>
83 <event event="0x040D" option_set="HN-F_Region" title="CCN-504" name="MC Reqs" description="Counts the number of requests to the memory controller."/>
84 <event event="0x040E" option_set="HN-F_Region" title="CCN-504" name="QOS HH Retry" description="Counts the number of times a highest-priority QoS class was retried at the HN-F."/>
85
86 <option_set name="RN-I_Region">
87 <option event_delta="0x800000" name="RN-I 0" description="I/O-coherent Requesting Node 0"/>
88 <option event_delta="0x820000" name="RN-I 2" description="I/O-coherent Requesting Node 2"/>
89 <option event_delta="0x860000" name="RN-I 6" description="I/O-coherent Requesting Node 6"/>
90 <option event_delta="0x8C0000" name="RN-I 12" description="I/O-coherent Requesting Node 12"/>
91 <option event_delta="0x900000" name="RN-I 16" description="I/O-coherent Requesting Node 16"/>
92 <option event_delta="0x940000" name="RN-I 20" description="I/O-coherent Requesting Node 20"/>
93 </option_set>
94
95 <event event="0x1601" option_set="RN-I_Region" title="CCN-504" name="S0 RDataBeats" description="S0 RDataBeats."/>
96 <event event="0x1602" option_set="RN-I_Region" title="CCN-504" name="S1 RDataBeats" description="S1 RDataBeats."/>
97 <event event="0x1603" option_set="RN-I_Region" title="CCN-504" name="S2 RDataBeats" description="S2 RDataBeats."/>
98 <event event="0x1604" option_set="RN-I_Region" title="CCN-504" name="RXDAT Flits received" description="RXDAT Flits received."/>
99 <event event="0x1605" option_set="RN-I_Region" title="CCN-504" name="TXDAT Flits sent" description="TXDAT Flits sent."/>
100 <event event="0x1606" option_set="RN-I_Region" title="CCN-504" name="Total TXREQ Flits sent" description="Total TXREQ Flits sent."/>
101 <event event="0x1607" option_set="RN-I_Region" title="CCN-504" name="Retried TXREQ Flits sent" description="Retried TXREQ Flits sent."/>
102 <event event="0x1608" option_set="RN-I_Region" title="CCN-504" name="RRT full" description="RRT full."/>
103 <event event="0x1609" option_set="RN-I_Region" title="CCN-504" name="WRT full" description="WRT full."/>
104 <event event="0x160A" option_set="RN-I_Region" title="CCN-504" name="Replayed TXREQ Flits" description="Replayed TXREQ Flits."/>
105
106 <option_set name="SBAS_Region">
107 <option event_delta="0x810000" name="SBAS 1" description="ACE master to CHI protocol bridge 1"/>
108 <option event_delta="0x890000" name="SBAS 9" description="ACE master to CHI protocol bridge 9"/>
109 <option event_delta="0x8B0000" name="SBAS 11" description="ACE master to CHI protocol bridge 11"/>
110 <option event_delta="0x930000" name="SBAS 19" description="ACE master to CHI protocol bridge 19"/>
111 </option_set>
112
113 <event event="0x1001" option_set="SBAS_Region" title="CCN-504" name="S0 RDataBeats" description="S0 RDataBeats."/>
114 <event event="0x1004" option_set="SBAS_Region" title="CCN-504" name="RXDAT Flits received" description="RXDAT Flits received."/>
115 <event event="0x1005" option_set="SBAS_Region" title="CCN-504" name="TXDAT Flits sent" description="TXDAT Flits sent."/>
116 <event event="0x1006" option_set="SBAS_Region" title="CCN-504" name="Total TXREQ Flits sent" description="Total TXREQ Flits sent."/>
117 <event event="0x1007" option_set="SBAS_Region" title="CCN-504" name="Retried TXREQ Flits sent" description="Retried TXREQ Flits sent."/>
118 <event event="0x1008" option_set="SBAS_Region" title="CCN-504" name="RRT full" description="RRT full."/>
119 <event event="0x1009" option_set="SBAS_Region" title="CCN-504" name="WRT full" description="WRT full."/>
120 <event event="0x100A" option_set="SBAS_Region" title="CCN-504" name="Replayed TXREQ Flits" description="Replayed TXREQ Flits."/>
121
122 </category>
diff --git a/daemon/events-Cortex-A12.xml b/daemon/events-Cortex-A12.xml
new file mode 100644
index 0000000..20a4772
--- /dev/null
+++ b/daemon/events-Cortex-A12.xml
@@ -0,0 +1,86 @@
1 <counter_set name="ARM_Cortex-A12_cnt" count="6"/>
2 <category name="Cortex-A12" counter_set="ARM_Cortex-A12_cnt" per_cpu="yes" supports_event_based_sampling="yes">
3 <event counter="ARM_Cortex-A12_ccnt" event="0xff" title="Clock" name="Cycles" display="hertz" units="Hz" average_selection="yes" average_cores="yes" description="The number of core clock cycles"/>
4 <event event="0x01" title="Cache" name="Instruction refill" description="Instruction fetch that causes a refill of at least the level of instruction or unified cache closest to the processor"/>
5 <event event="0x02" title="Cache" name="Inst TLB refill" description="Instruction fetch that causes a TLB refill of at least the level of TLB closest to the processor"/>
6 <event event="0x03" title="Cache" name="Data refill" description="Memory Read or Write operation that causes a refill of at least the level of data or unified cache closest to the processor"/>
7 <event event="0x04" title="Cache" name="Data access" description="Memory Read or Write operation that causes a cache access to at least the level of data or unified cache closest to the processor"/>
8 <event event="0x05" title="Cache" name="Data TLB refill" description="Memory Read or Write operation that causes a TLB refill of at least the level of TLB closest to the processor"/>
9 <event event="0x08" title="Instruction" name="Executed" description="Instruction architecturally executed"/>
10 <event event="0x09" title="Exception" name="Taken" description="Exceptions taken"/>
11 <event event="0x0a" title="Exception" name="Return" description="Exception return architecturally executed"/>
12 <event event="0x0b" title="Instruction" name="CONTEXTIDR" description="Instruction that writes to the CONTEXTIDR architecturally executed"/>
13 <event event="0x10" title="Branch" name="Mispredicted" description="Branch mispredicted or not predicted"/>
14 <event event="0x12" title="Branch" name="Potential prediction" description="Branch or other change in program flow that could have been predicted by the branch prediction resources of the processor"/>
15 <event event="0x13" title="Memory" name="Memory access" description="Data memory access"/>
16 <event event="0x14" title="Cache" name="L1 inst access" description="Instruction cache access"/>
17 <event event="0x15" title="Cache" name="L1 data write" description="Level 1 data cache Write-Back"/>
18 <event event="0x16" title="Cache" name="L2 data access" description="Level 2 data cache access"/>
19 <event event="0x17" title="Cache" name="L2 data refill" description="Level 2 data cache refill"/>
20 <event event="0x18" title="Cache" name="L2 data write" description="Level 2 data cache Write-Back"/>
21 <event event="0x19" title="Bus" name="Access" description="Bus - Access"/>
22 <event event="0x1b" title="Instruction" name="Speculative" description="Instruction speculatively executed"/>
23 <event event="0x1c" title="Memory" name="Translation table" description="Write to translation table base architecturally executed"/>
24 <event event="0x1d" title="Bus" name="Cycle" description="Bus - Cycle"/>
25 <event event="0x40" title="Cache" name="L1 data read" description="Level 1 data cache access - Read"/>
26 <event event="0x41" title="Cache" name="L1 data access write" description="Level 1 data cache access - Write"/>
27 <event event="0x50" title="Cache" name="L2 data read" description="Level 2 data cache access - Read"/>
28 <event event="0x51" title="Cache" name="L2 data access write" description="Level 2 data cache access - Write"/>
29 <event event="0x56" title="Cache" name="L2 data victim" description="Level 2 data cache Write-Back - Victim"/>
30 <event event="0x57" title="Cache" name="L2 data clean" description="Level 2 data cache Write-Back - Cleaning and coherency"/>
31 <event event="0x58" title="Cache" name="L2 data invalidate" description="Level 2 data cache invalidate"/>
32 <event event="0x60" title="Bus" name="Read" description="Bus access - Read"/>
33 <event event="0x62" title="Bus" name="Access shared" description="Bus access - Normal"/>
34 <event event="0x63" title="Bus" name="Access not shared" description="Bus access - Not normal"/>
35 <event event="0x64" title="Bus" name="Access normal" description="Bus access - Normal"/>
36 <event event="0x65" title="Bus" name="Peripheral" description="Bus access - Peripheral"/>
37 <event event="0x66" title="Memory" name="Read" description="Data memory access - Read"/>
38 <event event="0x67" title="Memory" name="Write" description="Data memory access - Write"/>
39 <event event="0x68" title="Memory" name="Unaligned Read" description="Unaligned access - Read"/>
40 <event event="0x69" title="Memory" name="Unaligned Write" description="Unaligned access - Write"/>
41 <event event="0x6a" title="Memory" name="Unaligned" description="Unaligned access"/>
42 <event event="0x6c" title="Intrinsic" name="LDREX" description="Exclusive instruction speculatively executed - LDREX"/>
43 <event event="0x6e" title="Intrinsic" name="STREX fail" description="Exclusive instruction speculatively executed - STREX fail"/>
44 <event event="0x6f" title="Intrinsic" name="STREX" description="Exclusive instruction speculatively executed - STREX"/>
45 <event event="0x70" title="Instruction" name="Load" description="Instruction speculatively executed - Load"/>
46 <event event="0x71" title="Instruction" name="Store" description="Instruction speculatively executed - Store"/>
47 <event event="0x72" title="Instruction" name="Load/Store" description="Instruction speculatively executed - Load or store"/>
48 <event event="0x73" title="Instruction" name="Integer" description="Instruction speculatively executed - Integer data processing"/>
49 <event event="0x74" title="Instruction" name="Advanced SIMD" description="Instruction speculatively executed - Advanced SIMD"/>
50 <event event="0x75" title="Instruction" name="VFP" description="Instruction speculatively executed - VFP"/>
51 <event event="0x76" title="Instruction" name="Software change" description="Instruction speculatively executed - Software change of the PC"/>
52 <event event="0x78" title="Instruction" name="Immediate branch" description="Branch speculatively executed - Immediate branch"/>
53 <event event="0x79" title="Instruction" name="Procedure return" description="Branch speculatively executed - Procedure return"/>
54 <event event="0x7a" title="Instruction" name="Indirect branch" description="Branch speculatively executed - Indirect branch"/>
55 <event event="0x7c" title="Instruction" name="ISB" description="Barrier speculatively executed - ISB"/>
56 <event event="0x7d" title="Instruction" name="DSB" description="Barrier speculatively executed - DSB"/>
57 <event event="0x7e" title="Instruction" name="DMB" description="Barrier speculatively executed - DMB"/>
58 <event event="0x81" title="Exception" name="Undefined" description="Exception taken, other synchronous"/>
59 <event event="0x8a" title="Exception" name="Hypervisor call" description="Exception taken, Hypervisor Call"/>
60 <event event="0xc0" title="Instruction" name="Stalled Linefill" description="Instruction side stalled due to a Linefill"/>
61 <event event="0xc1" title="Instruction" name="Stalled Page Table Walk" description="Instruction Side stalled due to a Page Table Walk"/>
62 <event event="0xc2" title="Cache" name="4 Ways Read" description="Number of set of 4 ways read in the instruction cache - Tag RAM"/>
63 <event event="0xc3" title="Cache" name="Ways Read" description="Number of ways read in the instruction cache - Data RAM"/>
64 <event event="0xc4" title="Cache" name="BATC Read" description="Number of ways read in the instruction BTAC RAM"/>
65 <event event="0xca" title="Memory" name="Snoop" description="Data snooped from other processor. This event counts memory-read operations that read data from another processor within the local Cortex-A12 cluster, rather than accessing the L2 cache or issuing an external read. It increments on each transaction, rather than on each beat of data"/>
66 <event event="0xd3" title="Slots" name="Load-Store Unit" description="Duration during which all slots in the Load-Store Unit are busy"/>
67 <event event="0xd8" title="Slots" name="Load-Store Issue Queue" description="Duration during which all slots in the Load-Store Issue queue are busy"/>
68 <event event="0xd9" title="Slots" name="Data Processing Issue Queue" description="Duration during which all slots in the Data Processing issue queue are busy"/>
69 <event event="0xda" title="Slots" name="Data Engine Issue Queue" description="Duration during which all slots in the Data Engine issue queue are busy"/>
70 <event event="0xdb" title="NEON" name="Flush" description="Number of NEON instruction which fail their condition code and lead to a flush of the DE pipe"/>
71 <event event="0xdc" title="Hypervisor" name="Traps" description="Number of Trap to hypervisor"/>
72 <event event="0xde" title="PTM" name="EXTOUT 0" description="PTM EXTOUT 0"/>
73 <event event="0xdf" title="PTM" name="EXTOUT 1" description="PTM EXTOUT 1"/>
74 <event event="0xe0" title="MMU" name="Table Walk" description="Duration during which the MMU handle a Page table walk"/>
75 <event event="0xe1" title="MMU" name="Stage1 Table Walk" description="Duration during which the MMU handle a Stage1 Page table walk"/>
76 <event event="0xe2" title="MMU" name="Stage2 Table Walk" description="Duration during which the MMU handle a Stage2 Page table walk"/>
77 <event event="0xe3" title="MMU" name="LSU Table Walk" description="Duration during which the MMU handle a Page table walk requested by the Load Store Unit"/>
78 <event event="0xe4" title="MMU" name="Instruction Table Walk" description="Duration during which the MMU handle a Page table walk requested by the Instruction side"/>
79 <event event="0xe5" title="MMU" name="Preload Table Walk" description="Duration during which the MMU handle a Page table walk requested by a Preload instruction or Prefetch request"/>
80 <event event="0xe6" title="MMU" name="cp15 Table Walk" description="Duration during which the MMU handle a Page table walk requested by a cp15 operation (maintenance by MVA and VA-to-PA operation)"/>
81 <event event="0xe7" title="Cache" name="L1 PLD TLB refill" description="Level 1 PLD TLB refill"/>
82 <event event="0xe8" title="Cache" name="L1 CP15 TLB refill" description="Level 1 CP15 TLB refill"/>
83 <event event="0xe9" title="Cache" name="L1 TLB flush" description="Level 1 TLB flush"/>
84 <event event="0xea" title="Cache" name="L2 TLB access" description="Level 2 TLB access"/>
85 <event event="0xeb" title="Cache" name="L2 TLB miss" description="Level 2 TLB miss"/>
86 </category>
diff --git a/daemon/events-Linux.xml b/daemon/events-Linux.xml
index 05dc613..4a30ad6 100644
--- a/daemon/events-Linux.xml
+++ b/daemon/events-Linux.xml
@@ -11,7 +11,7 @@
11 <event counter="Linux_meminfo_bufferram" title="Memory" name="Buffer" display="maximum" units="B" average_selection="yes" description="Memory used by OS disk buffers"/> 11 <event counter="Linux_meminfo_bufferram" title="Memory" name="Buffer" display="maximum" units="B" average_selection="yes" description="Memory used by OS disk buffers"/>
12 <event counter="Linux_power_cpu_freq" title="Clock" name="Frequency" per_cpu="yes" display="maximum" units="Hz" series_composition="overlay" average_selection="yes" average_cores="yes" description="Frequency setting of the CPU"/> 12 <event counter="Linux_power_cpu_freq" title="Clock" name="Frequency" per_cpu="yes" display="maximum" units="Hz" series_composition="overlay" average_selection="yes" average_cores="yes" description="Frequency setting of the CPU"/>
13 <event counter="Linux_power_cpu_idle" title="Idle" name="State" per_cpu="yes" display="maximum" average_selection="yes" description="CPU Idle State + 1, set the Sample Rate to None to prevent the hrtimer from interrupting the system"/> 13 <event counter="Linux_power_cpu_idle" title="Idle" name="State" per_cpu="yes" display="maximum" average_selection="yes" description="CPU Idle State + 1, set the Sample Rate to None to prevent the hrtimer from interrupting the system"/>
14 <event counter="Linux_cpu_wait_contention" title="CPU Contention" name="Wait" per_cpu="no" display="maximum" derived="yes" rendering_type="bar" average_selection="yes" percentage="yes" modifier="10000" description="Thread waiting on contended resource"/> 14 <event counter="Linux_cpu_wait_contention" title="CPU Contention" name="Wait" per_cpu="no" display="average" derived="yes" rendering_type="bar" average_selection="yes" percentage="yes" modifier="10000" description="Thread waiting on contended resource"/>
15 <event counter="Linux_cpu_wait_io" title="CPU I/O" name="Wait" per_cpu="no" display="maximum" derived="yes" rendering_type="bar" average_selection="yes" percentage="yes" modifier="10000" description="Thread waiting on I/O resource"/> 15 <event counter="Linux_cpu_wait_io" title="CPU I/O" name="Wait" per_cpu="no" display="average" derived="yes" rendering_type="bar" average_selection="yes" percentage="yes" modifier="10000" description="Thread waiting on I/O resource"/>
16 </category> 16 </category>
17 17
diff --git a/daemon/events-Mali-400.xml b/daemon/events-Mali-4xx.xml
index dceccfb..8772ce4 100644
--- a/daemon/events-Mali-400.xml
+++ b/daemon/events-Mali-4xx.xml
@@ -1,8 +1,7 @@
1 <counter_set name="ARM_Mali-400_VP_cnt" count="2"/> 1 <counter_set name="ARM_Mali-4xx_VP_0_cnt" count="2"/>
2 <counter_set name="ARM_Mali-400_L2_cnt" count="2"/> 2 <counter_set name="ARM_Mali-4xx_SW_cnt" count="0"/>
3 <counter_set name="ARM_Mali-400_SW_cnt" count="0"/> 3 <counter_set name="ARM_Mali-4xx_Filmstrip_cnt" count="1"/>
4 <counter_set name="ARM_Mali-400_Filmstrip_cnt" count="1"/> 4 <category name="Mali-4xx-VP" counter_set="ARM_Mali-4xx_VP_0_cnt" per_cpu="no">
5 <category name="Mali-400-VP" counter_set="ARM_Mali-400_VP_cnt" per_cpu="no">
6 <event event="0x01" title="Mali GPU Vertex Processor" name="Active cycles" description="Number of cycles per frame the MaliGP2 was active."/> 5 <event event="0x01" title="Mali GPU Vertex Processor" name="Active cycles" description="Number of cycles per frame the MaliGP2 was active."/>
7 <event event="0x02" title="Mali GPU Vertex Processor" name="Active cycles, vertex shader" description="Number of cycles per frame the vertex shader unit was active."/> 6 <event event="0x02" title="Mali GPU Vertex Processor" name="Active cycles, vertex shader" description="Number of cycles per frame the vertex shader unit was active."/>
8 <event event="0x03" title="Mali GPU Vertex Processor" name="Active cycles, vertex storer" description="Number of cycles per frame the vertex storer unit was active."/> 7 <event event="0x03" title="Mali GPU Vertex Processor" name="Active cycles, vertex storer" description="Number of cycles per frame the vertex storer unit was active."/>
@@ -30,70 +29,75 @@
30 <event event="0x21" title="Mali GPU Vertex Processor" name="Active cycles, PLBU tile iterator" description="Number of active cycles per frame spent by the MaliGP2 PLBU iterating over the tiles in the bounding box generating commands (mainly graphics primitives). This includes time spent waiting on the bus."/> 29 <event event="0x21" title="Mali GPU Vertex Processor" name="Active cycles, PLBU tile iterator" description="Number of active cycles per frame spent by the MaliGP2 PLBU iterating over the tiles in the bounding box generating commands (mainly graphics primitives). This includes time spent waiting on the bus."/>
31 </category> 30 </category>
32 <category name="Mali GPU Fragment Processor" per_cpu="no"> 31 <category name="Mali GPU Fragment Processor" per_cpu="no">
33 <counter_set name="ARM_Mali-400_FP0_cnt" title="Mali-400 FP0" description="Mali GPU Fragment Processor 0" count="2"/> 32 <counter_set name="ARM_Mali-4xx_FP_0_cnt" title="Mali-4xx FP0" description="Mali GPU Fragment Processor 0" count="2"/>
34 <counter_set name="ARM_Mali-400_FP1_cnt" title="Mali-400 FP1" description="Mali GPU Fragment Processor 1" count="2"/> 33 <counter_set name="ARM_Mali-4xx_FP_1_cnt" title="Mali-4xx FP1" description="Mali GPU Fragment Processor 1" count="2"/>
35 <counter_set name="ARM_Mali-400_FP2_cnt" title="Mali-400 FP2" description="Mali GPU Fragment Processor 2" count="2"/> 34 <counter_set name="ARM_Mali-4xx_FP_2_cnt" title="Mali-4xx FP2" description="Mali GPU Fragment Processor 2" count="2"/>
36 <counter_set name="ARM_Mali-400_FP3_cnt" title="Mali-400 FP3" description="Mali GPU Fragment Processor 3" count="2"/> 35 <counter_set name="ARM_Mali-4xx_FP_3_cnt" title="Mali-4xx FP3" description="Mali GPU Fragment Processor 3" count="2"/>
36 <counter_set name="ARM_Mali-4xx_FP_4_cnt" title="Mali-4xx FP4" description="Mali GPU Fragment Processor 4" count="2"/>
37 <counter_set name="ARM_Mali-4xx_FP_5_cnt" title="Mali-4xx FP5" description="Mali GPU Fragment Processor 5" count="2"/>
38 <counter_set name="ARM_Mali-4xx_FP_6_cnt" title="Mali-4xx FP6" description="Mali GPU Fragment Processor 6" count="2"/>
39 <counter_set name="ARM_Mali-4xx_FP_7_cnt" title="Mali-4xx FP7" description="Mali GPU Fragment Processor 7" count="2"/>
37 40
38 <event event="0x00" title="Mali-400 FP" name="Active clock cycles" description="Active clock cycles, between polygon start and IRQ."/> 41 <event event="0x00" title="Mali-4xx FP" name="Active clock cycles" description="Active clock cycles, between polygon start and IRQ."/>
39 <event event="0x02" title="Mali-400 FP" name="Total bus reads" description="Total number of 64-bit words read from the bus."/> 42 <event event="0x02" title="Mali-4xx FP" name="Total bus reads" description="Total number of 64-bit words read from the bus."/>
40 <event event="0x03" title="Mali-400 FP" name="Total bus writes" description="Total number of 64-bit words written to the bus."/> 43 <event event="0x03" title="Mali-4xx FP" name="Total bus writes" description="Total number of 64-bit words written to the bus."/>
41 <event event="0x04" title="Mali-400 FP" name="Bus read request cycles" description="Number of cycles during which the bus read request signal was HIGH."/> 44 <event event="0x04" title="Mali-4xx FP" name="Bus read request cycles" description="Number of cycles during which the bus read request signal was HIGH."/>
42 <event event="0x05" title="Mali-400 FP" name="Bus write request cycles" description="Number of cycles during which the bus write request signal was HIGH."/> 45 <event event="0x05" title="Mali-4xx FP" name="Bus write request cycles" description="Number of cycles during which the bus write request signal was HIGH."/>
43 <event event="0x06" title="Mali-400 FP" name="Bus read transactions count" description="Number of read requests accepted by the bus."/> 46 <event event="0x06" title="Mali-4xx FP" name="Bus read transactions count" description="Number of read requests accepted by the bus."/>
44 <event event="0x07" title="Mali-400 FP" name="Bus write transactions" description="Number of write requests accepted by the bus."/> 47 <event event="0x07" title="Mali-4xx FP" name="Bus write transactions" description="Number of write requests accepted by the bus."/>
45 <event event="0x09" title="Mali-400 FP" name="Tile writeback writes" description="64-bit words written to the bus by the writeback unit."/> 48 <event event="0x09" title="Mali-4xx FP" name="Tile writeback writes" description="64-bit words written to the bus by the writeback unit."/>
46 <event event="0x0a" title="Mali-400 FP" name="Store unit writes" description="64-bit words written to the bus by the store unit."/> 49 <event event="0x0a" title="Mali-4xx FP" name="Store unit writes" description="64-bit words written to the bus by the store unit."/>
47 <event event="0x0d" title="Mali-400 FP" name="Texture cache uncompressed reads" description="Number of 64-bit words read from the bus into the uncompressed textures cache."/> 50 <event event="0x0d" title="Mali-4xx FP" name="Texture cache uncompressed reads" description="Number of 64-bit words read from the bus into the uncompressed textures cache."/>
48 <event event="0x0e" title="Mali-400 FP" name="Polygon list reads" description="Number of 64-bit words read from the bus by the polygon list reader."/> 51 <event event="0x0e" title="Mali-4xx FP" name="Polygon list reads" description="Number of 64-bit words read from the bus by the polygon list reader."/>
49 <event event="0x0f" title="Mali-400 FP" name="RSW reads" description="Number of 64-bit words read from the bus into the Render State Word register."/> 52 <event event="0x0f" title="Mali-4xx FP" name="RSW reads" description="Number of 64-bit words read from the bus into the Render State Word register."/>
50 <event event="0x10" title="Mali-400 FP" name="Vertex cache reads" description="Number of 64-bit words read from the bus into the vertex cache."/> 53 <event event="0x10" title="Mali-4xx FP" name="Vertex cache reads" description="Number of 64-bit words read from the bus into the vertex cache."/>
51 <event event="0x11" title="Mali-400 FP" name="Uniform remapping reads" description="Number of 64-bit words read from the bus when reading from the uniform remapping table."/> 54 <event event="0x11" title="Mali-4xx FP" name="Uniform remapping reads" description="Number of 64-bit words read from the bus when reading from the uniform remapping table."/>
52 <event event="0x12" title="Mali-400 FP" name="Program cache reads" description="Number of 64-bit words read from the bus into the fragment shader program cache."/> 55 <event event="0x12" title="Mali-4xx FP" name="Program cache reads" description="Number of 64-bit words read from the bus into the fragment shader program cache."/>
53 <event event="0x13" title="Mali-400 FP" name="Varying reads" description="Number of 64-bit words containing varyings generated by the vertex processing read from the bus."/> 56 <event event="0x13" title="Mali-4xx FP" name="Varying reads" description="Number of 64-bit words containing varyings generated by the vertex processing read from the bus."/>
54 <event event="0x14" title="Mali-400 FP" name="Texture descriptors reads" description="Number of 64-bit words containing texture descriptors read from the bus."/> 57 <event event="0x14" title="Mali-4xx FP" name="Texture descriptors reads" description="Number of 64-bit words containing texture descriptors read from the bus."/>
55 <event event="0x15" title="Mali-400 FP" name="Texture descriptor remapping reads" description="Number of 64-bit words read from the bus when reading from the texture descriptor remapping table."/> 58 <event event="0x15" title="Mali-4xx FP" name="Texture descriptor remapping reads" description="Number of 64-bit words read from the bus when reading from the texture descriptor remapping table."/>
56 <event event="0x17" title="Mali-400 FP" name="Load unit reads" description="Number of 64-bit words read from the bus by the LOAD sub-instruction."/> 59 <event event="0x17" title="Mali-4xx FP" name="Load unit reads" description="Number of 64-bit words read from the bus by the LOAD sub-instruction."/>
57 <event event="0x18" title="Mali-400 FP" name="Polygon count" description="Number of triangles read from the polygon list."/> 60 <event event="0x18" title="Mali-4xx FP" name="Polygon count" description="Number of triangles read from the polygon list."/>
58 <event event="0x19" title="Mali-400 FP" name="Pixel rectangle count" description="Number of pixel rectangles read from the polygon list."/> 61 <event event="0x19" title="Mali-4xx FP" name="Pixel rectangle count" description="Number of pixel rectangles read from the polygon list."/>
59 <event event="0x1a" title="Mali-400 FP" name="Lines count" description="Number of lines read from the polygon list."/> 62 <event event="0x1a" title="Mali-4xx FP" name="Lines count" description="Number of lines read from the polygon list."/>
60 <event event="0x1b" title="Mali-400 FP" name="Points count" description="Number of points read from the polygon list."/> 63 <event event="0x1b" title="Mali-4xx FP" name="Points count" description="Number of points read from the polygon list."/>
61 <event event="0x1c" title="Mali-400 FP" name="Stall cycles PolygonListReader" description="Number of clock cycles the Polygon List Reader waited for output being collected."/> 64 <event event="0x1c" title="Mali-4xx FP" name="Stall cycles PolygonListReader" description="Number of clock cycles the Polygon List Reader waited for output being collected."/>
62 <event event="0x1d" title="Mali-400 FP" name="Stall cycles triangle setup" description="Number of clock cycles the TSC waited for input."/> 65 <event event="0x1d" title="Mali-4xx FP" name="Stall cycles triangle setup" description="Number of clock cycles the TSC waited for input."/>
63 <event event="0x1e" title="Mali-400 FP" name="Quad rasterized count" description="Number of 2x?2 quads output from rasterizer."/> 66 <event event="0x1e" title="Mali-4xx FP" name="Quad rasterized count" description="Number of 2x?2 quads output from rasterizer."/>
64 <event event="0x1f" title="Mali-400 FP" name="Fragment rasterized count" description="Number of fragment rasterized. Fragments/(Quads*4) gives average actual fragments per quad."/> 67 <event event="0x1f" title="Mali-4xx FP" name="Fragment rasterized count" description="Number of fragment rasterized. Fragments/(Quads*4) gives average actual fragments per quad."/>
65 <event event="0x20" title="Mali-400 FP" name="Fragment rejected fragment-kill count" description="Number of fragments exiting the fragment shader as killed."/> 68 <event event="0x20" title="Mali-4xx FP" name="Fragment rejected fragment-kill count" description="Number of fragments exiting the fragment shader as killed."/>
66 <event event="0x21" title="Mali-400 FP" name="Fragment rejected fwd-fragment-kill count" description="Number of fragments killed by forward fragment kill."/> 69 <event event="0x21" title="Mali-4xx FP" name="Fragment rejected fwd-fragment-kill count" description="Number of fragments killed by forward fragment kill."/>
67 <event event="0x22" title="Mali-400 FP" name="Fragment passed z/stencil count" description="Number of fragments passing Z and stencil test."/> 70 <event event="0x22" title="Mali-4xx FP" name="Fragment passed z/stencil count" description="Number of fragments passing Z and stencil test."/>
68 <event event="0x23" title="Mali-400 FP" name="Patches rejected early z/stencil count" description="Number of patches rejected by EarlyZ. A patch can be 8x8, 4x4 or 2x2 pixels."/> 71 <event event="0x23" title="Mali-4xx FP" name="Patches rejected early z/stencil count" description="Number of patches rejected by EarlyZ. A patch can be 8x8, 4x4 or 2x2 pixels."/>
69 <event event="0x24" title="Mali-400 FP" name="Patches evaluated" description="Number of patches evaluated for EarlyZ rejection."/> 72 <event event="0x24" title="Mali-4xx FP" name="Patches evaluated" description="Number of patches evaluated for EarlyZ rejection."/>
70 <event event="0x25" title="Mali-400 FP" name="Instruction completed count" description="Number of fragment shader instruction words completed. It is a function of pixels processed and the length of the shader programs."/> 73 <event event="0x25" title="Mali-4xx FP" name="Instruction completed count" description="Number of fragment shader instruction words completed. It is a function of pixels processed and the length of the shader programs."/>
71 <event event="0x26" title="Mali-400 FP" name="Instruction failed rendezvous count" description="Number of fragment shader instructions not completed because of failed Rendezvous."/> 74 <event event="0x26" title="Mali-4xx FP" name="Instruction failed rendezvous count" description="Number of fragment shader instructions not completed because of failed Rendezvous."/>
72 <event event="0x27" title="Mali-400 FP" name="Instruction failed varying-miss count" description="Number of fragment shader instructions not completed because of failed varying operation."/> 75 <event event="0x27" title="Mali-4xx FP" name="Instruction failed varying-miss count" description="Number of fragment shader instructions not completed because of failed varying operation."/>
73 <event event="0x28" title="Mali-400 FP" name="Instruction failed texture-miss count" description="Number of fragment shader instructions not completed because of failed texture operation."/> 76 <event event="0x28" title="Mali-4xx FP" name="Instruction failed texture-miss count" description="Number of fragment shader instructions not completed because of failed texture operation."/>
74 <event event="0x29" title="Mali-400 FP" name="Instruction failed load-miss count" description="Number of fragment shader instructions not completed because of failed load operation."/> 77 <event event="0x29" title="Mali-4xx FP" name="Instruction failed load-miss count" description="Number of fragment shader instructions not completed because of failed load operation."/>
75 <event event="0x2a" title="Mali-400 FP" name="Instruction failed tile read-miss count" description="Number of fragment shader instructions not completed because of failed read from the tilebuffer."/> 78 <event event="0x2a" title="Mali-4xx FP" name="Instruction failed tile read-miss count" description="Number of fragment shader instructions not completed because of failed read from the tilebuffer."/>
76 <event event="0x2b" title="Mali-400 FP" name="Instruction failed store-miss count" description="Number of fragment shader instructions not completed because of failed store operation."/> 79 <event event="0x2b" title="Mali-4xx FP" name="Instruction failed store-miss count" description="Number of fragment shader instructions not completed because of failed store operation."/>
77 <event event="0x2c" title="Mali-400 FP" name="Rendezvous breakage count" description="Number of Rendezvous breakages reported."/> 80 <event event="0x2c" title="Mali-4xx FP" name="Rendezvous breakage count" description="Number of Rendezvous breakages reported."/>
78 <event event="0x2d" title="Mali-400 FP" name="Pipeline bubbles cycle count" description="Number of unused cycles in the fragment shader while rendering is active."/> 81 <event event="0x2d" title="Mali-4xx FP" name="Pipeline bubbles cycle count" description="Number of unused cycles in the fragment shader while rendering is active."/>
79 <event event="0x2e" title="Mali-400 FP" name="Texture mapper multipass count" description="Number of texture operations looped because of more texture passes needed."/> 82 <event event="0x2e" title="Mali-4xx FP" name="Texture mapper multipass count" description="Number of texture operations looped because of more texture passes needed."/>
80 <event event="0x2f" title="Mali-400 FP" name="Texture mapper cycle count" description="Number of texture operation cycles."/> 83 <event event="0x2f" title="Mali-4xx FP" name="Texture mapper cycle count" description="Number of texture operation cycles."/>
81 <event event="0x30" title="Mali-400 FP" name="Vertex cache hit count" description="Number of times a requested vertex was found in the cache (Number of vertex cache hits)."/> 84 <event event="0x30" title="Mali-4xx FP" name="Vertex cache hit count" description="Number of times a requested vertex was found in the cache (Number of vertex cache hits)."/>
82 <event event="0x31" title="Mali-400 FP" name="Vertex cache miss count" description="Number of times a requested vertex was not found in the cache (Number of vertex cache misses)."/> 85 <event event="0x31" title="Mali-4xx FP" name="Vertex cache miss count" description="Number of times a requested vertex was not found in the cache (Number of vertex cache misses)."/>
83 <event event="0x32" title="Mali-400 FP" name="Varying cache hit count" description="Number of times a requested varying was found in the cache (Number of varying cache hits)."/> 86 <event event="0x32" title="Mali-4xx FP" name="Varying cache hit count" description="Number of times a requested varying was found in the cache (Number of varying cache hits)."/>
84 <event event="0x33" title="Mali-400 FP" name="Varying cache miss count" description="Number of times a requested varying was not found in the cache (Number of varying cache misses)."/> 87 <event event="0x33" title="Mali-4xx FP" name="Varying cache miss count" description="Number of times a requested varying was not found in the cache (Number of varying cache misses)."/>
85 <event event="0x34" title="Mali-400 FP" name="Varying cache conflict miss count" description="Number of times a requested varying was not in the cache and its value, retrieved from memory, must overwrite an older cache entry. This happens when an access pattern cannot be serviced by the cache."/> 88 <event event="0x34" title="Mali-4xx FP" name="Varying cache conflict miss count" description="Number of times a requested varying was not in the cache and its value, retrieved from memory, must overwrite an older cache entry. This happens when an access pattern cannot be serviced by the cache."/>
86 <event event="0x35" title="Mali-400 FP" name="Texture cache hit count" description="Number of times a requested texel was found in the texture cache (Number of texture cache hits)."/> 89 <event event="0x35" title="Mali-4xx FP" name="Texture cache hit count" description="Number of times a requested texel was found in the texture cache (Number of texture cache hits)."/>
87 <event event="0x36" title="Mali-400 FP" name="Texture cache miss count" description="Number of times a requested texel was not found in the texture cache (Number of texture cache misses)."/> 90 <event event="0x36" title="Mali-4xx FP" name="Texture cache miss count" description="Number of times a requested texel was not found in the texture cache (Number of texture cache misses)."/>
88 <event event="0x37" title="Mali-400 FP" name="Texture cache conflict miss count" description="Number of times a requested texel was not in the cache and its value, retrieved from memory, must overwrite an older cache entry. This happens when an access pattern cannot be serviced by the cache."/> 91 <event event="0x37" title="Mali-4xx FP" name="Texture cache conflict miss count" description="Number of times a requested texel was not in the cache and its value, retrieved from memory, must overwrite an older cache entry. This happens when an access pattern cannot be serviced by the cache."/>
89 <event event="0x38" title="Mali-400 FP" name="Compressed texture cache hit count" description="Number of times a requested item was found in the cache."/> 92 <event event="0x38" title="Mali-4xx FP" name="Compressed texture cache hit count" description="Number of times a requested item was found in the cache."/>
90 <event event="0x39" title="Mali-400 FP" name="Compressed texture cache miss count" description="Number of times a requested item was not found in the cache."/> 93 <event event="0x39" title="Mali-4xx FP" name="Compressed texture cache miss count" description="Number of times a requested item was not found in the cache."/>
91 <event event="0x3a" title="Mali-400 FP" name="Load/Store cache hit count" description="Number of hits in the load/store cache."/> 94 <event event="0x3a" title="Mali-4xx FP" name="Load/Store cache hit count" description="Number of hits in the load/store cache."/>
92 <event event="0x3b" title="Mali-400 FP" name="Load/Store cache miss count" description="Number of misses in the load/store cache."/> 95 <event event="0x3b" title="Mali-4xx FP" name="Load/Store cache miss count" description="Number of misses in the load/store cache."/>
93 <event event="0x3c" title="Mali-400 FP" name="Program cache hit count" description="Number of hits in the program cache."/> 96 <event event="0x3c" title="Mali-4xx FP" name="Program cache hit count" description="Number of hits in the program cache."/>
94 <event event="0x3d" title="Mali-400 FP" name="Program cache miss count" description="Number of misses in the program cache."/> 97 <event event="0x3d" title="Mali-4xx FP" name="Program cache miss count" description="Number of misses in the program cache."/>
95 </category> 98 </category>
96 <category name="Mali-400-L2" counter_set="ARM_Mali-400_L2_cnt" per_cpu="no"> 99 <counter_set name="ARM_Mali-4xx_L2_0_cnt" title="Mali-4xx L2 0" description="Mali GPU L2 Cache Core 0" count="2"/>
100 <category name="Mali-4xx-L2_0" counter_set="ARM_Mali-4xx_L2_0_cnt" per_cpu="no">
97 <event event="0x01" title="Mali L2 Cache" name="Total clock cycles" description="Total clock cycles"/> 101 <event event="0x01" title="Mali L2 Cache" name="Total clock cycles" description="Total clock cycles"/>
98 <event event="0x02" title="Mali L2 Cache" name="Active clock cycles" description="Active clock cycles"/> 102 <event event="0x02" title="Mali L2 Cache" name="Active clock cycles" description="Active clock cycles"/>
99 103
@@ -126,55 +130,122 @@
126 <event event="0x07" option_set="Slaves" title="Mali L2 Cache" name="Read invalidates" description="Read invalidates"/> 130 <event event="0x07" option_set="Slaves" title="Mali L2 Cache" name="Read invalidates" description="Read invalidates"/>
127 <event event="0x08" option_set="Slaves" title="Mali L2 Cache" name="Cacheable read transactions" description="Cacheable read transactions"/> 131 <event event="0x08" option_set="Slaves" title="Mali L2 Cache" name="Cacheable read transactions" description="Cacheable read transactions"/>
128 </category> 132 </category>
129 <category name="ARM Mali-400 Filmstrip" counter_set="ARM_Mali-400_Filmstrip_cnt" per_cpu="no"> 133 <counter_set name="ARM_Mali-4xx_L2_1_cnt" title="Mali-4xx L2 1" description="Mali GPU L2 Cache Core 1" count="2"/>
134 <category name="Mali-4xx-L2_1" counter_set="ARM_Mali-4xx_L2_1_cnt" per_cpu="no">
135 <event event="0x01" title="Mali L2 Cache" name="Total clock cycles" description="Total clock cycles"/>
136 <event event="0x02" title="Mali L2 Cache" name="Active clock cycles" description="Active clock cycles"/>
137
138 <option_set name="All">
139 <option event_delta="0x08" name="Master" description="Master"/>
140 <option event_delta="0x10" name="All slaves" description="All slaves"/>
141 <option event_delta="0x20" name="Slave 0" description="Slave 0"/>
142 <option event_delta="0x30" name="Slave 1" description="Slave 1"/>
143 <option event_delta="0x40" name="Slave 2" description="Slave 2"/>
144 <option event_delta="0x50" name="Slave 3" description="Slave 3"/>
145 <option event_delta="0x60" name="Slave 4" description="Slave 4"/>
146 </option_set>
147
148 <option_set name="Slaves">
149 <option event_delta="0x10" name="All slaves" description="All slaves"/>
150 <option event_delta="0x20" name="Slave 0" description="Slave 0"/>
151 <option event_delta="0x30" name="Slave 1" description="Slave 1"/>
152 <option event_delta="0x40" name="Slave 2" description="Slave 2"/>
153 <option event_delta="0x50" name="Slave 3" description="Slave 3"/>
154 <option event_delta="0x60" name="Slave 4" description="Slave 4"/>
155 </option_set>
156
157 <event event="0x00" option_set="All" title="Mali L2 Cache" name="Read transactions" description="Read transactions"/>
158 <event event="0x01" option_set="All" title="Mali L2 Cache" name="Write transactions" description="Write transactions"/>
159 <event event="0x02" option_set="All" title="Mali L2 Cache" name="Words read" description="Words read"/>
160 <event event="0x03" option_set="All" title="Mali L2 Cache" name="Words written" description="Words written"/>
161 <event event="0x04" option_set="Slaves" title="Mali L2 Cache" name="Read hits" description="Read hits"/>
162 <event event="0x05" option_set="Slaves" title="Mali L2 Cache" name="Read misses" description="Read misses"/>
163 <event event="0x06" option_set="Slaves" title="Mali L2 Cache" name="Write invalidates" description="Write invalidates"/>
164 <event event="0x07" option_set="Slaves" title="Mali L2 Cache" name="Read invalidates" description="Read invalidates"/>
165 <event event="0x08" option_set="Slaves" title="Mali L2 Cache" name="Cacheable read transactions" description="Cacheable read transactions"/>
166 </category>
167 <counter_set name="ARM_Mali-4xx_L2_2_cnt" title="Mali-4xx L2 2" description="Mali GPU L2 Cache Core 2" count="2"/>
168 <category name="Mali-4xx-L2_2" counter_set="ARM_Mali-4xx_L2_2_cnt" per_cpu="no">
169 <event event="0x01" title="Mali L2 Cache" name="Total clock cycles" description="Total clock cycles"/>
170 <event event="0x02" title="Mali L2 Cache" name="Active clock cycles" description="Active clock cycles"/>
171
172 <option_set name="All">
173 <option event_delta="0x08" name="Master" description="Master"/>
174 <option event_delta="0x10" name="All slaves" description="All slaves"/>
175 <option event_delta="0x20" name="Slave 0" description="Slave 0"/>
176 <option event_delta="0x30" name="Slave 1" description="Slave 1"/>
177 <option event_delta="0x40" name="Slave 2" description="Slave 2"/>
178 <option event_delta="0x50" name="Slave 3" description="Slave 3"/>
179 <option event_delta="0x60" name="Slave 4" description="Slave 4"/>
180 </option_set>
181
182 <option_set name="Slaves">
183 <option event_delta="0x10" name="All slaves" description="All slaves"/>
184 <option event_delta="0x20" name="Slave 0" description="Slave 0"/>
185 <option event_delta="0x30" name="Slave 1" description="Slave 1"/>
186 <option event_delta="0x40" name="Slave 2" description="Slave 2"/>
187 <option event_delta="0x50" name="Slave 3" description="Slave 3"/>
188 <option event_delta="0x60" name="Slave 4" description="Slave 4"/>
189 </option_set>
190
191 <event event="0x00" option_set="All" title="Mali L2 Cache" name="Read transactions" description="Read transactions"/>
192 <event event="0x01" option_set="All" title="Mali L2 Cache" name="Write transactions" description="Write transactions"/>
193 <event event="0x02" option_set="All" title="Mali L2 Cache" name="Words read" description="Words read"/>
194 <event event="0x03" option_set="All" title="Mali L2 Cache" name="Words written" description="Words written"/>
195 <event event="0x04" option_set="Slaves" title="Mali L2 Cache" name="Read hits" description="Read hits"/>
196 <event event="0x05" option_set="Slaves" title="Mali L2 Cache" name="Read misses" description="Read misses"/>
197 <event event="0x06" option_set="Slaves" title="Mali L2 Cache" name="Write invalidates" description="Write invalidates"/>
198 <event event="0x07" option_set="Slaves" title="Mali L2 Cache" name="Read invalidates" description="Read invalidates"/>
199 <event event="0x08" option_set="Slaves" title="Mali L2 Cache" name="Cacheable read transactions" description="Cacheable read transactions"/>
200 </category>
201 <category name="ARM Mali-4xx Filmstrip" counter_set="ARM_Mali-4xx_Filmstrip_cnt" per_cpu="no">
130 <option_set name="fs"> 202 <option_set name="fs">
131 <option event_delta="0x3c" name="1:60" description="captures every 60th frame"/> 203 <option event_delta="0x3c" name="1:60" description="captures every 60th frame"/>
132 <option event_delta="0x1e" name="1:30" description="captures every 30th frame"/> 204 <option event_delta="0x1e" name="1:30" description="captures every 30th frame"/>
133 <option event_delta="0xa" name="1:10" description="captures every 10th frame"/> 205 <option event_delta="0xa" name="1:10" description="captures every 10th frame"/>
134 </option_set> 206 </option_set>
135 <event event="0x0400" option_set="fs" title="ARM Mali-400" name="Filmstrip" description="Scaled framebuffer"/> 207 <event event="0x0400" option_set="fs" title="ARM Mali-4xx" name="Filmstrip" description="Scaled framebuffer"/>
136 </category> 208 </category>
137 <category name="ARM_Mali-400_Voltage" per_cpu="no"> 209 <category name="ARM_Mali-4xx_Voltage" per_cpu="no">
138 <event counter="ARM_Mali-400_Voltage" title="Mali GPU Voltage" name="Voltage" display="average" average_selection="yes" units="mV" description="GPU core voltage."/> 210 <event counter="ARM_Mali-4xx_Voltage" title="Mali GPU Voltage" name="Voltage" display="average" average_selection="yes" units="mV" description="GPU core voltage."/>
139 </category> 211 </category>
140 <category name="ARM_Mali-400_Frequency" per_cpu="no"> 212 <category name="ARM_Mali-4xx_Frequency" per_cpu="no">
141 <event counter="ARM_Mali-400_Frequency" title="Mali GPU Frequency" name="Frequency" display="average" average_selection="yes" units="MHz" description="GPU core frequency."/> 213 <event counter="ARM_Mali-4xx_Frequency" title="Mali GPU Frequency" name="Frequency" display="average" average_selection="yes" units="MHz" description="GPU core frequency."/>
142 </category> 214 </category>
143 <category name="Mali-400-SW" counter_set="ARM_Mali-400_SW_cnt" per_cpu="no"> 215 <category name="Mali-4xx-SW" counter_set="ARM_Mali-4xx_SW_cnt" per_cpu="no">
144 <!-- EGL Counters --> 216 <!-- EGL Counters -->
145 <event counter="ARM_Mali-400_SW_17" title="Mali EGL Software Counters" name="Blit Time" description="Time spent blitting the framebuffer from video memory to framebuffer."/> 217 <event counter="ARM_Mali-4xx_SW_0" title="Mali EGL Software Counters" name="Blit Time" description="Time spent blitting the framebuffer from video memory to framebuffer."/>
146 <!-- glDrawElements Counters --> 218 <!-- glDrawElements Counters -->
147 <event counter="ARM_Mali-400_SW_18" title="glDrawElements Statistics" name="Calls to glDrawElements" description="Number of calls to glDrawElements."/> 219 <event counter="ARM_Mali-4xx_SW_1" title="glDrawElements Statistics" name="Calls to glDrawElements" description="Number of calls to glDrawElements."/>
148 <event counter="ARM_Mali-400_SW_19" title="glDrawElements Statistics" name="Indices to glDrawElements" description="Number of indices to glDrawElements."/> 220 <event counter="ARM_Mali-4xx_SW_2" title="glDrawElements Statistics" name="Indices to glDrawElements" description="Number of indices to glDrawElements."/>
149 <event counter="ARM_Mali-400_SW_20" title="glDrawElements Statistics" name="Transformed by glDrawElements" description="Number of vertices transformed by glDrawElements."/> 221 <event counter="ARM_Mali-4xx_SW_3" title="glDrawElements Statistics" name="Transformed by glDrawElements" description="Number of vertices transformed by glDrawElements."/>
150 <!-- glDrawArrays Counters --> 222 <!-- glDrawArrays Counters -->
151 <event counter="ARM_Mali-400_SW_21" title="glDrawArrays Statistics" name="Calls to glDrawArrays" description="Number of calls to glDrawArrays."/> 223 <event counter="ARM_Mali-4xx_SW_4" title="glDrawArrays Statistics" name="Calls to glDrawArrays" description="Number of calls to glDrawArrays."/>
152 <event counter="ARM_Mali-400_SW_22" title="glDrawArrays Statistics" name="Transformed by glDrawArrays" description="Number of vertices transformed by glDrawArrays."/> 224 <event counter="ARM_Mali-4xx_SW_5" title="glDrawArrays Statistics" name="Transformed by glDrawArrays" description="Number of vertices transformed by glDrawArrays."/>
153 <!-- Draw Call Counters --> 225 <!-- Draw Call Counters -->
154 <event counter="ARM_Mali-400_SW_23" title="Drawcall Statistics" name="Points" description="Number of calls to glDraw* with parameter GL_POINTS."/> 226 <event counter="ARM_Mali-4xx_SW_6" title="Drawcall Statistics" name="Points" description="Number of calls to glDraw* with parameter GL_POINTS."/>
155 <event counter="ARM_Mali-400_SW_24" title="Drawcall Statistics" name="Lines" description="Number of calls to glDraw* with parameter GL_LINES."/> 227 <event counter="ARM_Mali-4xx_SW_7" title="Drawcall Statistics" name="Lines" description="Number of calls to glDraw* with parameter GL_LINES."/>
156 <event counter="ARM_Mali-400_SW_25" title="Drawcall Statistics" name="Lineloop" description="Number of calls to glDraw* with parameter GL_LINE_LOOP."/> 228 <event counter="ARM_Mali-4xx_SW_8" title="Drawcall Statistics" name="Lineloop" description="Number of calls to glDraw* with parameter GL_LINE_LOOP."/>
157 <event counter="ARM_Mali-400_SW_26" title="Drawcall Statistics" name="Linestrip" description="Number of calls to glDraw* with parameter GL_LINE_STRIP."/> 229 <event counter="ARM_Mali-4xx_SW_9" title="Drawcall Statistics" name="Linestrip" description="Number of calls to glDraw* with parameter GL_LINE_STRIP."/>
158 <event counter="ARM_Mali-400_SW_27" title="Drawcall Statistics" name="Triangles" description="Number of calls to glDraw* with parameter GL_TRIANGLES."/> 230 <event counter="ARM_Mali-4xx_SW_10" title="Drawcall Statistics" name="Triangles" description="Number of calls to glDraw* with parameter GL_TRIANGLES."/>
159 <event counter="ARM_Mali-400_SW_28" title="Drawcall Statistics" name="Trianglestrip" description="Number of calls to glDraw* with parameter GL_TRIANGLE_STRIP."/> 231 <event counter="ARM_Mali-4xx_SW_11" title="Drawcall Statistics" name="Trianglestrip" description="Number of calls to glDraw* with parameter GL_TRIANGLE_STRIP."/>
160 <event counter="ARM_Mali-400_SW_29" title="Drawcall Statistics" name="Trianglefan" description="Number of calls to glDraw* with parameter GL_TRIANGLE_FAN."/> 232 <event counter="ARM_Mali-4xx_SW_12" title="Drawcall Statistics" name="Trianglefan" description="Number of calls to glDraw* with parameter GL_TRIANGLE_FAN."/>
161 <event counter="ARM_Mali-400_SW_30" title="Drawcall Statistics" name="Vertex Upload Time (us)" description="Time spent uploading vertex attributes and faceindex data not present in a VBO."/> 233 <event counter="ARM_Mali-4xx_SW_13" title="Drawcall Statistics" name="Vertex Upload Time (us)" description="Time spent uploading vertex attributes and faceindex data not present in a VBO."/>
162 <event counter="ARM_Mali-400_SW_31" title="Drawcall Statistics" name="Uniform Bytes Copied (bytes)" description="Number of bytes copied to Mali memory as a result of uniforms update."/> 234 <event counter="ARM_Mali-4xx_SW_14" title="Drawcall Statistics" name="Uniform Bytes Copied (bytes)" description="Number of bytes copied to Mali memory as a result of uniforms update."/>
163 <!-- Buffer Profiling Counters --> 235 <!-- Buffer Profiling Counters -->
164 <event counter="ARM_Mali-400_SW_32" title="Buffer Profiling" name="Texture Upload Time (ms)" description="Time spent uploading textures."/> 236 <event counter="ARM_Mali-4xx_SW_15" title="Buffer Profiling" name="Texture Upload Time (ms)" description="Time spent uploading textures."/>
165 <event counter="ARM_Mali-400_SW_33" title="Buffer Profiling" name="VBO Upload Time (ms)" description="Time spent uploading vertex buffer objects."/> 237 <event counter="ARM_Mali-4xx_SW_16" title="Buffer Profiling" name="VBO Upload Time (ms)" description="Time spent uploading vertex buffer objects."/>
166 <event counter="ARM_Mali-400_SW_34" title="Buffer Profiling" name="FBO Flushes" description="Number of flushed on framebuffer attachment."/> 238 <event counter="ARM_Mali-4xx_SW_17" title="Buffer Profiling" name="FBO Flushes" description="Number of flushed on framebuffer attachment."/>
167 <!-- OpenGL ES 1.1 Emulation --> 239 <!-- OpenGL ES 1.1 Emulation -->
168 <event counter="ARM_Mali-400_SW_35" title="Fixed-function Emulation" name="# Vertex Shaders Generated" description="Number of vertex shaders generated."/> 240 <event counter="ARM_Mali-4xx_SW_18" title="Fixed-function Emulation" name="# Vertex Shaders Generated" description="Number of vertex shaders generated."/>
169 <event counter="ARM_Mali-400_SW_36" title="Fixed-function Emulation" name="# Fragment Shaders Generated" description="Number of fragment shaders generated."/> 241 <event counter="ARM_Mali-4xx_SW_19" title="Fixed-function Emulation" name="# Fragment Shaders Generated" description="Number of fragment shaders generated."/>
170 <!-- Geometry Statistics --> 242 <!-- Geometry Statistics -->
171 <event counter="ARM_Mali-400_SW_50" title="Geometry Statistics" name="Triangles" description="The total number of triangles passed to GLES per-frame."/> 243 <event counter="ARM_Mali-4xx_SW_33" title="Geometry Statistics" name="Triangles" description="The total number of triangles passed to GLES per-frame."/>
172 <event counter="ARM_Mali-400_SW_51" title="Geometry Statistics" name="Independent Triangles" description="Number of triangles passed to GLES using the mode GL_TRIANGLES."/> 244 <event counter="ARM_Mali-4xx_SW_34" title="Geometry Statistics" name="Independent Triangles" description="Number of triangles passed to GLES using the mode GL_TRIANGLES."/>
173 <event counter="ARM_Mali-400_SW_52" title="Geometry Statistics" name="Strip Triangles" description="Number of triangles passed to GLES using the mode GL_TRIANGLE_STRIP."/> 245 <event counter="ARM_Mali-4xx_SW_35" title="Geometry Statistics" name="Strip Triangles" description="Number of triangles passed to GLES using the mode GL_TRIANGLE_STRIP."/>
174 <event counter="ARM_Mali-400_SW_53" title="Geometry Statistics" name="Fan Triangles" description="Number of triangles passed to GLES using the mode GL_TRIANGLE_FAN."/> 246 <event counter="ARM_Mali-4xx_SW_36" title="Geometry Statistics" name="Fan Triangles" description="Number of triangles passed to GLES using the mode GL_TRIANGLE_FAN."/>
175 <event counter="ARM_Mali-400_SW_54" title="Geometry Statistics" name="Lines" description="Number of lines passed to GLES per-frame."/> 247 <event counter="ARM_Mali-4xx_SW_37" title="Geometry Statistics" name="Lines" description="Number of lines passed to GLES per-frame."/>
176 <event counter="ARM_Mali-400_SW_55" title="Geometry Statistics" name="Independent Lines" description="Number of lines passed to GLES using the mode GL_LINES."/> 248 <event counter="ARM_Mali-4xx_SW_38" title="Geometry Statistics" name="Independent Lines" description="Number of lines passed to GLES using the mode GL_LINES."/>
177 <event counter="ARM_Mali-400_SW_56" title="Geometry Statistics" name="Strip Lines" description="Number of lines passed to GLES using the mode GL_LINE_STRIP."/> 249 <event counter="ARM_Mali-4xx_SW_39" title="Geometry Statistics" name="Strip Lines" description="Number of lines passed to GLES using the mode GL_LINE_STRIP."/>
178 <event counter="ARM_Mali-400_SW_57" title="Geometry Statistics" name="Loop Lines" description="Number of lines passed to GLES using the mode GL_LINE_LOOP."/> 250 <event counter="ARM_Mali-4xx_SW_40" title="Geometry Statistics" name="Loop Lines" description="Number of lines passed to GLES using the mode GL_LINE_LOOP."/>
179 </category> 251 </category>
180
diff --git a/daemon/events-Mali-T6xx_hw.xml b/daemon/events-Mali-T6xx_hw.xml
index 1fd9c4e..8cfe7c3 100644
--- a/daemon/events-Mali-T6xx_hw.xml
+++ b/daemon/events-Mali-T6xx_hw.xml
@@ -5,14 +5,14 @@
5 <event counter="ARM_Mali-T6xx_IRQ_ACTIVE" title="Mali Job Manager Cycles" name="IRQ cycles" description="Number of cycles the GPU had a pending interrupt"/> 5 <event counter="ARM_Mali-T6xx_IRQ_ACTIVE" title="Mali Job Manager Cycles" name="IRQ cycles" description="Number of cycles the GPU had a pending interrupt"/>
6 <event counter="ARM_Mali-T6xx_JS0_ACTIVE" title="Mali Job Manager Cycles" name="JS0 cycles" description="Number of cycles JS0 (fragment) was active"/> 6 <event counter="ARM_Mali-T6xx_JS0_ACTIVE" title="Mali Job Manager Cycles" name="JS0 cycles" description="Number of cycles JS0 (fragment) was active"/>
7 <event counter="ARM_Mali-T6xx_JS1_ACTIVE" title="Mali Job Manager Cycles" name="JS1 cycles" description="Number of cycles JS1 (vertex/tiler/compute) was active"/> 7 <event counter="ARM_Mali-T6xx_JS1_ACTIVE" title="Mali Job Manager Cycles" name="JS1 cycles" description="Number of cycles JS1 (vertex/tiler/compute) was active"/>
8 <event counter="ARM_Mali-T6xx_JS2_ACTIVE" title="Mali Job Manager Cycles" name="JS2 cycles" description="Number of cycles JS2 (compute) was active"/> 8 <event counter="ARM_Mali-T6xx_JS2_ACTIVE" title="Mali Job Manager Cycles" name="JS2 cycles" description="Number of cycles JS2 (vertex/compute) was active"/>
9 9
10 <event counter="ARM_Mali-T6xx_JS0_JOBS" title="Mali Job Manager Work" name="JS0 jobs" description="Number of Jobs (fragment) completed in JS0"/> 10 <event counter="ARM_Mali-T6xx_JS0_JOBS" title="Mali Job Manager Work" name="JS0 jobs" description="Number of Jobs (fragment) completed in JS0"/>
11 <event counter="ARM_Mali-T6xx_JS0_TASKS" title="Mali Job Manager Work" name="JS0 tasks" description="Number of Tasks completed in JS0"/> 11 <event counter="ARM_Mali-T6xx_JS0_TASKS" title="Mali Job Manager Work" name="JS0 tasks" description="Number of Tasks completed in JS0"/>
12 <event counter="ARM_Mali-T6xx_JS1_JOBS" title="Mali Job Manager Work" name="JS1 jobs" description="Number of Jobs (vertex/tiler/compute) completed in JS1"/> 12 <event counter="ARM_Mali-T6xx_JS1_JOBS" title="Mali Job Manager Work" name="JS1 jobs" description="Number of Jobs (vertex/tiler/compute) completed in JS1"/>
13 <event counter="ARM_Mali-T6xx_JS1_TASKS" title="Mali Job Manager Work" name="JS1 tasks" description="Number of Tasks completed in JS1"/> 13 <event counter="ARM_Mali-T6xx_JS1_TASKS" title="Mali Job Manager Work" name="JS1 tasks" description="Number of Tasks completed in JS1"/>
14 <event counter="ARM_Mali-T6xx_JS2_TASKS" title="Mali Job Manager Work" name="JS2 tasks" description="Number of Tasks completed in JS2"/> 14 <event counter="ARM_Mali-T6xx_JS2_TASKS" title="Mali Job Manager Work" name="JS2 tasks" description="Number of Tasks completed in JS2"/>
15 <event counter="ARM_Mali-T6xx_JS2_JOBS" title="Mali Job Manager Work" name="JS2 jobs" description="Number of Jobs (compute) completed in JS2"/> 15 <event counter="ARM_Mali-T6xx_JS2_JOBS" title="Mali Job Manager Work" name="JS2 jobs" description="Number of Jobs (vertex/compute) completed in JS2"/>
16 16
17 </category> 17 </category>
18 18
diff --git a/daemon/main.cpp b/daemon/main.cpp
index a6ddfe2..d1b0913 100644
--- a/daemon/main.cpp
+++ b/daemon/main.cpp
@@ -19,6 +19,8 @@
19#include <sys/mman.h> 19#include <sys/mman.h>
20#include <sys/time.h> 20#include <sys/time.h>
21#include <sys/resource.h> 21#include <sys/resource.h>
22#include <arpa/inet.h>
23#include <sys/socket.h>
22#include "Child.h" 24#include "Child.h"
23#include "SessionData.h" 25#include "SessionData.h"
24#include "OlySocket.h" 26#include "OlySocket.h"
@@ -32,7 +34,7 @@ extern Child* child;
32static int shutdownFilesystem(); 34static int shutdownFilesystem();
33static pthread_mutex_t numSessions_mutex; 35static pthread_mutex_t numSessions_mutex;
34static int numSessions = 0; 36static int numSessions = 0;
35static OlySocket* socket = NULL; 37static OlySocket* sock = NULL;
36static bool driverRunningAtStart = false; 38static bool driverRunningAtStart = false;
37static bool driverMountedAtStart = false; 39static bool driverMountedAtStart = false;
38 40
@@ -41,11 +43,13 @@ struct cmdline_t {
41 char* module; 43 char* module;
42}; 44};
43 45
46#define DEFAULT_PORT 8080
47
44void cleanUp() { 48void cleanUp() {
45 if (shutdownFilesystem() == -1) { 49 if (shutdownFilesystem() == -1) {
46 logg->logMessage("Error shutting down gator filesystem"); 50 logg->logMessage("Error shutting down gator filesystem");
47 } 51 }
48 delete socket; 52 delete sock;
49 delete util; 53 delete util;
50 delete logg; 54 delete logg;
51} 55}
@@ -100,6 +104,92 @@ static void child_exit(int signum) {
100 } 104 }
101} 105}
102 106
107static int udpPort(int port) {
108 int s;
109 struct sockaddr_in sockaddr;
110 int on;
111
112 s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
113 if (s == -1) {
114 logg->logError(__FILE__, __LINE__, "socket failed");
115 handleException();
116 }
117
118 on = 1;
119 if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char*)&on, sizeof(on)) != 0) {
120 logg->logError(__FILE__, __LINE__, "setsockopt failed");
121 handleException();
122 }
123
124 memset((void*)&sockaddr, 0, sizeof(sockaddr));
125 sockaddr.sin_family = AF_INET;
126 sockaddr.sin_port = htons(port);
127 sockaddr.sin_addr.s_addr = INADDR_ANY;
128 if (bind(s, (struct sockaddr *)&sockaddr, sizeof(sockaddr)) < 0) {
129 logg->logError(__FILE__, __LINE__, "socket failed");
130 handleException();
131 }
132
133 return s;
134}
135
136#define UDP_ANS_PORT 30000
137#define UDP_REQ_PORT 30001
138
139typedef struct {
140 char rviHeader[8];
141 uint32_t messageID;
142 uint8_t ethernetAddress[8];
143 uint32_t ethernetType;
144 uint32_t dhcp;
145 char dhcpName[40];
146 uint32_t ipAddress;
147 uint32_t defaultGateway;
148 uint32_t subnetMask;
149 uint32_t activeConnections;
150} RVIConfigureInfo;
151
152static const char DST_REQ[] = { 'D', 'S', 'T', '_', 'R', 'E', 'Q', ' ', 0, 0, 0, 0x64 };
153
154static void* answerThread(void* pVoid) {
155 const struct cmdline_t * const cmdline = (struct cmdline_t *)pVoid;
156 RVIConfigureInfo dstAns;
157 int req = udpPort(UDP_REQ_PORT);
158 int ans = udpPort(UDP_ANS_PORT);
159
160 // Format the answer buffer
161 memset(&dstAns, 0, sizeof(dstAns));
162 memcpy(dstAns.rviHeader, "STR_ANS ", sizeof(dstAns.rviHeader));
163 if (gethostname(dstAns.dhcpName, sizeof(dstAns.dhcpName) - 1) != 0) {
164 logg->logError(__FILE__, __LINE__, "gethostname failed");
165 handleException();
166 }
167 // Subvert the defaultGateway field for the port number
168 if (cmdline->port != DEFAULT_PORT) {
169 dstAns.defaultGateway = cmdline->port;
170 }
171 // Subvert the subnetMask field for the protocol version
172 dstAns.subnetMask = PROTOCOL_VERSION;
173
174 for (;;) {
175 char buf[128];
176 struct sockaddr_in sockaddr;
177 socklen_t addrlen;
178 int read;
179 addrlen = sizeof(sockaddr);
180 read = recvfrom(req, &buf, sizeof(buf), 0, (struct sockaddr *)&sockaddr, &addrlen);
181 if (read < 0) {
182 logg->logError(__FILE__, __LINE__, "recvfrom failed");
183 handleException();
184 } else if ((read == 12) && (memcmp(buf, DST_REQ, sizeof(DST_REQ)) == 0)) {
185 if (sendto(ans, &dstAns, sizeof(dstAns), 0, (struct sockaddr *)&sockaddr, addrlen) != sizeof(dstAns)) {
186 logg->logError(__FILE__, __LINE__, "sendto failed");
187 handleException();
188 }
189 }
190 }
191}
192
103// retval: -1 = failure; 0 = was already mounted; 1 = successfully mounted 193// retval: -1 = failure; 0 = was already mounted; 1 = successfully mounted
104static int mountGatorFS() { 194static int mountGatorFS() {
105 // If already mounted, 195 // If already mounted,
@@ -222,14 +312,14 @@ static int shutdownFilesystem() {
222 312
223static struct cmdline_t parseCommandLine(int argc, char** argv) { 313static struct cmdline_t parseCommandLine(int argc, char** argv) {
224 struct cmdline_t cmdline; 314 struct cmdline_t cmdline;
225 cmdline.port = 8080; 315 cmdline.port = DEFAULT_PORT;
226 cmdline.module = NULL; 316 cmdline.module = NULL;
227 char version_string[256]; // arbitrary length to hold the version information 317 char version_string[256]; // arbitrary length to hold the version information
228 int c; 318 int c;
229 319
230 // build the version string 320 // build the version string
231 if (PROTOCOL_VERSION < PROTOCOL_DEV) { 321 if (PROTOCOL_VERSION < PROTOCOL_DEV) {
232 snprintf(version_string, sizeof(version_string), "Streamline gatord version %d (DS-5 v5.%d)", PROTOCOL_VERSION, PROTOCOL_VERSION + 1); 322 snprintf(version_string, sizeof(version_string), "Streamline gatord version %d (DS-5 v5.%d)", PROTOCOL_VERSION, PROTOCOL_VERSION);
233 } else { 323 } else {
234 snprintf(version_string, sizeof(version_string), "Streamline gatord development version %d", PROTOCOL_VERSION); 324 snprintf(version_string, sizeof(version_string), "Streamline gatord development version %d", PROTOCOL_VERSION);
235 } 325 }
@@ -277,7 +367,7 @@ static struct cmdline_t parseCommandLine(int argc, char** argv) {
277 } 367 }
278 368
279 // Error checking 369 // Error checking
280 if (cmdline.port != 8080 && gSessionData->mSessionXMLPath != NULL) { 370 if (cmdline.port != DEFAULT_PORT && gSessionData->mSessionXMLPath != NULL) {
281 logg->logError(__FILE__, __LINE__, "Only a port or a session xml can be specified, not both"); 371 logg->logError(__FILE__, __LINE__, "Only a port or a session xml can be specified, not both");
282 handleException(); 372 handleException();
283 } 373 }
@@ -339,11 +429,16 @@ int main(int argc, char** argv, char* envp[]) {
339 child->run(); 429 child->run();
340 delete child; 430 delete child;
341 } else { 431 } else {
342 socket = new OlySocket(cmdline.port, true); 432 pthread_t answerThreadID;
433 if (pthread_create(&answerThreadID, NULL, answerThread, &cmdline)) {
434 logg->logError(__FILE__, __LINE__, "Failed to create answer thread");
435 handleException();
436 }
437 sock = new OlySocket(cmdline.port, true);
343 // Forever loop, can be exited via a signal or exception 438 // Forever loop, can be exited via a signal or exception
344 while (1) { 439 while (1) {
345 logg->logMessage("Waiting on connection..."); 440 logg->logMessage("Waiting on connection...");
346 socket->acceptConnection(); 441 sock->acceptConnection();
347 442
348 int pid = fork(); 443 int pid = fork();
349 if (pid < 0) { 444 if (pid < 0) {
@@ -351,14 +446,14 @@ int main(int argc, char** argv, char* envp[]) {
351 logg->logError(__FILE__, __LINE__, "Fork process failed. Please power cycle the target device if this error persists."); 446 logg->logError(__FILE__, __LINE__, "Fork process failed. Please power cycle the target device if this error persists.");
352 } else if (pid == 0) { 447 } else if (pid == 0) {
353 // Child 448 // Child
354 socket->closeServerSocket(); 449 sock->closeServerSocket();
355 child = new Child(socket, numSessions + 1); 450 child = new Child(sock, numSessions + 1);
356 child->run(); 451 child->run();
357 delete child; 452 delete child;
358 exit(0); 453 exit(0);
359 } else { 454 } else {
360 // Parent 455 // Parent
361 socket->closeSocket(); 456 sock->closeSocket();
362 457
363 pthread_mutex_lock(&numSessions_mutex); 458 pthread_mutex_lock(&numSessions_mutex);
364 numSessions++; 459 numSessions++;
diff --git a/driver/Makefile b/driver/Makefile
index 3af8b8d..0d4ca68 100644
--- a/driver/Makefile
+++ b/driver/Makefile
@@ -21,10 +21,13 @@ gator-y += gator_events_mali_t6xx.o \
21 gator_events_mali_t6xx_hw.o 21 gator_events_mali_t6xx_hw.o
22include $(M)/mali_t6xx.mk 22include $(M)/mali_t6xx.mk
23else 23else
24gator-y += gator_events_mali_400.o 24gator-y += gator_events_mali_4xx.o
25endif 25endif
26gator-y += gator_events_mali_common.o 26gator-y += gator_events_mali_common.o
27EXTRA_CFLAGS += -DMALI_SUPPORT=$(GATOR_WITH_MALI_SUPPORT) 27EXTRA_CFLAGS += -DMALI_SUPPORT=$(GATOR_WITH_MALI_SUPPORT)
28ifneq ($(GATOR_MALI_INTERFACE_STYLE),)
29EXTRA_CFLAGS += -DGATOR_MALI_INTERFACE_STYLE=$(GATOR_MALI_INTERFACE_STYLE)
30endif
28endif 31endif
29 32
30# GATOR_TEST controls whether to include (=1) or exclude (=0) test code. 33# GATOR_TEST controls whether to include (=1) or exclude (=0) test code.
@@ -33,9 +36,12 @@ EXTRA_CFLAGS += -DGATOR_TEST=$(GATOR_TEST)
33 36
34gator-$(CONFIG_ARM) += gator_events_armv6.o \ 37gator-$(CONFIG_ARM) += gator_events_armv6.o \
35 gator_events_armv7.o \ 38 gator_events_armv7.o \
39 gator_events_ccn-504.o \
36 gator_events_l2c-310.o \ 40 gator_events_l2c-310.o \
37 gator_events_scorpion.o 41 gator_events_scorpion.o
38 42
43gator-$(CONFIG_ARM64) += gator_events_ccn-504.o
44
39$(obj)/gator_main.o: gator_events.h 45$(obj)/gator_main.o: gator_events.h
40 46
41clean-files := gator_events.h 47clean-files := gator_events.h
diff --git a/driver/gator.h b/driver/gator.h
index 205cbcd..2e122da 100644
--- a/driver/gator.h
+++ b/driver/gator.h
@@ -20,8 +20,6 @@
20#define GATOR_CPU_FREQ_SUPPORT (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)) && defined(CONFIG_CPU_FREQ) 20#define GATOR_CPU_FREQ_SUPPORT (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)) && defined(CONFIG_CPU_FREQ)
21#define GATOR_IKS_SUPPORT defined(CONFIG_BL_SWITCHER) 21#define GATOR_IKS_SUPPORT defined(CONFIG_BL_SWITCHER)
22 22
23#define GATOR_LIVE 1
24
25// cpu ids 23// cpu ids
26#define ARM1136 0xb36 24#define ARM1136 0xb36
27#define ARM1156 0xb56 25#define ARM1156 0xb56
@@ -31,6 +29,7 @@
31#define CORTEX_A7 0xc07 29#define CORTEX_A7 0xc07
32#define CORTEX_A8 0xc08 30#define CORTEX_A8 0xc08
33#define CORTEX_A9 0xc09 31#define CORTEX_A9 0xc09
32#define CORTEX_A12 0xc0d
34#define CORTEX_A15 0xc0f 33#define CORTEX_A15 0xc0f
35#define SCORPION 0x00f 34#define SCORPION 0x00f
36#define SCORPIONMP 0x02d 35#define SCORPIONMP 0x02d
@@ -46,9 +45,14 @@
46 45
47struct gator_cpu { 46struct gator_cpu {
48 const int cpuid; 47 const int cpuid;
48 // Human readable name
49 const char core_name[MAXSIZE_CORE_NAME]; 49 const char core_name[MAXSIZE_CORE_NAME];
50 // Perf PMU name
50 const char * const pmu_name; 51 const char * const pmu_name;
52 // gatorfs event name
51 const char * const pmnc_name; 53 const char * const pmnc_name;
54 // compatible from Documentation/devicetree/bindings/arm/cpus.txt
55 const char * const dt_name;
52 const int pmnc_counters; 56 const int pmnc_counters;
53}; 57};
54 58
diff --git a/driver/gator_annotate.c b/driver/gator_annotate.c
index ad9f309..5b9399b 100644
--- a/driver/gator_annotate.c
+++ b/driver/gator_annotate.c
@@ -39,14 +39,17 @@ static int annotate_copy(struct file *file, char const __user *buf, size_t count
39static ssize_t annotate_write(struct file *file, char const __user *buf, size_t count_orig, loff_t *offset) 39static ssize_t annotate_write(struct file *file, char const __user *buf, size_t count_orig, loff_t *offset)
40{ 40{
41 int pid, cpu, header_size, available, contiguous, length1, length2, size, count = count_orig & 0x7fffffff; 41 int pid, cpu, header_size, available, contiguous, length1, length2, size, count = count_orig & 0x7fffffff;
42 bool interrupt_context;
42 43
43 if (*offset) { 44 if (*offset) {
44 return -EINVAL; 45 return -EINVAL;
45 } 46 }
46 47
47 // Annotations are not supported in interrupt context 48 interrupt_context = in_interrupt();
48 if (in_interrupt()) { 49 // Annotations are not supported in interrupt context, but may work if you comment out the the next four lines of code.
49 printk(KERN_WARNING "gator: Annotations are not supported in interrupt context\n"); 50 // By doing so, annotations in interrupt context can result in deadlocks and lost data.
51 if (interrupt_context) {
52 printk(KERN_WARNING "gator: Annotations are not supported in interrupt context. Edit gator_annotate.c in the gator driver to enable annotations in interrupt context.\n");
50 return -EINVAL; 53 return -EINVAL;
51 } 54 }
52 55
@@ -77,7 +80,19 @@ static ssize_t annotate_write(struct file *file, char const __user *buf, size_t
77 if (size <= 0) { 80 if (size <= 0) {
78 // Buffer is full, wait until space is available 81 // Buffer is full, wait until space is available
79 spin_unlock(&annotate_lock); 82 spin_unlock(&annotate_lock);
83
84 // Drop the annotation as blocking is not allowed in interrupt context
85 if (interrupt_context) {
86 return -EINVAL;
87 }
88
80 wait_event_interruptible(gator_annotate_wait, buffer_bytes_available(cpu, ANNOTATE_BUF) > header_size || !collect_annotations); 89 wait_event_interruptible(gator_annotate_wait, buffer_bytes_available(cpu, ANNOTATE_BUF) > header_size || !collect_annotations);
90
91 // Check to see if a signal is pending
92 if (signal_pending(current)) {
93 return -EINTR;
94 }
95
81 goto retry; 96 goto retry;
82 } 97 }
83 98
diff --git a/driver/gator_cookies.c b/driver/gator_cookies.c
index c332187..5f98a1c 100644
--- a/driver/gator_cookies.c
+++ b/driver/gator_cookies.c
@@ -240,13 +240,13 @@ static inline uint32_t get_cookie(int cpu, struct task_struct *task, const char
240 240
241 if (strcmp(text, "app_process") == 0) { 241 if (strcmp(text, "app_process") == 0) {
242 if (!translate_app_process(&text, cpu, task, from_wq)) 242 if (!translate_app_process(&text, cpu, task, from_wq))
243 return INVALID_COOKIE; 243 return UNRESOLVED_COOKIE;
244 } 244 }
245 245
246 // Can be called from interrupt handler or from work queue or from scheduler trace 246 // Can be called from interrupt handler or from work queue or from scheduler trace
247 local_irq_save(flags); 247 local_irq_save(flags);
248 248
249 cookie = INVALID_COOKIE; 249 cookie = UNRESOLVED_COOKIE;
250 if (marshal_cookie_header(text)) { 250 if (marshal_cookie_header(text)) {
251 cookie = per_cpu(cookie_next_key, cpu) += nr_cpu_ids; 251 cookie = per_cpu(cookie_next_key, cpu) += nr_cpu_ids;
252 cookiemap_add(key, cookie); 252 cookiemap_add(key, cookie);
@@ -272,7 +272,7 @@ static int get_exec_cookie(int cpu, struct task_struct *task)
272 return get_cookie(cpu, task, text, false); 272 return get_cookie(cpu, task, text, false);
273 } 273 }
274 274
275 return INVALID_COOKIE; 275 return UNRESOLVED_COOKIE;
276} 276}
277 277
278static unsigned long get_address_cookie(int cpu, struct task_struct *task, unsigned long addr, off_t *offset) 278static unsigned long get_address_cookie(int cpu, struct task_struct *task, unsigned long addr, off_t *offset)
@@ -302,7 +302,7 @@ static unsigned long get_address_cookie(int cpu, struct task_struct *task, unsig
302 } 302 }
303 303
304 if (!vma) 304 if (!vma)
305 cookie = INVALID_COOKIE; 305 cookie = UNRESOLVED_COOKIE;
306 306
307 return cookie; 307 return cookie;
308} 308}
diff --git a/driver/gator_events_ccn-504.c b/driver/gator_events_ccn-504.c
new file mode 100644
index 0000000..b91a9a1
--- /dev/null
+++ b/driver/gator_events_ccn-504.c
@@ -0,0 +1,306 @@
1/**
2 * Copyright (C) ARM Limited 2013. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9/*******************************************************************************
10 * WARNING: This code is an experimental implementation of the CCN-504 hardware
11 * counters which has not been tested on the hardware. Commented debug
12 * statements are present and can be uncommented for diagnostic purposes.
13 ******************************************************************************/
14
15#include <linux/io.h>
16#include <linux/module.h>
17
18#include "gator.h"
19
20#define PERIPHBASE 0x2E000000
21
22#define NUM_REGIONS 256
23#define REGION_SIZE (64*1024)
24#define REGION_DEBUG 1
25#define REGION_XP 64
26
27// DT (Debug) region
28#define PMEVCNTSR0 0x0150
29#define PMCCNTRSR 0x0190
30#define PMCR 0x01A8
31#define PMSR 0x01B0
32#define PMSR_REQ 0x01B8
33#define PMSR_CLR 0x01C0
34
35// XP region
36#define DT_CONFIG 0x0300
37
38// Multiple
39#define PMU_EVENT_SEL 0x0600
40#define OLY_ID 0xFF00
41
42#define CCNT 4
43#define CNTMAX (4 + 1)
44
45#define get_pmu_event_id(event) (((event) >> 0) & 0xFF)
46#define get_node_type(event) (((event) >> 8) & 0xFF)
47#define get_region(event) (((event) >> 16) & 0xFF)
48
49MODULE_PARM_DESC(ccn504_addr, "CCN-504 physical base address");
50static unsigned long ccn504_addr = 0;
51module_param(ccn504_addr, ulong, 0444);
52
53static void __iomem *gator_events_ccn504_base;
54static unsigned long gator_events_ccn504_enabled[CNTMAX];
55static unsigned long gator_events_ccn504_event[CNTMAX];
56static unsigned long gator_events_ccn504_key[CNTMAX];
57static int gator_events_ccn504_buffer[2*CNTMAX];
58
59static void gator_events_ccn504_create_shutdown(void)
60{
61 if (gator_events_ccn504_base != NULL) {
62 iounmap(gator_events_ccn504_base);
63 }
64}
65
66static int gator_events_ccn504_create_files(struct super_block *sb, struct dentry *root)
67{
68 struct dentry *dir;
69 int i;
70 char buf[32];
71
72 for (i = 0; i < CNTMAX; ++i) {
73 if (i == CCNT) {
74 snprintf(buf, sizeof(buf), "CCN-504_ccnt");
75 } else {
76 snprintf(buf, sizeof(buf), "CCN-504_cnt%i", i);
77 }
78 dir = gatorfs_mkdir(sb, root, buf);
79 if (!dir) {
80 return -1;
81 }
82
83 gatorfs_create_ulong(sb, dir, "enabled", &gator_events_ccn504_enabled[i]);
84 if (i != CCNT) {
85 gatorfs_create_ulong(sb, dir, "event", &gator_events_ccn504_event[i]);
86 }
87 gatorfs_create_ro_ulong(sb, dir, "key", &gator_events_ccn504_key[i]);
88 }
89
90 return 0;
91}
92
93static void gator_events_ccn504_set_dt_config(int xp_node_id, int event_num, int value)
94{
95 u32 dt_config;
96
97 dt_config = readl(gator_events_ccn504_base + (REGION_XP + xp_node_id)*REGION_SIZE + DT_CONFIG);
98 dt_config |= (value + event_num) << (4*event_num);
99 //printk(KERN_ERR "%s(%s:%i) writel %x %x\n", __FUNCTION__, __FILE__, __LINE__, dt_config, (REGION_XP + xp_node_id)*REGION_SIZE + DT_CONFIG);
100 writel(dt_config, gator_events_ccn504_base + (REGION_XP + xp_node_id)*REGION_SIZE + DT_CONFIG);
101}
102
103static int gator_events_ccn504_start(void)
104{
105 int i;
106
107 // Disable INTREQ on overflow
108 // [6] ovfl_intr_en = 0
109 // perhaps set to 1?
110 // [5] cntr_rst = 0
111 // No register paring
112 // [4:1] cntcfg = 0
113 // Enable PMU features
114 // [0] pmu_en = 1
115 //printk(KERN_ERR "%s(%s:%i) writel %x %x\n", __FUNCTION__, __FILE__, __LINE__, 0x1, REGION_DEBUG*REGION_SIZE + PMCR);
116 writel(0x1, gator_events_ccn504_base + REGION_DEBUG*REGION_SIZE + PMCR);
117
118 // Assume no other pmu_event_sel registers are set
119
120 // cycle counter does not need to be enabled
121 for (i = 0; i < CCNT; ++i) {
122 int pmu_event_id;
123 int node_type;
124 int region;
125 u32 pmu_event_sel;
126 u32 oly_id_whole;
127 u32 oly_id;
128 u32 node_id;
129
130 if (!gator_events_ccn504_enabled[i]) {
131 continue;
132 }
133
134 pmu_event_id = get_pmu_event_id(gator_events_ccn504_event[i]);
135 node_type = get_node_type(gator_events_ccn504_event[i]);
136 region = get_region(gator_events_ccn504_event[i]);
137 //printk(KERN_ERR "%s(%s:%i) pmu_event_id: %x node_type: %x region: %x\n", __FUNCTION__, __FILE__, __LINE__, pmu_event_id, node_type, region);
138
139 // Verify the node_type
140 oly_id_whole = readl(gator_events_ccn504_base + region*REGION_SIZE + OLY_ID);
141 oly_id = oly_id_whole & 0x1F;
142 node_id = (oly_id_whole >> 8) & 0x7F;
143 if ((oly_id != node_type) ||
144 ((node_type == 0x16) && ((oly_id == 0x14) || (oly_id == 0x15) || (oly_id == 0x16) || (oly_id == 0x18) || (oly_id == 0x19) || (oly_id == 0x1A)))) {
145 printk(KERN_ERR "%s(%s:%i) oly_id is %x expected %x\n", __FUNCTION__, __FILE__, __LINE__, oly_id, node_type);
146 return -1;
147 }
148
149 // Set the control register
150 pmu_event_sel = readl(gator_events_ccn504_base + region*REGION_SIZE + PMU_EVENT_SEL);
151 switch (node_type) {
152 case 0x08: // XP
153 pmu_event_sel |= pmu_event_id << (7*i);
154 gator_events_ccn504_set_dt_config(node_id, i, 0x4);
155 break;
156 case 0x04: // HN-F
157 case 0x16: // RN-I
158 case 0x10: // SBAS
159 pmu_event_sel |= pmu_event_id << (4*i);
160 gator_events_ccn504_set_dt_config(node_id/2, i, (node_id & 1) == 0 ? 0x8 : 0xC);
161 break;
162 }
163 //printk(KERN_ERR "%s(%s:%i) writel %x %x\n", __FUNCTION__, __FILE__, __LINE__, pmu_event_sel, region*REGION_SIZE + PMU_EVENT_SEL);
164 writel(pmu_event_sel, gator_events_ccn504_base + region*REGION_SIZE + PMU_EVENT_SEL);
165 }
166
167 return 0;
168}
169
170static void gator_events_ccn504_stop(void)
171{
172 int i;
173
174 // cycle counter does not need to be disabled
175 for (i = 0; i < CCNT; ++i) {
176 int node_type;
177 int region;
178
179 node_type = get_node_type(gator_events_ccn504_event[i]);
180 region = get_region(gator_events_ccn504_event[i]);
181
182 //printk(KERN_ERR "%s(%s:%i) writel %x %x\n", __FUNCTION__, __FILE__, __LINE__, 0, region*REGION_SIZE + PMU_EVENT_SEL);
183 writel(0, gator_events_ccn504_base + region*REGION_SIZE + PMU_EVENT_SEL);
184 }
185
186 // Clear dt_config
187 for (i = 0; i < 11; ++i) {
188 //printk(KERN_ERR "%s(%s:%i) writel %x %x\n", __FUNCTION__, __FILE__, __LINE__, 0, (REGION_XP + i)*REGION_SIZE + DT_CONFIG);
189 writel(0, gator_events_ccn504_base + (REGION_XP + i)*REGION_SIZE + DT_CONFIG);
190 }
191}
192
193static int gator_events_ccn504_read(int **buffer)
194{
195 int i;
196 int len = 0;
197
198 if (!on_primary_core()) {
199 return 0;
200 }
201
202 // Verify the pmsr register is zero
203 //i = 0;
204 while (readl(gator_events_ccn504_base + REGION_DEBUG*REGION_SIZE + PMSR) != 0) {
205 //++i;
206 }
207 //printk(KERN_ERR "%s(%s:%i) %i\n", __FUNCTION__, __FILE__, __LINE__, i);
208
209 // Request a PMU snapshot
210 writel(1, gator_events_ccn504_base + REGION_DEBUG*REGION_SIZE + PMSR_REQ);
211
212 // Wait for the snapshot
213 //i = 0;
214 while (readl(gator_events_ccn504_base + REGION_DEBUG*REGION_SIZE + PMSR) == 0) {
215 //++i;
216 }
217 //printk(KERN_ERR "%s(%s:%i) %i\n", __FUNCTION__, __FILE__, __LINE__, i);
218
219 // Read the shadow registers
220 for (i = 0; i < CNTMAX; ++i) {
221 if (!gator_events_ccn504_enabled[i]) {
222 continue;
223 }
224
225 gator_events_ccn504_buffer[len++] = gator_events_ccn504_key[i];
226 gator_events_ccn504_buffer[len++] = readl(gator_events_ccn504_base + REGION_DEBUG*REGION_SIZE + (i == CCNT ? PMCCNTRSR : PMEVCNTSR0 + 8*i));
227
228 // Are the counters registers cleared when read? Is that what the cntr_rst bit on the pmcr register does?
229 }
230
231 // Clear the PMU snapshot status
232 writel(1, gator_events_ccn504_base + REGION_DEBUG*REGION_SIZE + PMSR_CLR);
233
234 return len;
235}
236
237static void __maybe_unused gator_events_ccn504_enumerate(int pos, int size)
238{
239 int i;
240 u32 oly_id;
241
242 for (i = pos; i < pos + size; ++i) {
243 oly_id = readl(gator_events_ccn504_base + i*REGION_SIZE + OLY_ID);
244 printk(KERN_ERR "%s(%s:%i) %i %08x\n", __FUNCTION__, __FILE__, __LINE__, i, oly_id);
245 }
246}
247
248static struct gator_interface gator_events_ccn504_interface = {
249 .shutdown = gator_events_ccn504_create_shutdown,
250 .create_files = gator_events_ccn504_create_files,
251 .start = gator_events_ccn504_start,
252 .stop = gator_events_ccn504_stop,
253 .read = gator_events_ccn504_read,
254};
255
256int gator_events_ccn504_init(void)
257{
258 int i;
259
260 if (ccn504_addr == 0) {
261 return -1;
262 }
263
264 gator_events_ccn504_base = ioremap(ccn504_addr, NUM_REGIONS*REGION_SIZE);
265 if (gator_events_ccn504_base == NULL) {
266 printk(KERN_ERR "%s(%s:%i) ioremap returned NULL\n", __FUNCTION__, __FILE__, __LINE__);
267 return -1;
268 }
269 //printk(KERN_ERR "%s(%s:%i)\n", __FUNCTION__, __FILE__, __LINE__);
270
271 // Test - can memory be read
272 {
273 //gator_events_ccn504_enumerate(0, NUM_REGIONS);
274
275#if 0
276 // DT
277 gator_events_ccn504_enumerate(1, 1);
278 // HN-F
279 gator_events_ccn504_enumerate(32, 8);
280 // XP
281 gator_events_ccn504_enumerate(64, 11);
282 // RN-I
283 gator_events_ccn504_enumerate(128, 1);
284 gator_events_ccn504_enumerate(130, 1);
285 gator_events_ccn504_enumerate(134, 1);
286 gator_events_ccn504_enumerate(140, 1);
287 gator_events_ccn504_enumerate(144, 1);
288 gator_events_ccn504_enumerate(148, 1);
289 // SBAS
290 gator_events_ccn504_enumerate(129, 1);
291 gator_events_ccn504_enumerate(137, 1);
292 gator_events_ccn504_enumerate(139, 1);
293 gator_events_ccn504_enumerate(147, 1);
294#endif
295 }
296
297 for (i = 0; i < CNTMAX; ++i) {
298 gator_events_ccn504_enabled[i] = 0;
299 gator_events_ccn504_event[i] = 0;
300 gator_events_ccn504_key[i] = gator_events_get_key();
301 }
302
303 return gator_events_install(&gator_events_ccn504_interface);
304}
305
306gator_events_init(gator_events_ccn504_init);
diff --git a/driver/gator_events_mali_400.c b/driver/gator_events_mali_4xx.c
index c5fd989..dd275f7 100644
--- a/driver/gator_events_mali_400.c
+++ b/driver/gator_events_mali_4xx.c
@@ -15,140 +15,35 @@
15#include "linux/mali_linux_trace.h" 15#include "linux/mali_linux_trace.h"
16 16
17#include "gator_events_mali_common.h" 17#include "gator_events_mali_common.h"
18#include "gator_events_mali_400.h" 18#include "gator_events_mali_4xx.h"
19
20#if !defined(GATOR_MALI_INTERFACE_STYLE)
21/*
22 * At the moment, we only have users with the old style interface, so
23 * make our life easier by making it the default...
24 */
25#define GATOR_MALI_INTERFACE_STYLE (2)
26#endif
27 19
28/* 20/*
29 * There are (currently) three different variants of the comms between gator and Mali: 21 * There are (currently) four different variants of the comms between gator and Mali:
30 * 1 (deprecated): No software counter support 22 * 1 (deprecated): No software counter support
31 * 2 (deprecated): Tracepoint called for each separate s/w counter value as it appears 23 * 2 (deprecated): Tracepoint called for each separate s/w counter value as it appears
32 * 3 (default): Single tracepoint for all s/w counters in a bundle. 24 * 3 (default): Single tracepoint for all s/w counters in a bundle.
33 * Interface style 3 is the default if no other is specified. 1 and 2 will be eliminated when 25 * Interface style 3 is the default if no other is specified. 1 and 2 will be eliminated when
34 * existing Mali DDKs are upgraded. 26 * existing Mali DDKs are upgraded.
27 * 4. As above, but for the Utgard (Mali-450) driver.
35 */ 28 */
36 29
37#if !defined(GATOR_MALI_INTERFACE_STYLE) 30#if !defined(GATOR_MALI_INTERFACE_STYLE)
38#define GATOR_MALI_INTERFACE_STYLE (3) 31#define GATOR_MALI_INTERFACE_STYLE (3)
39#endif 32#endif
40 33
41/* 34#if GATOR_MALI_INTERFACE_STYLE < 4
42 * List of possible actions allowing DDK to be controlled by Streamline. 35#include "mali/mali_mjollnir_profiling_gator_api.h"
43 * The following numbers are used by DDK to control the frame buffer dumping. 36#else
44 */ 37#include "mali/mali_utgard_profiling_gator_api.h"
45#define FBDUMP_CONTROL_ENABLE (1) 38#endif
46#define FBDUMP_CONTROL_RATE (2)
47#define SW_EVENTS_ENABLE (3)
48#define FBDUMP_CONTROL_RESIZE_FACTOR (4)
49 39
50/* 40/*
51 * Check that the MALI_SUPPORT define is set to one of the allowable device codes. 41 * Check that the MALI_SUPPORT define is set to one of the allowable device codes.
52 */ 42 */
53#if (MALI_SUPPORT != MALI_400) 43#if (MALI_SUPPORT != MALI_4xx)
54#error MALI_SUPPORT set to an invalid device code: expecting MALI_400 44#error MALI_SUPPORT set to an invalid device code: expecting MALI_4xx
55#endif 45#endif
56 46
57/*
58 * The number of fragment processors. Update to suit your hardware implementation.
59 */
60#define NUM_FP_UNITS (4)
61
62enum counters {
63 /* Timeline activity */
64 ACTIVITY_VP = 0,
65 ACTIVITY_FP0,
66 ACTIVITY_FP1,
67 ACTIVITY_FP2,
68 ACTIVITY_FP3,
69
70 /* L2 cache counters */
71 COUNTER_L2_C0,
72 COUNTER_L2_C1,
73
74 /* Vertex processor counters */
75 COUNTER_VP_C0,
76 COUNTER_VP_C1,
77
78 /* Fragment processor counters */
79 COUNTER_FP0_C0,
80 COUNTER_FP0_C1,
81 COUNTER_FP1_C0,
82 COUNTER_FP1_C1,
83 COUNTER_FP2_C0,
84 COUNTER_FP2_C1,
85 COUNTER_FP3_C0,
86 COUNTER_FP3_C1,
87
88 /* EGL Software Counters */
89 COUNTER_EGL_BLIT_TIME,
90
91 /* GLES Software Counters */
92 COUNTER_GLES_DRAW_ELEMENTS_CALLS,
93 COUNTER_GLES_DRAW_ELEMENTS_NUM_INDICES,
94 COUNTER_GLES_DRAW_ELEMENTS_NUM_TRANSFORMED,
95 COUNTER_GLES_DRAW_ARRAYS_CALLS,
96 COUNTER_GLES_DRAW_ARRAYS_NUM_TRANSFORMED,
97 COUNTER_GLES_DRAW_POINTS,
98 COUNTER_GLES_DRAW_LINES,
99 COUNTER_GLES_DRAW_LINE_LOOP,
100 COUNTER_GLES_DRAW_LINE_STRIP,
101 COUNTER_GLES_DRAW_TRIANGLES,
102 COUNTER_GLES_DRAW_TRIANGLE_STRIP,
103 COUNTER_GLES_DRAW_TRIANGLE_FAN,
104 COUNTER_GLES_NON_VBO_DATA_COPY_TIME,
105 COUNTER_GLES_UNIFORM_BYTES_COPIED_TO_MALI,
106 COUNTER_GLES_UPLOAD_TEXTURE_TIME,
107 COUNTER_GLES_UPLOAD_VBO_TIME,
108 COUNTER_GLES_NUM_FLUSHES,
109 COUNTER_GLES_NUM_VSHADERS_GENERATED,
110 COUNTER_GLES_NUM_FSHADERS_GENERATED,
111 COUNTER_GLES_VSHADER_GEN_TIME,
112 COUNTER_GLES_FSHADER_GEN_TIME,
113 COUNTER_GLES_INPUT_TRIANGLES,
114 COUNTER_GLES_VXCACHE_HIT,
115 COUNTER_GLES_VXCACHE_MISS,
116 COUNTER_GLES_VXCACHE_COLLISION,
117 COUNTER_GLES_CULLED_TRIANGLES,
118 COUNTER_GLES_CULLED_LINES,
119 COUNTER_GLES_BACKFACE_TRIANGLES,
120 COUNTER_GLES_GBCLIP_TRIANGLES,
121 COUNTER_GLES_GBCLIP_LINES,
122 COUNTER_GLES_TRIANGLES_DRAWN,
123 COUNTER_GLES_DRAWCALL_TIME,
124 COUNTER_GLES_TRIANGLES_COUNT,
125 COUNTER_GLES_INDEPENDENT_TRIANGLES_COUNT,
126 COUNTER_GLES_STRIP_TRIANGLES_COUNT,
127 COUNTER_GLES_FAN_TRIANGLES_COUNT,
128 COUNTER_GLES_LINES_COUNT,
129 COUNTER_GLES_INDEPENDENT_LINES_COUNT,
130 COUNTER_GLES_STRIP_LINES_COUNT,
131 COUNTER_GLES_LOOP_LINES_COUNT,
132
133 COUNTER_FILMSTRIP,
134 COUNTER_FREQUENCY,
135 COUNTER_VOLTAGE,
136
137 NUMBER_OF_EVENTS
138};
139
140#define FIRST_ACTIVITY_EVENT ACTIVITY_VP
141#define LAST_ACTIVITY_EVENT ACTIVITY_FP3
142
143#define FIRST_HW_COUNTER COUNTER_L2_C0
144#define LAST_HW_COUNTER COUNTER_FP3_C1
145
146#define FIRST_SW_COUNTER COUNTER_EGL_BLIT_TIME
147#define LAST_SW_COUNTER COUNTER_GLES_LOOP_LINES_COUNT
148
149#define FIRST_SPECIAL_COUNTER COUNTER_FILMSTRIP
150#define LAST_SPECIAL_COUNTER COUNTER_VOLTAGE
151
152/* gatorfs variables for counter enable state, 47/* gatorfs variables for counter enable state,
153 * the event the counter should count and the 48 * the event the counter should count and the
154 * 'key' (a unique id set by gatord and returned 49 * 'key' (a unique id set by gatord and returned
@@ -172,6 +67,15 @@ static unsigned long counter_prev[NUMBER_OF_EVENTS];
172/* Note whether tracepoints have been registered */ 67/* Note whether tracepoints have been registered */
173static int trace_registered; 68static int trace_registered;
174 69
70/*
71 * These numbers define the actual numbers of each block type that exist in the system. Initially
72 * these are set to the maxima defined above; if the driver is capable of being queried (newer
73 * drivers only) then the values may be revised.
74 */
75static unsigned int n_vp_cores = MAX_NUM_VP_CORES;
76static unsigned int n_l2_cores = MAX_NUM_L2_CACHE_CORES;
77static unsigned int n_fp_cores = MAX_NUM_FP_CORES;
78
175/** 79/**
176 * Calculate the difference and handle the overflow. 80 * Calculate the difference and handle the overflow.
177 */ 81 */
@@ -202,6 +106,12 @@ static inline int is_hw_counter(unsigned int event_id)
202 return (event_id >= FIRST_HW_COUNTER && event_id <= LAST_HW_COUNTER); 106 return (event_id >= FIRST_HW_COUNTER && event_id <= LAST_HW_COUNTER);
203} 107}
204 108
109/*
110 * These are provided for utgard compatibility.
111 */
112typedef void _mali_profiling_get_mali_version_type(struct _mali_profiling_mali_version *values);
113typedef u32 _mali_profiling_get_l2_counters_type(_mali_profiling_l2_counter_values *values);
114
205#if GATOR_MALI_INTERFACE_STYLE == 2 115#if GATOR_MALI_INTERFACE_STYLE == 2
206/** 116/**
207 * Returns non-zero if the given counter ID is a software counter. 117 * Returns non-zero if the given counter ID is a software counter.
@@ -271,7 +181,7 @@ GATOR_DEFINE_PROBE(mali_sw_counter, TP_PROTO(unsigned int event_id, signed long
271} 181}
272#endif /* GATOR_MALI_INTERFACE_STYLE == 2 */ 182#endif /* GATOR_MALI_INTERFACE_STYLE == 2 */
273 183
274#if GATOR_MALI_INTERFACE_STYLE == 3 184#if GATOR_MALI_INTERFACE_STYLE >= 3
275GATOR_DEFINE_PROBE(mali_sw_counters, TP_PROTO(pid_t pid, pid_t tid, void *surface_id, unsigned int *counters)) 185GATOR_DEFINE_PROBE(mali_sw_counters, TP_PROTO(pid_t pid, pid_t tid, void *surface_id, unsigned int *counters))
276{ 186{
277 u32 i; 187 u32 i;
@@ -283,136 +193,167 @@ GATOR_DEFINE_PROBE(mali_sw_counters, TP_PROTO(pid_t pid, pid_t tid, void *surfac
283 } 193 }
284 } 194 }
285} 195}
286#endif /* GATOR_MALI_INTERFACE_STYLE == 3 */ 196#endif /* GATOR_MALI_INTERFACE_STYLE >= 3 */
287 197
288static int create_files(struct super_block *sb, struct dentry *root) 198/**
199 * Create a single filesystem entry for a specified event.
200 * @param sb the superblock
201 * @param root Filesystem root
202 * @param name The name of the entry to create
203 * @param event The ID of the event
204 * @param create_event_item boolean indicating whether to create an 'event' filesystem entry. True to create.
205 *
206 * @return 0 if ok, non-zero if the create failed.
207 */
208static int create_fs_entry(struct super_block *sb, struct dentry *root, const char *name, int event, int create_event_item)
289{ 209{
290 struct dentry *dir; 210 struct dentry *dir;
291 int event;
292 int n_fp = NUM_FP_UNITS;
293 211
294 const char *mali_name = gator_mali_get_mali_name(); 212 dir = gatorfs_mkdir(sb, root, name);
295 213
296 /* 214 if (!dir) {
297 * Create the filesystem entries for vertex processor, fragment processor 215 return -1;
298 * and L2 cache timeline and hardware counters. Software counters get 216 }
299 * special handling after this block.
300 */
301 for (event = FIRST_ACTIVITY_EVENT; event <= LAST_HW_COUNTER; event++) {
302 char buf[40];
303 217
304 /* 218 if (create_event_item) {
305 * We can skip this event if it's for a non-existent fragment 219 gatorfs_create_ulong(sb, dir, "event", &counter_event[event]);
306 * processor. 220 }
307 */
308 if (((event - ACTIVITY_FP0 >= n_fp) && (event < COUNTER_L2_C0))
309 || (((event - COUNTER_FP0_C0) / 2 >= n_fp))) {
310 continue;
311 }
312 221
313 /* Otherwise, set up the filesystem entry for this event. */ 222 gatorfs_create_ulong(sb, dir, "enabled", &counter_enabled[event]);
314 switch (event) { 223 gatorfs_create_ro_ulong(sb, dir, "key", &counter_key[event]);
315 case ACTIVITY_VP:
316 snprintf(buf, sizeof buf, "ARM_%s_VP_active", mali_name);
317 break;
318 case ACTIVITY_FP0:
319 case ACTIVITY_FP1:
320 case ACTIVITY_FP2:
321 case ACTIVITY_FP3:
322 snprintf(buf, sizeof buf, "ARM_%s_FP%d_active",
323 mali_name, event - ACTIVITY_FP0);
324 break;
325 case COUNTER_L2_C0:
326 case COUNTER_L2_C1:
327 snprintf(buf, sizeof buf, "ARM_%s_L2_cnt%d",
328 mali_name, event - COUNTER_L2_C0);
329 break;
330 case COUNTER_VP_C0:
331 case COUNTER_VP_C1:
332 snprintf(buf, sizeof buf, "ARM_%s_VP_cnt%d",
333 mali_name, event - COUNTER_VP_C0);
334 break;
335 case COUNTER_FP0_C0:
336 case COUNTER_FP0_C1:
337 case COUNTER_FP1_C0:
338 case COUNTER_FP1_C1:
339 case COUNTER_FP2_C0:
340 case COUNTER_FP2_C1:
341 case COUNTER_FP3_C0:
342 case COUNTER_FP3_C1:
343 snprintf(buf, sizeof buf, "ARM_%s_FP%d_cnt%d",
344 mali_name, (event - COUNTER_FP0_C0) / 2,
345 (event - COUNTER_FP0_C0) % 2);
346 break;
347 default:
348 printk("gator: trying to create file for non-existent counter (%d)\n", event);
349 continue;
350 }
351 224
352 dir = gatorfs_mkdir(sb, root, buf); 225 return 0;
226}
353 227
354 if (!dir) { 228#if GATOR_MALI_INTERFACE_STYLE > 3
355 return -1; 229/*
356 } 230 * Read the version info structure if available
231 */
232static void initialise_version_info(void)
233{
234 _mali_profiling_get_mali_version_type *mali_profiling_get_mali_version_symbol;
357 235
358 gatorfs_create_ulong(sb, dir, "enabled", &counter_enabled[event]); 236 mali_profiling_get_mali_version_symbol = symbol_get(_mali_profiling_get_mali_version);
359 237
360 /* Only create an event node for counters that can change what they count */ 238 if (mali_profiling_get_mali_version_symbol) {
361 if (event >= COUNTER_L2_C0) { 239 struct _mali_profiling_mali_version version_info;
362 gatorfs_create_ulong(sb, dir, "event", &counter_event[event]); 240
363 } 241 pr_debug("gator: mali online _mali_profiling_get_mali_version symbol @ %p\n",
242 mali_profiling_get_mali_version_symbol);
243
244 /*
245 * Revise the number of each different core type using information derived from the DDK.
246 */
247 mali_profiling_get_mali_version_symbol(&version_info);
364 248
365 gatorfs_create_ro_ulong(sb, dir, "key", &counter_key[event]); 249 n_fp_cores = version_info.num_of_fp_cores;
250 n_vp_cores = version_info.num_of_vp_cores;
251 n_l2_cores = version_info.num_of_l2_cores;
252
253 /* Release the function - we're done with it. */
254 symbol_put(_mali_profiling_get_mali_version);
255 } else {
256 printk("gator: mali online _mali_profiling_get_mali_version symbol not found\n");
366 } 257 }
258}
259#endif
367 260
368 /* Now set up the software counter entries */ 261static int create_files(struct super_block *sb, struct dentry *root)
369 for (event = FIRST_SW_COUNTER; event <= LAST_SW_COUNTER; event++) { 262{
370 char buf[40]; 263 int event;
264 const char *mali_name = gator_mali_get_mali_name();
265
266 char buf[40];
267 int core_id;
268 int counter_number;
371 269
372 snprintf(buf, sizeof(buf), "ARM_%s_SW_%d", mali_name, event); 270 pr_debug("gator: Initialising counters with style = %d\n", GATOR_MALI_INTERFACE_STYLE);
373 271
374 dir = gatorfs_mkdir(sb, root, buf); 272#if GATOR_MALI_INTERFACE_STYLE > 3
273 /*
274 * Initialise first: this sets up the number of cores available (on compatible DDK versions).
275 * Ideally this would not need guarding but other parts of the code depend on the interface style being set
276 * correctly; if it is not then the system can enter an inconsistent state.
277 */
278 initialise_version_info();
279#endif
375 280
376 if (!dir) { 281 /* Vertex processor counters */
282 for (core_id = 0; core_id < n_vp_cores; core_id++) {
283 int activity_counter_id = ACTIVITY_VP_0;
284 snprintf(buf, sizeof buf, "ARM_%s_VP_%d_active", mali_name, core_id);
285 if (create_fs_entry(sb, root, buf, activity_counter_id, 0) != 0) {
377 return -1; 286 return -1;
378 } 287 }
379 288
380 gatorfs_create_ulong(sb, dir, "enabled", &counter_enabled[event]); 289 for (counter_number = 0; counter_number < 2; counter_number++) {
381 gatorfs_create_ro_ulong(sb, dir, "key", &counter_key[event]); 290 int counter_id = COUNTER_VP_0_C0 + (2 * core_id) + counter_number;
291
292 snprintf(buf, sizeof buf, "ARM_%s_VP_%d_cnt%d", mali_name, core_id, counter_number);
293 if (create_fs_entry(sb, root, buf, counter_id, 1) != 0) {
294 return -1;
295 }
296 }
382 } 297 }
383 298
384 /* Now set up the special counter entries */ 299 /* Fragment processors' counters */
385 for (event = FIRST_SPECIAL_COUNTER; event <= LAST_SPECIAL_COUNTER; event++) { 300 for (core_id = 0; core_id < n_fp_cores; core_id++) {
386 char buf[40]; 301 int activity_counter_id = ACTIVITY_FP_0 + core_id;
387 302
388 switch (event) { 303 snprintf(buf, sizeof buf, "ARM_%s_FP_%d_active", mali_name, core_id);
389 case COUNTER_FILMSTRIP: 304 if (create_fs_entry(sb, root, buf, activity_counter_id, 0) != 0) {
390 snprintf(buf, sizeof(buf), "ARM_%s_Filmstrip_cnt0", mali_name); 305 return -1;
391 break; 306 }
392 307
393 case COUNTER_FREQUENCY: 308 for (counter_number = 0; counter_number < 2; counter_number++) {
394 snprintf(buf, sizeof(buf), "ARM_%s_Frequency", mali_name); 309 int counter_id = COUNTER_FP_0_C0 + (2 * core_id) + counter_number;
395 break; 310
311 snprintf(buf, sizeof buf, "ARM_%s_FP_%d_cnt%d", mali_name, core_id, counter_number);
312 if (create_fs_entry(sb, root, buf, counter_id, 1) != 0) {
313 return -1;
314 }
315 }
316 }
396 317
397 case COUNTER_VOLTAGE: 318 /* L2 Cache counters */
398 snprintf(buf, sizeof(buf), "ARM_%s_Voltage", mali_name); 319 for (core_id = 0; core_id < n_l2_cores; core_id++) {
399 break; 320 for (counter_number = 0; counter_number < 2; counter_number++) {
321 int counter_id = COUNTER_L2_0_C0 + (2 * core_id) + counter_number;
400 322
401 default: 323 snprintf(buf, sizeof buf, "ARM_%s_L2_%d_cnt%d", mali_name, core_id, counter_number);
402 break; 324 if (create_fs_entry(sb, root, buf, counter_id, 1) != 0) {
325 return -1;
326 }
403 } 327 }
328 }
404 329
405 dir = gatorfs_mkdir(sb, root, buf); 330 /* Now set up the software counter entries */
331 for (event = FIRST_SW_COUNTER; event <= LAST_SW_COUNTER; event++) {
332 snprintf(buf, sizeof(buf), "ARM_%s_SW_%d", mali_name, event - FIRST_SW_COUNTER);
406 333
407 if (!dir) { 334 if (create_fs_entry(sb, root, buf, event, 0) != 0) {
408 return -1; 335 return -1;
409 } 336 }
337 }
410 338
411 gatorfs_create_ulong(sb, dir, "event", &counter_event[event]); 339 /* Now set up the special counter entries */
412 gatorfs_create_ulong(sb, dir, "enabled", &counter_enabled[event]); 340 snprintf(buf, sizeof(buf), "ARM_%s_Filmstrip_cnt0", mali_name);
413 gatorfs_create_ro_ulong(sb, dir, "key", &counter_key[event]); 341 if (create_fs_entry(sb, root, buf, COUNTER_FILMSTRIP, 1) != 0) {
342 return -1;
414 } 343 }
415 344
345#ifdef DVFS_REPORTED_BY_DDK
346 snprintf(buf, sizeof(buf), "ARM_%s_Frequency", mali_name);
347 if (create_fs_entry(sb, root, buf, COUNTER_FREQUENCY, 1) != 0) {
348 return -1;
349 }
350
351 snprintf(buf, sizeof(buf), "ARM_%s_Voltage", mali_name);
352 if (create_fs_entry(sb, root, buf, COUNTER_VOLTAGE, 1) != 0) {
353 return -1;
354 }
355#endif
356
416 return 0; 357 return 0;
417} 358}
418 359
@@ -421,16 +362,17 @@ static int create_files(struct super_block *sb, struct dentry *root)
421 * This is stored here since it is used very regularly. 362 * This is stored here since it is used very regularly.
422 */ 363 */
423static mali_profiling_get_counters_type *mali_get_counters = NULL; 364static mali_profiling_get_counters_type *mali_get_counters = NULL;
365static _mali_profiling_get_l2_counters_type *mali_get_l2_counters = NULL;
424 366
425/* 367/*
426 * Examine list of software counters and determine if any one is enabled. 368 * Examine list of counters between two index limits and determine if any one is enabled.
427 * Returns 1 if any counter is enabled, 0 if none is. 369 * Returns 1 if any counter is enabled, 0 if none is.
428 */ 370 */
429static int is_any_sw_counter_enabled(void) 371static int is_any_counter_enabled(unsigned int first_counter, unsigned int last_counter)
430{ 372{
431 unsigned int i; 373 unsigned int i;
432 374
433 for (i = FIRST_SW_COUNTER; i <= LAST_SW_COUNTER; i++) { 375 for (i = first_counter; i <= last_counter; i++) {
434 if (counter_enabled[i]) { 376 if (counter_enabled[i]) {
435 return 1; /* At least one counter is enabled */ 377 return 1; /* At least one counter is enabled */
436 } 378 }
@@ -439,28 +381,26 @@ static int is_any_sw_counter_enabled(void)
439 return 0; /* No s/w counters enabled */ 381 return 0; /* No s/w counters enabled */
440} 382}
441 383
442static void mali_counter_initialize(void) 384static void init_counters(unsigned int from_counter, unsigned int to_counter)
443{ 385{
386 unsigned int counter_id;
387
444 /* If a Mali driver is present and exporting the appropriate symbol 388 /* If a Mali driver is present and exporting the appropriate symbol
445 * then we can request the HW counters (of which there are only 2) 389 * then we can request the HW counters (of which there are only 2)
446 * be configured to count the desired events 390 * be configured to count the desired events
447 */ 391 */
448 mali_profiling_set_event_type *mali_set_hw_event; 392 mali_profiling_set_event_type *mali_set_hw_event;
449 mali_osk_fb_control_set_type *mali_set_fb_event;
450 mali_profiling_control_type *mali_control;
451 393
452 mali_set_hw_event = symbol_get(_mali_profiling_set_event); 394 mali_set_hw_event = symbol_get(_mali_profiling_set_event);
453 395
454 if (mali_set_hw_event) { 396 if (mali_set_hw_event) {
455 int i;
456
457 pr_debug("gator: mali online _mali_profiling_set_event symbol @ %p\n", mali_set_hw_event); 397 pr_debug("gator: mali online _mali_profiling_set_event symbol @ %p\n", mali_set_hw_event);
458 398
459 for (i = FIRST_HW_COUNTER; i <= LAST_HW_COUNTER; i++) { 399 for (counter_id = from_counter; counter_id <= to_counter; counter_id++) {
460 if (counter_enabled[i]) { 400 if (counter_enabled[counter_id]) {
461 mali_set_hw_event(i, counter_event[i]); 401 mali_set_hw_event(counter_id, counter_event[counter_id]);
462 } else { 402 } else {
463 mali_set_hw_event(i, 0xFFFFFFFF); 403 mali_set_hw_event(counter_id, 0xFFFFFFFF);
464 } 404 }
465 } 405 }
466 406
@@ -468,6 +408,19 @@ static void mali_counter_initialize(void)
468 } else { 408 } else {
469 printk("gator: mali online _mali_profiling_set_event symbol not found\n"); 409 printk("gator: mali online _mali_profiling_set_event symbol not found\n");
470 } 410 }
411}
412
413static void mali_counter_initialize(void)
414{
415 int i;
416 int core_id;
417
418 mali_osk_fb_control_set_type *mali_set_fb_event;
419 mali_profiling_control_type *mali_control;
420
421 init_counters(COUNTER_L2_0_C0, COUNTER_L2_0_C0 + (2 * n_l2_cores) - 1);
422 init_counters(COUNTER_VP_0_C0, COUNTER_VP_0_C0 + (2 * n_vp_cores) - 1);
423 init_counters(COUNTER_FP_0_C0, COUNTER_FP_0_C0 + (2 * n_fp_cores) - 1);
471 424
472 mali_set_fb_event = symbol_get(_mali_osk_fb_control_set); 425 mali_set_fb_event = symbol_get(_mali_osk_fb_control_set);
473 426
@@ -490,7 +443,7 @@ static void mali_counter_initialize(void)
490 443
491 pr_debug("gator: mali online _mali_profiling_control symbol @ %p\n", mali_control); 444 pr_debug("gator: mali online _mali_profiling_control symbol @ %p\n", mali_control);
492 445
493 mali_control(SW_EVENTS_ENABLE, (is_any_sw_counter_enabled() ? 1 : 0)); 446 mali_control(SW_COUNTER_ENABLE, (is_any_counter_enabled(FIRST_SW_COUNTER, LAST_SW_COUNTER) ? 1 : 0));
494 mali_control(FBDUMP_CONTROL_ENABLE, (counter_enabled[COUNTER_FILMSTRIP] ? 1 : 0)); 447 mali_control(FBDUMP_CONTROL_ENABLE, (counter_enabled[COUNTER_FILMSTRIP] ? 1 : 0));
495 mali_control(FBDUMP_CONTROL_RATE, rate); 448 mali_control(FBDUMP_CONTROL_RATE, rate);
496 mali_control(FBDUMP_CONTROL_RESIZE_FACTOR, resize_factor); 449 mali_control(FBDUMP_CONTROL_RESIZE_FACTOR, resize_factor);
@@ -505,11 +458,34 @@ static void mali_counter_initialize(void)
505 mali_get_counters = symbol_get(_mali_profiling_get_counters); 458 mali_get_counters = symbol_get(_mali_profiling_get_counters);
506 if (mali_get_counters) { 459 if (mali_get_counters) {
507 pr_debug("gator: mali online _mali_profiling_get_counters symbol @ %p\n", mali_get_counters); 460 pr_debug("gator: mali online _mali_profiling_get_counters symbol @ %p\n", mali_get_counters);
508 counter_prev[COUNTER_L2_C0] = 0; 461
509 counter_prev[COUNTER_L2_C1] = 0;
510 } else { 462 } else {
511 pr_debug("gator WARNING: mali _mali_profiling_get_counters symbol not defined"); 463 pr_debug("gator WARNING: mali _mali_profiling_get_counters symbol not defined");
512 } 464 }
465
466 mali_get_l2_counters = symbol_get(_mali_profiling_get_l2_counters);
467 if (mali_get_l2_counters) {
468 pr_debug("gator: mali online _mali_profiling_get_l2_counters symbol @ %p\n", mali_get_l2_counters);
469
470 } else {
471 pr_debug("gator WARNING: mali _mali_profiling_get_l2_counters symbol not defined");
472 }
473
474 if (!mali_get_counters && !mali_get_l2_counters) {
475 pr_debug("gator: WARNING: no L2 counters available");
476 n_l2_cores = 0;
477 }
478
479 for (core_id = 0; core_id < n_l2_cores; core_id++) {
480 int counter_id = COUNTER_L2_0_C0 + (2 * core_id);
481 counter_prev[counter_id] = 0;
482 counter_prev[counter_id + 1] = 0;
483 }
484
485 /* Clear counters in the start */
486 for (i = 0; i < NUMBER_OF_EVENTS; i++) {
487 counter_data[i] = 0;
488 }
513} 489}
514 490
515static void mali_counter_deinitialize(void) 491static void mali_counter_deinitialize(void)
@@ -552,7 +528,7 @@ static void mali_counter_deinitialize(void)
552 pr_debug("gator: mali offline _mali_profiling_control symbol @ %p\n", mali_set_fb_event); 528 pr_debug("gator: mali offline _mali_profiling_control symbol @ %p\n", mali_set_fb_event);
553 529
554 /* Reset the DDK state - disable counter collection */ 530 /* Reset the DDK state - disable counter collection */
555 mali_control(SW_EVENTS_ENABLE, 0); 531 mali_control(SW_COUNTER_ENABLE, 0);
556 532
557 mali_control(FBDUMP_CONTROL_ENABLE, 0); 533 mali_control(FBDUMP_CONTROL_ENABLE, 0);
558 534
@@ -565,6 +541,9 @@ static void mali_counter_deinitialize(void)
565 symbol_put(_mali_profiling_get_counters); 541 symbol_put(_mali_profiling_get_counters);
566 } 542 }
567 543
544 if (mali_get_l2_counters) {
545 symbol_put(_mali_profiling_get_l2_counters);
546 }
568} 547}
569 548
570static int start(void) 549static int start(void)
@@ -583,8 +562,8 @@ static int start(void)
583 printk("gator: mali_sw_counter tracepoint failed to activate\n"); 562 printk("gator: mali_sw_counter tracepoint failed to activate\n");
584 return -1; 563 return -1;
585 } 564 }
586#elif GATOR_MALI_INTERFACE_STYLE == 3 565#elif GATOR_MALI_INTERFACE_STYLE >= 3
587/* For Mali drivers with built-in support. */ 566 /* For Mali drivers with built-in support. */
588 if (GATOR_REGISTER_TRACE(mali_sw_counters)) { 567 if (GATOR_REGISTER_TRACE(mali_sw_counters)) {
589 printk("gator: mali_sw_counters tracepoint failed to activate\n"); 568 printk("gator: mali_sw_counters tracepoint failed to activate\n");
590 return -1; 569 return -1;
@@ -613,7 +592,7 @@ static void stop(void)
613#elif GATOR_MALI_INTERFACE_STYLE == 2 592#elif GATOR_MALI_INTERFACE_STYLE == 2
614 /* For patched Mali driver. */ 593 /* For patched Mali driver. */
615 GATOR_UNREGISTER_TRACE(mali_sw_counter); 594 GATOR_UNREGISTER_TRACE(mali_sw_counter);
616#elif GATOR_MALI_INTERFACE_STYLE == 3 595#elif GATOR_MALI_INTERFACE_STYLE >= 3
617 /* For Mali drivers with built-in support. */ 596 /* For Mali drivers with built-in support. */
618 GATOR_UNREGISTER_TRACE(mali_sw_counters); 597 GATOR_UNREGISTER_TRACE(mali_sw_counters);
619#else 598#else
@@ -625,7 +604,7 @@ static void stop(void)
625 trace_registered = 0; 604 trace_registered = 0;
626 } 605 }
627 606
628 for (cnt = FIRST_ACTIVITY_EVENT; cnt < NUMBER_OF_EVENTS; cnt++) { 607 for (cnt = 0; cnt < NUMBER_OF_EVENTS; cnt++) {
629 counter_enabled[cnt] = 0; 608 counter_enabled[cnt] = 0;
630 counter_event[cnt] = 0; 609 counter_event[cnt] = 0;
631 counter_address[cnt] = NULL; 610 counter_address[cnt] = NULL;
@@ -634,67 +613,99 @@ static void stop(void)
634 mali_counter_deinitialize(); 613 mali_counter_deinitialize();
635} 614}
636 615
616static void dump_counters(unsigned int from_counter, unsigned int to_counter, unsigned int *len)
617{
618 unsigned int counter_id;
619
620 for (counter_id = from_counter; counter_id <= to_counter; counter_id++) {
621 if (counter_enabled[counter_id]) {
622 counter_dump[(*len)++] = counter_key[counter_id];
623 counter_dump[(*len)++] = counter_data[counter_id];
624
625 counter_data[counter_id] = 0;
626 }
627 }
628}
629
637static int read(int **buffer) 630static int read(int **buffer)
638{ 631{
639 int cnt, len = 0; 632 int len = 0;
640 633
641 if (!on_primary_core()) 634 if (!on_primary_core())
642 return 0; 635 return 0;
643 636
644 // Read the L2 C0 and C1 here. 637 // Read the L2 C0 and C1 here.
645 if (counter_enabled[COUNTER_L2_C0] || counter_enabled[COUNTER_L2_C1]) { 638 if (n_l2_cores > 0 && is_any_counter_enabled(COUNTER_L2_0_C0, COUNTER_L2_0_C0 + (2 * n_l2_cores))) {
646 u32 src0 = 0; 639 unsigned int unavailable_l2_caches = 0;
647 u32 val0 = 0; 640 _mali_profiling_l2_counter_values cache_values;
648 u32 src1 = 0; 641 unsigned int cache_id;
649 u32 val1 = 0; 642 struct _mali_profiling_core_counters *per_core;
650 643
651 // Poke the driver to get the counter values 644 /* Poke the driver to get the counter values - older style; only one L2 cache */
652 if (mali_get_counters) { 645 if (mali_get_l2_counters) {
653 mali_get_counters(&src0, &val0, &src1, &val1); 646 unavailable_l2_caches = mali_get_l2_counters(&cache_values);
647 } else if (mali_get_counters) {
648 per_core = &cache_values.cores[0];
649 mali_get_counters(&per_core->source0, &per_core->value0, &per_core->source1, &per_core->value1);
650 } else {
651 /* This should never happen, as n_l2_caches is only set > 0 if one of the above functions is found. */
654 } 652 }
655 653
656 if (counter_enabled[COUNTER_L2_C0]) { 654 /* Fill in the two cache counter values for each cache block. */
657 // Calculate and save src0's counter val0 655 for (cache_id = 0; cache_id < n_l2_cores; cache_id++) {
658 counter_dump[len++] = counter_key[COUNTER_L2_C0]; 656 unsigned int counter_id_0 = COUNTER_L2_0_C0 + (2 * cache_id);
659 counter_dump[len++] = get_difference(val0, counter_prev[COUNTER_L2_C0]); 657 unsigned int counter_id_1 = counter_id_0 + 1;
660 }
661 658
662 if (counter_enabled[COUNTER_L2_C1]) { 659 if ((1 << cache_id) & unavailable_l2_caches) {
663 // Calculate and save src1's counter val1 660 continue; /* This cache is unavailable (powered-off, possibly). */
664 counter_dump[len++] = counter_key[COUNTER_L2_C1]; 661 }
665 counter_dump[len++] = get_difference(val1, counter_prev[COUNTER_L2_C1]); 662
666 } 663 per_core = &cache_values.cores[cache_id];
664
665 if (counter_enabled[counter_id_0]) {
666 // Calculate and save src0's counter val0
667 counter_dump[len++] = counter_key[counter_id_0];
668 counter_dump[len++] = get_difference(per_core->value0, counter_prev[counter_id_0]);
669 }
670
671 if (counter_enabled[counter_id_1]) {
672 // Calculate and save src1's counter val1
673 counter_dump[len++] = counter_key[counter_id_1];
674 counter_dump[len++] = get_difference(per_core->value1, counter_prev[counter_id_1]);
675 }
667 676
668 // Save the previous values for the counters. 677 // Save the previous values for the counters.
669 counter_prev[COUNTER_L2_C0] = val0; 678 counter_prev[counter_id_0] = per_core->value0;
670 counter_prev[COUNTER_L2_C1] = val1; 679 counter_prev[counter_id_1] = per_core->value1;
680 }
671 } 681 }
672 682
673 // Process other (non-timeline) counters. 683 /* Process other (non-timeline) counters. */
674 for (cnt = COUNTER_VP_C0; cnt <= LAST_SW_COUNTER; cnt++) { 684 dump_counters(COUNTER_VP_0_C0, COUNTER_VP_0_C0 + (2 * n_vp_cores) - 1, &len);
685 dump_counters(COUNTER_FP_0_C0, COUNTER_FP_0_C0 + (2 * n_fp_cores) - 1, &len);
686
687 dump_counters(FIRST_SW_COUNTER, LAST_SW_COUNTER, &len);
688
689#ifdef DVFS_REPORTED_BY_DDK
690 {
691 int cnt;
692 /*
693 * Add in the voltage and frequency counters if enabled. Note that, since these are
694 * actually passed as events, the counter value should not be cleared.
695 */
696 cnt = COUNTER_FREQUENCY;
675 if (counter_enabled[cnt]) { 697 if (counter_enabled[cnt]) {
676 counter_dump[len++] = counter_key[cnt]; 698 counter_dump[len++] = counter_key[cnt];
677 counter_dump[len++] = counter_data[cnt]; 699 counter_dump[len++] = counter_data[cnt];
678
679 counter_data[cnt] = 0;
680 } 700 }
681 }
682 701
683 /* 702 cnt = COUNTER_VOLTAGE;
684 * Add in the voltage and frequency counters if enabled. Note that, since these are 703 if (counter_enabled[cnt]) {
685 * actually passed as events, the counter value should not be cleared. 704 counter_dump[len++] = counter_key[cnt];
686 */ 705 counter_dump[len++] = counter_data[cnt];
687 cnt = COUNTER_FREQUENCY; 706 }
688 if (counter_enabled[cnt]) {
689 counter_dump[len++] = counter_key[cnt];
690 counter_dump[len++] = counter_data[cnt];
691 }
692
693 cnt = COUNTER_VOLTAGE;
694 if (counter_enabled[cnt]) {
695 counter_dump[len++] = counter_key[cnt];
696 counter_dump[len++] = counter_data[cnt];
697 } 707 }
708#endif
698 709
699 if (buffer) { 710 if (buffer) {
700 *buffer = (int *)counter_dump; 711 *buffer = (int *)counter_dump;
@@ -712,8 +723,10 @@ static struct gator_interface gator_events_mali_interface = {
712 723
713extern void gator_events_mali_log_dvfs_event(unsigned int frequency_mhz, unsigned int voltage_mv) 724extern void gator_events_mali_log_dvfs_event(unsigned int frequency_mhz, unsigned int voltage_mv)
714{ 725{
726#ifdef DVFS_REPORTED_BY_DDK
715 counter_data[COUNTER_FREQUENCY] = frequency_mhz; 727 counter_data[COUNTER_FREQUENCY] = frequency_mhz;
716 counter_data[COUNTER_VOLTAGE] = voltage_mv; 728 counter_data[COUNTER_VOLTAGE] = voltage_mv;
729#endif
717} 730}
718 731
719int gator_events_mali_init(void) 732int gator_events_mali_init(void)
@@ -722,7 +735,7 @@ int gator_events_mali_init(void)
722 735
723 pr_debug("gator: mali init\n"); 736 pr_debug("gator: mali init\n");
724 737
725 for (cnt = FIRST_ACTIVITY_EVENT; cnt < NUMBER_OF_EVENTS; cnt++) { 738 for (cnt = 0; cnt < NUMBER_OF_EVENTS; cnt++) {
726 counter_enabled[cnt] = 0; 739 counter_enabled[cnt] = 0;
727 counter_event[cnt] = 0; 740 counter_event[cnt] = 0;
728 counter_key[cnt] = gator_events_get_key(); 741 counter_key[cnt] = gator_events_get_key();
diff --git a/driver/gator_events_mali_400.h b/driver/gator_events_mali_4xx.h
index 43aec49..413ad0f 100644
--- a/driver/gator_events_mali_400.h
+++ b/driver/gator_events_mali_4xx.h
@@ -8,11 +8,11 @@
8 */ 8 */
9 9
10/* 10/*
11 * Header contains common definitions for the Mali-400 processors. 11 * Header contains common definitions for the Mali-4xx processors.
12 */ 12 */
13#if !defined(GATOR_EVENTS_MALI_400_H) 13#if !defined(GATOR_EVENTS_MALI_4xx_H)
14#define GATOR_EVENTS_MALI_400_H 14#define GATOR_EVENTS_MALI_4xx_H
15 15
16extern void gator_events_mali_log_dvfs_event(unsigned int d0, unsigned int d1); 16extern void gator_events_mali_log_dvfs_event(unsigned int d0, unsigned int d1);
17 17
18#endif /* GATOR_EVENTS_MALI_400_H */ 18#endif /* GATOR_EVENTS_MALI_4xx_H */
diff --git a/driver/gator_events_mali_common.c b/driver/gator_events_mali_common.c
index 22a517d..5a98b37 100644
--- a/driver/gator_events_mali_common.c
+++ b/driver/gator_events_mali_common.c
@@ -20,8 +20,8 @@ extern const char *gator_mali_get_mali_name(void)
20 switch (id) { 20 switch (id) {
21 case MALI_T6xx: 21 case MALI_T6xx:
22 return "Mali-T6xx"; 22 return "Mali-T6xx";
23 case MALI_400: 23 case MALI_4xx:
24 return "Mali-400"; 24 return "Mali-4xx";
25 default: 25 default:
26 pr_debug("gator: Mali-T6xx: unknown Mali ID (%d)\n", id); 26 pr_debug("gator: Mali-T6xx: unknown Mali ID (%d)\n", id);
27 return "Mali-Unknown"; 27 return "Mali-Unknown";
diff --git a/driver/gator_events_mali_common.h b/driver/gator_events_mali_common.h
index 27eaacc..d67ee2d 100644
--- a/driver/gator_events_mali_common.h
+++ b/driver/gator_events_mali_common.h
@@ -19,7 +19,7 @@
19#include <asm/io.h> 19#include <asm/io.h>
20 20
21/* Device codes for each known GPU */ 21/* Device codes for each known GPU */
22#define MALI_400 (0x0b07) 22#define MALI_4xx (0x0b07)
23#define MALI_T6xx (0x0056) 23#define MALI_T6xx (0x0056)
24 24
25/* Ensure that MALI_SUPPORT has been defined to something. */ 25/* Ensure that MALI_SUPPORT has been defined to something. */
@@ -40,9 +40,9 @@ typedef struct {
40} mali_counter; 40} mali_counter;
41 41
42/* 42/*
43 * Mali-400 43 * Mali-4xx
44 */ 44 */
45typedef void mali_profiling_set_event_type(unsigned int, unsigned int); 45typedef int mali_profiling_set_event_type(unsigned int, int);
46typedef void mali_osk_fb_control_set_type(unsigned int, unsigned int); 46typedef void mali_osk_fb_control_set_type(unsigned int, unsigned int);
47typedef void mali_profiling_control_type(unsigned int, unsigned int); 47typedef void mali_profiling_control_type(unsigned int, unsigned int);
48typedef void mali_profiling_get_counters_type(unsigned int *, unsigned int *, unsigned int *, unsigned int *); 48typedef void mali_profiling_get_counters_type(unsigned int *, unsigned int *, unsigned int *, unsigned int *);
@@ -50,13 +50,13 @@ typedef void mali_profiling_get_counters_type(unsigned int *, unsigned int *, un
50/* 50/*
51 * Driver entry points for functions called directly by gator. 51 * Driver entry points for functions called directly by gator.
52 */ 52 */
53extern void _mali_profiling_set_event(unsigned int, unsigned int); 53extern int _mali_profiling_set_event(unsigned int, int);
54extern void _mali_osk_fb_control_set(unsigned int, unsigned int); 54extern void _mali_osk_fb_control_set(unsigned int, unsigned int);
55extern void _mali_profiling_control(unsigned int, unsigned int); 55extern void _mali_profiling_control(unsigned int, unsigned int);
56extern void _mali_profiling_get_counters(unsigned int *, unsigned int *, unsigned int *, unsigned int *); 56extern void _mali_profiling_get_counters(unsigned int *, unsigned int *, unsigned int *, unsigned int *);
57 57
58/** 58/**
59 * Returns a name which identifies the GPU type (eg Mali-400, Mali-T6xx). 59 * Returns a name which identifies the GPU type (eg Mali-4xx, Mali-T6xx).
60 * 60 *
61 * @return The name as a constant string. 61 * @return The name as a constant string.
62 */ 62 */
diff --git a/driver/gator_events_mali_t6xx_hw.c b/driver/gator_events_mali_t6xx_hw.c
index 4f49c1d..f557350 100644
--- a/driver/gator_events_mali_t6xx_hw.c
+++ b/driver/gator_events_mali_t6xx_hw.c
@@ -304,11 +304,11 @@ static const char *const hardware_counter_names[] = {
304 "", 304 "",
305 "", 305 "",
306 "", 306 "",
307 "MMU_TABLE_WALK",
308 "MMU_REPLAY_MISS",
309 "MMU_REPLAY_FULL",
310 "MMU_NEW_MISS",
311 "MMU_HIT", 307 "MMU_HIT",
308 "MMU_NEW_MISS",
309 "MMU_REPLAY_FULL",
310 "MMU_REPLAY_MISS",
311 "MMU_TABLE_WALK",
312 "", 312 "",
313 "", 313 "",
314 "", 314 "",
@@ -316,11 +316,11 @@ static const char *const hardware_counter_names[] = {
316 "", 316 "",
317 "", 317 "",
318 "", 318 "",
319 "UTLB_STALL",
320 "UTLB_REPLAY_MISS",
321 "UTLB_REPLAY_FULL",
322 "UTLB_NEW_MISS",
323 "UTLB_HIT", 319 "UTLB_HIT",
320 "UTLB_NEW_MISS",
321 "UTLB_REPLAY_FULL",
322 "UTLB_REPLAY_MISS",
323 "UTLB_STALL",
324 "", 324 "",
325 "", 325 "",
326 "", 326 "",
diff --git a/driver/gator_events_mmaped.c b/driver/gator_events_mmaped.c
index 0027564..f7670f6 100644
--- a/driver/gator_events_mmaped.c
+++ b/driver/gator_events_mmaped.c
@@ -13,9 +13,9 @@
13 * 13 *
14 * <counter_set name="mmaped_cnt" count="3"/> 14 * <counter_set name="mmaped_cnt" count="3"/>
15 * <category name="mmaped" counter_set="mmaped_cnt" per_cpu="no"> 15 * <category name="mmaped" counter_set="mmaped_cnt" per_cpu="no">
16 * <event event="0x0" title="Simulated" name="Sine" display="maximum" average_selection="yes" description="Sort-of-sine"/> 16 * <event event="0x0" title="Simulated1" name="Sine" display="maximum" average_selection="yes" description="Sort-of-sine"/>
17 * <event event="0x1" title="Simulated" name="Triangle" display="maximum" average_selection="yes" description="Triangular wave"/> 17 * <event event="0x1" title="Simulated2" name="Triangle" display="maximum" average_selection="yes" description="Triangular wave"/>
18 * <event event="0x2" title="Simulated" name="PWM" display="maximum" average_selection="yes" description="PWM Signal"/> 18 * <event event="0x2" title="Simulated3" name="PWM" display="maximum" average_selection="yes" description="PWM Signal"/>
19 * </category> 19 * </category>
20 */ 20 */
21 21
diff --git a/driver/gator_hrtimer_gator.c b/driver/gator_hrtimer_gator.c
index 8c35d49..b0c947a 100644
--- a/driver/gator_hrtimer_gator.c
+++ b/driver/gator_hrtimer_gator.c
@@ -13,6 +13,7 @@
13 13
14void (*callback)(void); 14void (*callback)(void);
15DEFINE_PER_CPU(struct hrtimer, percpu_hrtimer); 15DEFINE_PER_CPU(struct hrtimer, percpu_hrtimer);
16DEFINE_PER_CPU(ktime_t, hrtimer_expire);
16DEFINE_PER_CPU(int, hrtimer_is_active); 17DEFINE_PER_CPU(int, hrtimer_is_active);
17static ktime_t profiling_interval; 18static ktime_t profiling_interval;
18static void gator_hrtimer_online(void); 19static void gator_hrtimer_online(void);
@@ -20,7 +21,9 @@ static void gator_hrtimer_offline(void);
20 21
21static enum hrtimer_restart gator_hrtimer_notify(struct hrtimer *hrtimer) 22static enum hrtimer_restart gator_hrtimer_notify(struct hrtimer *hrtimer)
22{ 23{
23 hrtimer_forward_now(hrtimer, profiling_interval); 24 int cpu = get_logical_cpu();
25 hrtimer_forward(hrtimer, per_cpu(hrtimer_expire, cpu), profiling_interval);
26 per_cpu(hrtimer_expire, cpu) = ktime_add(per_cpu(hrtimer_expire, cpu), profiling_interval);
24 (*callback)(); 27 (*callback)();
25 return HRTIMER_RESTART; 28 return HRTIMER_RESTART;
26} 29}
@@ -34,12 +37,13 @@ static void gator_hrtimer_online(void)
34 return; 37 return;
35 38
36 per_cpu(hrtimer_is_active, cpu) = 1; 39 per_cpu(hrtimer_is_active, cpu) = 1;
37 hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 40 hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
38 hrtimer->function = gator_hrtimer_notify; 41 hrtimer->function = gator_hrtimer_notify;
39#ifdef CONFIG_PREEMPT_RT_BASE 42#ifdef CONFIG_PREEMPT_RT_BASE
40 hrtimer->irqsafe = 1; 43 hrtimer->irqsafe = 1;
41#endif 44#endif
42 hrtimer_start(hrtimer, profiling_interval, HRTIMER_MODE_REL_PINNED); 45 per_cpu(hrtimer_expire, cpu) = ktime_add(hrtimer->base->get_time(), profiling_interval);
46 hrtimer_start(hrtimer, per_cpu(hrtimer_expire, cpu), HRTIMER_MODE_ABS_PINNED);
43} 47}
44 48
45static void gator_hrtimer_offline(void) 49static void gator_hrtimer_offline(void)
diff --git a/driver/gator_iks.c b/driver/gator_iks.c
index ed2c6dd..24233d7 100644
--- a/driver/gator_iks.c
+++ b/driver/gator_iks.c
@@ -16,17 +16,34 @@
16 16
17static bool map_cpuids; 17static bool map_cpuids;
18static int mpidr_cpuids[NR_CPUS]; 18static int mpidr_cpuids[NR_CPUS];
19static const struct gator_cpu * mpidr_cpus[NR_CPUS];
19static int __lcpu_to_pcpu[NR_CPUS]; 20static int __lcpu_to_pcpu[NR_CPUS];
20 21
22static const struct gator_cpu *gator_find_cpu_by_dt_name(const char *const name)
23{
24 int i;
25
26 for (i = 0; gator_cpus[i].cpuid != 0; ++i) {
27 const struct gator_cpu *const gator_cpu = &gator_cpus[i];
28 if (gator_cpu->dt_name != NULL && strcmp(gator_cpu->dt_name, name) == 0) {
29 return gator_cpu;
30 }
31 }
32
33 return NULL;
34}
35
21static void calc_first_cluster_size(void) 36static void calc_first_cluster_size(void)
22{ 37{
23 int len; 38 int len;
24 const u32 *val; 39 const u32 *val;
40 const char *compatible;
25 struct device_node *cn = NULL; 41 struct device_node *cn = NULL;
26 int mpidr_cpuids_count = 0; 42 int mpidr_cpuids_count = 0;
27 43
28 // Zero is a valid cpuid, so initialize the array to 0xff's 44 // Zero is a valid cpuid, so initialize the array to 0xff's
29 memset(&mpidr_cpuids, 0xff, sizeof(mpidr_cpuids)); 45 memset(&mpidr_cpuids, 0xff, sizeof(mpidr_cpuids));
46 memset(&mpidr_cpus, 0, sizeof(mpidr_cpus));
30 47
31 while ((cn = of_find_node_by_type(cn, "cpu"))) { 48 while ((cn = of_find_node_by_type(cn, "cpu"))) {
32 BUG_ON(mpidr_cpuids_count >= NR_CPUS); 49 BUG_ON(mpidr_cpuids_count >= NR_CPUS);
@@ -36,8 +53,14 @@ static void calc_first_cluster_size(void)
36 pr_err("%s missing reg property\n", cn->full_name); 53 pr_err("%s missing reg property\n", cn->full_name);
37 continue; 54 continue;
38 } 55 }
56 compatible = of_get_property(cn, "compatible", NULL);
57 if (compatible == NULL) {
58 pr_err("%s missing compatible property\n", cn->full_name);
59 continue;
60 }
39 61
40 mpidr_cpuids[mpidr_cpuids_count] = be32_to_cpup(val); 62 mpidr_cpuids[mpidr_cpuids_count] = be32_to_cpup(val);
63 mpidr_cpus[mpidr_cpuids_count] = gator_find_cpu_by_dt_name(compatible);
41 ++mpidr_cpuids_count; 64 ++mpidr_cpuids_count;
42 } 65 }
43 66
@@ -120,6 +143,17 @@ GATOR_DEFINE_PROBE(cpu_migrate_current, TP_PROTO(u64 timestamp, u32 cpu_hwid))
120 gator_update_cpu_mapping(cpu_hwid); 143 gator_update_cpu_mapping(cpu_hwid);
121} 144}
122 145
146static void gator_send_iks_core_names(void)
147{
148 int cpu;
149 // Send the cpu names
150 for (cpu = 0; cpu < nr_cpu_ids; ++cpu) {
151 if (mpidr_cpus[cpu] != NULL) {
152 gator_send_core_name(cpu, mpidr_cpus[cpu]->cpuid, mpidr_cpus[cpu]);
153 }
154 }
155}
156
123static int gator_migrate_start(void) 157static int gator_migrate_start(void)
124{ 158{
125 int retval = 0; 159 int retval = 0;
@@ -154,6 +188,7 @@ static void gator_migrate_stop(void)
154#else 188#else
155 189
156#define calc_first_cluster_size() 190#define calc_first_cluster_size()
191#define gator_send_iks_core_names()
157#define gator_migrate_start() 0 192#define gator_migrate_start() 0
158#define gator_migrate_stop() 193#define gator_migrate_stop()
159 194
diff --git a/driver/gator_main.c b/driver/gator_main.c
index 5eab034..7dd70d9 100644
--- a/driver/gator_main.c
+++ b/driver/gator_main.c
@@ -8,7 +8,7 @@
8 */ 8 */
9 9
10// This version must match the gator daemon version 10// This version must match the gator daemon version
11static unsigned long gator_protocol_version = 14; 11static unsigned long gator_protocol_version = 16;
12 12
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/cpu.h> 14#include <linux/cpu.h>
@@ -50,9 +50,9 @@ static unsigned long gator_protocol_version = 14;
50 50
51#if (GATOR_PERF_SUPPORT) && (!(GATOR_PERF_PMU_SUPPORT)) 51#if (GATOR_PERF_SUPPORT) && (!(GATOR_PERF_PMU_SUPPORT))
52#ifndef CONFIG_PERF_EVENTS 52#ifndef CONFIG_PERF_EVENTS
53#warning gator requires the kernel to have CONFIG_PERF_EVENTS defined to support pmu hardware counters 53#error gator requires the kernel to have CONFIG_PERF_EVENTS defined to support pmu hardware counters
54#elif !defined CONFIG_HW_PERF_EVENTS 54#elif !defined CONFIG_HW_PERF_EVENTS
55#warning gator requires the kernel to have CONFIG_HW_PERF_EVENTS defined to support pmu hardware counters 55#error gator requires the kernel to have CONFIG_HW_PERF_EVENTS defined to support pmu hardware counters
56#endif 56#endif
57#endif 57#endif
58 58
@@ -64,13 +64,13 @@ static unsigned long gator_protocol_version = 14;
64#define NAME_BUFFER_SIZE (64*1024) 64#define NAME_BUFFER_SIZE (64*1024)
65#define COUNTER_BUFFER_SIZE (64*1024) // counters have the core as part of the data and the core value in the frame header may be discarded 65#define COUNTER_BUFFER_SIZE (64*1024) // counters have the core as part of the data and the core value in the frame header may be discarded
66#define BLOCK_COUNTER_BUFFER_SIZE (128*1024) 66#define BLOCK_COUNTER_BUFFER_SIZE (128*1024)
67#define ANNOTATE_BUFFER_SIZE (64*1024) // annotate counters have the core as part of the data and the core value in the frame header may be discarded 67#define ANNOTATE_BUFFER_SIZE (128*1024) // annotate counters have the core as part of the data and the core value in the frame header may be discarded
68#define SCHED_TRACE_BUFFER_SIZE (128*1024) 68#define SCHED_TRACE_BUFFER_SIZE (128*1024)
69#define GPU_TRACE_BUFFER_SIZE (64*1024) // gpu trace counters have the core as part of the data and the core value in the frame header may be discarded 69#define GPU_TRACE_BUFFER_SIZE (64*1024) // gpu trace counters have the core as part of the data and the core value in the frame header may be discarded
70#define IDLE_BUFFER_SIZE (32*1024) // idle counters have the core as part of the data and the core value in the frame header may be discarded 70#define IDLE_BUFFER_SIZE (32*1024) // idle counters have the core as part of the data and the core value in the frame header may be discarded
71 71
72#define NO_COOKIE 0U 72#define NO_COOKIE 0U
73#define INVALID_COOKIE ~0U 73#define UNRESOLVED_COOKIE ~0U
74 74
75#define FRAME_SUMMARY 1 75#define FRAME_SUMMARY 1
76#define FRAME_BACKTRACE 2 76#define FRAME_BACKTRACE 2
@@ -93,6 +93,7 @@ static unsigned long gator_protocol_version = 14;
93 93
94#define MESSAGE_SCHED_SWITCH 1 94#define MESSAGE_SCHED_SWITCH 1
95#define MESSAGE_SCHED_EXIT 2 95#define MESSAGE_SCHED_EXIT 2
96#define MESSAGE_SCHED_START 3
96 97
97#define MESSAGE_IDLE_ENTER 1 98#define MESSAGE_IDLE_ENTER 1
98#define MESSAGE_IDLE_EXIT 2 99#define MESSAGE_IDLE_EXIT 2
@@ -167,7 +168,7 @@ static void gator_buffer_write_packed_int64(int cpu, int buftype, long long x);
167static void gator_buffer_write_bytes(int cpu, int buftype, const char *x, int len); 168static void gator_buffer_write_bytes(int cpu, int buftype, const char *x, int len);
168static void gator_buffer_write_string(int cpu, int buftype, const char *x); 169static void gator_buffer_write_string(int cpu, int buftype, const char *x);
169static void gator_add_trace(int cpu, unsigned long address); 170static void gator_add_trace(int cpu, unsigned long address);
170static void gator_add_sample(int cpu, struct pt_regs *const regs); 171static void gator_add_sample(int cpu, struct pt_regs *const regs, u64 time);
171static u64 gator_get_time(void); 172static u64 gator_get_time(void);
172 173
173// Size of the buffer, must be a power of 2. Effectively constant, set in gator_op_setup. 174// Size of the buffer, must be a power of 2. Effectively constant, set in gator_op_setup.
@@ -185,11 +186,8 @@ static DEFINE_PER_CPU(int[NUM_GATOR_BUFS], gator_buffer_commit);
185static DEFINE_PER_CPU(int[NUM_GATOR_BUFS], buffer_space_available); 186static DEFINE_PER_CPU(int[NUM_GATOR_BUFS], buffer_space_available);
186// The buffer. Allocated in gator_op_setup 187// The buffer. Allocated in gator_op_setup
187static DEFINE_PER_CPU(char *[NUM_GATOR_BUFS], gator_buffer); 188static DEFINE_PER_CPU(char *[NUM_GATOR_BUFS], gator_buffer);
188
189#if GATOR_LIVE
190// The time after which the buffer should be committed for live display 189// The time after which the buffer should be committed for live display
191static DEFINE_PER_CPU(u64, gator_buffer_commit_time); 190static DEFINE_PER_CPU(u64, gator_buffer_commit_time);
192#endif
193 191
194/****************************************************************************** 192/******************************************************************************
195 * Application Includes 193 * Application Includes
@@ -198,11 +196,11 @@ static DEFINE_PER_CPU(u64, gator_buffer_commit_time);
198#include "gator_hrtimer_perf.c" 196#include "gator_hrtimer_perf.c"
199#include "gator_hrtimer_gator.c" 197#include "gator_hrtimer_gator.c"
200#include "gator_cookies.c" 198#include "gator_cookies.c"
199#include "gator_annotate.c"
201#include "gator_trace_sched.c" 200#include "gator_trace_sched.c"
202#include "gator_trace_power.c" 201#include "gator_trace_power.c"
203#include "gator_trace_gpu.c" 202#include "gator_trace_gpu.c"
204#include "gator_backtrace.c" 203#include "gator_backtrace.c"
205#include "gator_annotate.c"
206#include "gator_fs.c" 204#include "gator_fs.c"
207#include "gator_pack.c" 205#include "gator_pack.c"
208 206
@@ -215,24 +213,28 @@ const struct gator_cpu gator_cpus[] = {
215 .cpuid = ARM1136, 213 .cpuid = ARM1136,
216 .core_name = "ARM1136", 214 .core_name = "ARM1136",
217 .pmnc_name = "ARM_ARM11", 215 .pmnc_name = "ARM_ARM11",
216 .dt_name = "arm,arm1136",
218 .pmnc_counters = 3, 217 .pmnc_counters = 3,
219 }, 218 },
220 { 219 {
221 .cpuid = ARM1156, 220 .cpuid = ARM1156,
222 .core_name = "ARM1156", 221 .core_name = "ARM1156",
223 .pmnc_name = "ARM_ARM11", 222 .pmnc_name = "ARM_ARM11",
223 .dt_name = "arm,arm1156",
224 .pmnc_counters = 3, 224 .pmnc_counters = 3,
225 }, 225 },
226 { 226 {
227 .cpuid = ARM1176, 227 .cpuid = ARM1176,
228 .core_name = "ARM1176", 228 .core_name = "ARM1176",
229 .pmnc_name = "ARM_ARM11", 229 .pmnc_name = "ARM_ARM11",
230 .dt_name = "arm,arm1176",
230 .pmnc_counters = 3, 231 .pmnc_counters = 3,
231 }, 232 },
232 { 233 {
233 .cpuid = ARM11MPCORE, 234 .cpuid = ARM11MPCORE,
234 .core_name = "ARM11MPCore", 235 .core_name = "ARM11MPCore",
235 .pmnc_name = "ARM_ARM11MPCore", 236 .pmnc_name = "ARM_ARM11MPCore",
237 .dt_name = "arm,arm11mpcore",
236 .pmnc_counters = 3, 238 .pmnc_counters = 3,
237 }, 239 },
238 { 240 {
@@ -240,6 +242,7 @@ const struct gator_cpu gator_cpus[] = {
240 .core_name = "Cortex-A5", 242 .core_name = "Cortex-A5",
241 .pmu_name = "ARMv7_Cortex_A5", 243 .pmu_name = "ARMv7_Cortex_A5",
242 .pmnc_name = "ARM_Cortex-A5", 244 .pmnc_name = "ARM_Cortex-A5",
245 .dt_name = "arm,cortex-a5",
243 .pmnc_counters = 2, 246 .pmnc_counters = 2,
244 }, 247 },
245 { 248 {
@@ -247,6 +250,7 @@ const struct gator_cpu gator_cpus[] = {
247 .core_name = "Cortex-A7", 250 .core_name = "Cortex-A7",
248 .pmu_name = "ARMv7_Cortex_A7", 251 .pmu_name = "ARMv7_Cortex_A7",
249 .pmnc_name = "ARM_Cortex-A7", 252 .pmnc_name = "ARM_Cortex-A7",
253 .dt_name = "arm,cortex-a7",
250 .pmnc_counters = 4, 254 .pmnc_counters = 4,
251 }, 255 },
252 { 256 {
@@ -254,6 +258,7 @@ const struct gator_cpu gator_cpus[] = {
254 .core_name = "Cortex-A8", 258 .core_name = "Cortex-A8",
255 .pmu_name = "ARMv7_Cortex_A8", 259 .pmu_name = "ARMv7_Cortex_A8",
256 .pmnc_name = "ARM_Cortex-A8", 260 .pmnc_name = "ARM_Cortex-A8",
261 .dt_name = "arm,cortex-a8",
257 .pmnc_counters = 4, 262 .pmnc_counters = 4,
258 }, 263 },
259 { 264 {
@@ -261,6 +266,15 @@ const struct gator_cpu gator_cpus[] = {
261 .core_name = "Cortex-A9", 266 .core_name = "Cortex-A9",
262 .pmu_name = "ARMv7_Cortex_A9", 267 .pmu_name = "ARMv7_Cortex_A9",
263 .pmnc_name = "ARM_Cortex-A9", 268 .pmnc_name = "ARM_Cortex-A9",
269 .dt_name = "arm,cortex-a9",
270 .pmnc_counters = 6,
271 },
272 {
273 .cpuid = CORTEX_A12,
274 .core_name = "Cortex-A12",
275 .pmu_name = "ARMv7_Cortex_A12",
276 .pmnc_name = "ARM_Cortex-A12",
277 .dt_name = "arm,cortex-a12",
264 .pmnc_counters = 6, 278 .pmnc_counters = 6,
265 }, 279 },
266 { 280 {
@@ -268,6 +282,7 @@ const struct gator_cpu gator_cpus[] = {
268 .core_name = "Cortex-A15", 282 .core_name = "Cortex-A15",
269 .pmu_name = "ARMv7_Cortex_A15", 283 .pmu_name = "ARMv7_Cortex_A15",
270 .pmnc_name = "ARM_Cortex-A15", 284 .pmnc_name = "ARM_Cortex-A15",
285 .dt_name = "arm,cortex-a15",
271 .pmnc_counters = 6, 286 .pmnc_counters = 6,
272 }, 287 },
273 { 288 {
@@ -304,12 +319,14 @@ const struct gator_cpu gator_cpus[] = {
304 .cpuid = CORTEX_A53, 319 .cpuid = CORTEX_A53,
305 .core_name = "Cortex-A53", 320 .core_name = "Cortex-A53",
306 .pmnc_name = "ARM_Cortex-A53", 321 .pmnc_name = "ARM_Cortex-A53",
322 .dt_name = "arm,cortex-a53",
307 .pmnc_counters = 6, 323 .pmnc_counters = 6,
308 }, 324 },
309 { 325 {
310 .cpuid = CORTEX_A57, 326 .cpuid = CORTEX_A57,
311 .core_name = "Cortex-A57", 327 .core_name = "Cortex-A57",
312 .pmnc_name = "ARM_Cortex-A57", 328 .pmnc_name = "ARM_Cortex-A57",
329 .dt_name = "arm,cortex-a57",
313 .pmnc_counters = 6, 330 .pmnc_counters = 6,
314 }, 331 },
315 { 332 {
@@ -491,13 +508,11 @@ static void gator_commit_buffer(int cpu, int buftype, u64 time)
491 508
492 per_cpu(gator_buffer_commit, cpu)[buftype] = per_cpu(gator_buffer_write, cpu)[buftype]; 509 per_cpu(gator_buffer_commit, cpu)[buftype] = per_cpu(gator_buffer_write, cpu)[buftype];
493 510
494#if GATOR_LIVE
495 if (gator_live_rate > 0) { 511 if (gator_live_rate > 0) {
496 while (time > per_cpu(gator_buffer_commit_time, cpu)) { 512 while (time > per_cpu(gator_buffer_commit_time, cpu)) {
497 per_cpu(gator_buffer_commit_time, cpu) += gator_live_rate; 513 per_cpu(gator_buffer_commit_time, cpu) += gator_live_rate;
498 } 514 }
499 } 515 }
500#endif
501 516
502 marshal_frame(cpu, buftype); 517 marshal_frame(cpu, buftype);
503 518
@@ -521,14 +536,14 @@ static void gator_add_trace(int cpu, unsigned long address)
521 off_t offset = 0; 536 off_t offset = 0;
522 unsigned long cookie = get_address_cookie(cpu, current, address & ~1, &offset); 537 unsigned long cookie = get_address_cookie(cpu, current, address & ~1, &offset);
523 538
524 if (cookie == NO_COOKIE || cookie == INVALID_COOKIE) { 539 if (cookie == NO_COOKIE || cookie == UNRESOLVED_COOKIE) {
525 offset = address; 540 offset = address;
526 } 541 }
527 542
528 marshal_backtrace(offset & ~1, cookie); 543 marshal_backtrace(offset & ~1, cookie);
529} 544}
530 545
531static void gator_add_sample(int cpu, struct pt_regs *const regs) 546static void gator_add_sample(int cpu, struct pt_regs *const regs, u64 time)
532{ 547{
533 bool inKernel; 548 bool inKernel;
534 unsigned long exec_cookie; 549 unsigned long exec_cookie;
@@ -539,7 +554,7 @@ static void gator_add_sample(int cpu, struct pt_regs *const regs)
539 inKernel = !user_mode(regs); 554 inKernel = !user_mode(regs);
540 exec_cookie = get_exec_cookie(cpu, current); 555 exec_cookie = get_exec_cookie(cpu, current);
541 556
542 if (!marshal_backtrace_header(exec_cookie, current->tgid, current->pid, inKernel)) 557 if (!marshal_backtrace_header(exec_cookie, current->tgid, current->pid, inKernel, time))
543 return; 558 return;
544 559
545 if (inKernel) { 560 if (inKernel) {
@@ -553,7 +568,7 @@ static void gator_add_sample(int cpu, struct pt_regs *const regs)
553 arm_backtrace_eabi(cpu, regs, gator_backtrace_depth); 568 arm_backtrace_eabi(cpu, regs, gator_backtrace_depth);
554 } 569 }
555 570
556 marshal_backtrace_footer(); 571 marshal_backtrace_footer(time);
557} 572}
558 573
559/****************************************************************************** 574/******************************************************************************
@@ -567,14 +582,15 @@ static void gator_timer_interrupt(void)
567 582
568void gator_backtrace_handler(struct pt_regs *const regs) 583void gator_backtrace_handler(struct pt_regs *const regs)
569{ 584{
585 u64 time = gator_get_time();
570 int cpu = get_physical_cpu(); 586 int cpu = get_physical_cpu();
571 587
572 // Output backtrace 588 // Output backtrace
573 gator_add_sample(cpu, regs); 589 gator_add_sample(cpu, regs, time);
574 590
575 // Collect counters 591 // Collect counters
576 if (!per_cpu(collecting, cpu)) { 592 if (!per_cpu(collecting, cpu)) {
577 collect_counters(); 593 collect_counters(time);
578 } 594 }
579} 595}
580 596
@@ -640,6 +656,25 @@ static void gator_timer_stop(void)
640 } 656 }
641} 657}
642 658
659#if defined(__arm__) || defined(__aarch64__)
660static void gator_send_core_name(int cpu, const u32 cpuid, const struct gator_cpu *const gator_cpu) {
661 const char *core_name = NULL;
662 char core_name_buf[32];
663
664 if (!sent_core_name[cpu]) {
665 if (gator_cpu != NULL) {
666 core_name = gator_cpu->core_name;
667 } else {
668 snprintf(core_name_buf, sizeof(core_name_buf), "Unknown (0x%.3x)", cpuid);
669 core_name = core_name_buf;
670 }
671
672 marshal_core_name(cpu, cpuid, core_name);
673 sent_core_name[cpu] = true;
674 }
675}
676#endif
677
643// This function runs in interrupt context and on the appropriate core 678// This function runs in interrupt context and on the appropriate core
644static void gator_timer_online(void *migrate) 679static void gator_timer_online(void *migrate)
645{ 680{
@@ -669,20 +704,8 @@ static void gator_timer_online(void *migrate)
669 704
670#if defined(__arm__) || defined(__aarch64__) 705#if defined(__arm__) || defined(__aarch64__)
671 if (!sent_core_name[cpu]) { 706 if (!sent_core_name[cpu]) {
672 const char *core_name = NULL;
673 const u32 cpuid = gator_cpuid(); 707 const u32 cpuid = gator_cpuid();
674 const struct gator_cpu *const gator_cpu = gator_find_cpu_by_cpuid(cpuid); 708 gator_send_core_name(cpu, cpuid, gator_find_cpu_by_cpuid(cpuid));
675 char core_name_buf[32];
676
677 if (gator_cpu != NULL) {
678 core_name = gator_cpu->core_name;
679 } else {
680 snprintf(core_name_buf, sizeof(core_name_buf), "Unknown (0x%.3x)", cpuid);
681 core_name = core_name_buf;
682 }
683
684 marshal_core_name(cpuid, core_name);
685 sent_core_name[cpu] = true;
686 } 709 }
687#endif 710#endif
688} 711}
@@ -699,6 +722,8 @@ static void gator_timer_online_dispatch(int cpu, bool migrate)
699 } 722 }
700} 723}
701 724
725#include "gator_iks.c"
726
702int gator_timer_start(unsigned long sample_rate) 727int gator_timer_start(unsigned long sample_rate)
703{ 728{
704 int cpu; 729 int cpu;
@@ -718,6 +743,7 @@ int gator_timer_start(unsigned long sample_rate)
718 if (gator_hrtimer_init(sample_rate, gator_timer_interrupt) == -1) 743 if (gator_hrtimer_init(sample_rate, gator_timer_interrupt) == -1)
719 return -1; 744 return -1;
720 745
746 gator_send_iks_core_names();
721 for_each_online_cpu(cpu) { 747 for_each_online_cpu(cpu) {
722 gator_timer_online_dispatch(lcpu_to_pcpu(cpu), false); 748 gator_timer_online_dispatch(lcpu_to_pcpu(cpu), false);
723 } 749 }
@@ -740,6 +766,7 @@ static u64 gator_get_time(void)
740 766
741 // getrawmonotonic is not monotonic on all systems. Detect and attempt to correct these cases. 767 // getrawmonotonic is not monotonic on all systems. Detect and attempt to correct these cases.
742 // up to 0.5ms delta has been seen on some systems, which can skew Streamline data when viewing at high resolution. 768 // up to 0.5ms delta has been seen on some systems, which can skew Streamline data when viewing at high resolution.
769 // This doesn't work well with interrupts, but that it's OK - the real concern is to catch big jumps in time
743 prev_timestamp = per_cpu(last_timestamp, cpu); 770 prev_timestamp = per_cpu(last_timestamp, cpu);
744 if (prev_timestamp <= timestamp) { 771 if (prev_timestamp <= timestamp) {
745 per_cpu(last_timestamp, cpu) = timestamp; 772 per_cpu(last_timestamp, cpu) = timestamp;
@@ -759,8 +786,6 @@ static u64 gator_get_time(void)
759/****************************************************************************** 786/******************************************************************************
760 * cpu hotplug and pm notifiers 787 * cpu hotplug and pm notifiers
761 ******************************************************************************/ 788 ******************************************************************************/
762#include "gator_iks.c"
763
764static int __cpuinit gator_hotcpu_notify(struct notifier_block *self, unsigned long action, void *hcpu) 789static int __cpuinit gator_hotcpu_notify(struct notifier_block *self, unsigned long action, void *hcpu)
765{ 790{
766 int cpu = lcpu_to_pcpu((long)hcpu); 791 int cpu = lcpu_to_pcpu((long)hcpu);
@@ -865,7 +890,7 @@ static void gator_summary(void)
865 gator_monotonic_started = gator_get_time(); 890 gator_monotonic_started = gator_get_time();
866 local_irq_restore(flags); 891 local_irq_restore(flags);
867 892
868 marshal_summary(timestamp, uptime, uname_buf); 893 marshal_summary(timestamp, uptime, gator_monotonic_started, uname_buf);
869} 894}
870 895
871int gator_events_install(struct gator_interface *interface) 896int gator_events_install(struct gator_interface *interface)
@@ -1062,9 +1087,7 @@ static int gator_op_setup(void)
1062 per_cpu(gator_buffer_write, cpu)[i] = 0; 1087 per_cpu(gator_buffer_write, cpu)[i] = 0;
1063 per_cpu(gator_buffer_commit, cpu)[i] = 0; 1088 per_cpu(gator_buffer_commit, cpu)[i] = 0;
1064 per_cpu(buffer_space_available, cpu)[i] = true; 1089 per_cpu(buffer_space_available, cpu)[i] = true;
1065#if GATOR_LIVE
1066 per_cpu(gator_buffer_commit_time, cpu) = gator_live_rate; 1090 per_cpu(gator_buffer_commit_time, cpu) = gator_live_rate;
1067#endif
1068 1091
1069 // Annotation is a special case that only uses a single buffer 1092 // Annotation is a special case that only uses a single buffer
1070 if (cpu > 0 && i == ANNOTATE_BUF) { 1093 if (cpu > 0 && i == ANNOTATE_BUF) {
@@ -1138,9 +1161,7 @@ static void gator_shutdown(void)
1138 per_cpu(gator_buffer_write, cpu)[i] = 0; 1161 per_cpu(gator_buffer_write, cpu)[i] = 0;
1139 per_cpu(gator_buffer_commit, cpu)[i] = 0; 1162 per_cpu(gator_buffer_commit, cpu)[i] = 0;
1140 per_cpu(buffer_space_available, cpu)[i] = true; 1163 per_cpu(buffer_space_available, cpu)[i] = true;
1141#if GATOR_LIVE
1142 per_cpu(gator_buffer_commit_time, cpu) = 0; 1164 per_cpu(gator_buffer_commit_time, cpu) = 0;
1143#endif
1144 } 1165 }
1145 mutex_unlock(&gator_buffer_mutex); 1166 mutex_unlock(&gator_buffer_mutex);
1146 } 1167 }
@@ -1297,7 +1318,7 @@ static ssize_t userspace_buffer_read(struct file *file, char __user *buf, size_t
1297 if (buftype == ANNOTATE_BUF) { 1318 if (buftype == ANNOTATE_BUF) {
1298 wake_up(&gator_annotate_wait); 1319 wake_up(&gator_annotate_wait);
1299 } 1320 }
1300 } while (buffer_commit_ready(&cpu, &buftype)); 1321 } while (buffer_commit_ready(&cpu, &buftype));
1301 1322
1302 mutex_unlock(&gator_buffer_mutex); 1323 mutex_unlock(&gator_buffer_mutex);
1303 1324
diff --git a/driver/gator_marshaling.c b/driver/gator_marshaling.c
index 72dd5ef..3282de8 100644
--- a/driver/gator_marshaling.c
+++ b/driver/gator_marshaling.c
@@ -19,7 +19,11 @@
19 /* Add another character so the length isn't 0x0a bytes */ \ 19 /* Add another character so the length isn't 0x0a bytes */ \
20 "5" 20 "5"
21 21
22static void marshal_summary(long long timestamp, long long uptime, const char * uname) 22#ifdef MALI_SUPPORT
23#include "gator_events_mali_common.h"
24#endif
25
26static void marshal_summary(long long timestamp, long long uptime, long long monotonic_delta, const char * uname)
23{ 27{
24 unsigned long flags; 28 unsigned long flags;
25 int cpu = 0; 29 int cpu = 0;
@@ -28,12 +32,24 @@ static void marshal_summary(long long timestamp, long long uptime, const char *
28 gator_buffer_write_string(cpu, SUMMARY_BUF, NEWLINE_CANARY); 32 gator_buffer_write_string(cpu, SUMMARY_BUF, NEWLINE_CANARY);
29 gator_buffer_write_packed_int64(cpu, SUMMARY_BUF, timestamp); 33 gator_buffer_write_packed_int64(cpu, SUMMARY_BUF, timestamp);
30 gator_buffer_write_packed_int64(cpu, SUMMARY_BUF, uptime); 34 gator_buffer_write_packed_int64(cpu, SUMMARY_BUF, uptime);
35 gator_buffer_write_packed_int64(cpu, SUMMARY_BUF, monotonic_delta);
31 gator_buffer_write_string(cpu, SUMMARY_BUF, "uname"); 36 gator_buffer_write_string(cpu, SUMMARY_BUF, "uname");
32 gator_buffer_write_string(cpu, SUMMARY_BUF, uname); 37 gator_buffer_write_string(cpu, SUMMARY_BUF, uname);
33#if GATOR_IKS_SUPPORT 38#if GATOR_IKS_SUPPORT
34 gator_buffer_write_string(cpu, SUMMARY_BUF, "iks"); 39 gator_buffer_write_string(cpu, SUMMARY_BUF, "iks");
35 gator_buffer_write_string(cpu, SUMMARY_BUF, ""); 40 gator_buffer_write_string(cpu, SUMMARY_BUF, "");
36#endif 41#endif
42 // Let Streamline know which GPU is used so that it can label the GPU Activity appropriately. This is a temporary fix, to be improved in a future release.
43#ifdef MALI_SUPPORT
44 gator_buffer_write_string(cpu, SUMMARY_BUF, "mali_type");
45#if (MALI_SUPPORT == MALI_4xx)
46 gator_buffer_write_string(cpu, SUMMARY_BUF, "4xx");
47#elif (MALI_SUPPORT == MALI_T6xx)
48 gator_buffer_write_string(cpu, SUMMARY_BUF, "6xx");
49#else
50 gator_buffer_write_string(cpu, SUMMARY_BUF, "unknown");
51#endif
52#endif
37 gator_buffer_write_string(cpu, SUMMARY_BUF, ""); 53 gator_buffer_write_string(cpu, SUMMARY_BUF, "");
38 // Commit the buffer now so it can be one of the first frames read by Streamline 54 // Commit the buffer now so it can be one of the first frames read by Streamline
39 gator_commit_buffer(cpu, SUMMARY_BUF, gator_get_time()); 55 gator_commit_buffer(cpu, SUMMARY_BUF, gator_get_time());
@@ -73,23 +89,23 @@ static void marshal_thread_name(int pid, char *name)
73 local_irq_restore(flags); 89 local_irq_restore(flags);
74} 90}
75 91
76static bool marshal_backtrace_header(int exec_cookie, int tgid, int pid, int inKernel) 92static bool marshal_backtrace_header(int exec_cookie, int tgid, int pid, int inKernel, u64 time)
77{ 93{
78 int cpu = get_physical_cpu(); 94 int cpu = get_physical_cpu();
79 u64 time = gator_get_time(); 95 if (!buffer_check_space(cpu, BACKTRACE_BUF, MAXSIZE_PACK64 + 5 * MAXSIZE_PACK32 + gator_backtrace_depth * 2 * MAXSIZE_PACK32)) {
80 if (buffer_check_space(cpu, BACKTRACE_BUF, MAXSIZE_PACK64 + 5 * MAXSIZE_PACK32 + gator_backtrace_depth * 2 * MAXSIZE_PACK32)) { 96 // Check and commit; commit is set to occur once buffer is 3/4 full
81 gator_buffer_write_packed_int64(cpu, BACKTRACE_BUF, time); 97 buffer_check(cpu, BACKTRACE_BUF, time);
82 gator_buffer_write_packed_int(cpu, BACKTRACE_BUF, exec_cookie); 98
83 gator_buffer_write_packed_int(cpu, BACKTRACE_BUF, tgid); 99 return false;
84 gator_buffer_write_packed_int(cpu, BACKTRACE_BUF, pid);
85 gator_buffer_write_packed_int(cpu, BACKTRACE_BUF, inKernel);
86 return true;
87 } 100 }
88 101
89 // Check and commit; commit is set to occur once buffer is 3/4 full 102 gator_buffer_write_packed_int64(cpu, BACKTRACE_BUF, time);
90 buffer_check(cpu, BACKTRACE_BUF, time); 103 gator_buffer_write_packed_int(cpu, BACKTRACE_BUF, exec_cookie);
104 gator_buffer_write_packed_int(cpu, BACKTRACE_BUF, tgid);
105 gator_buffer_write_packed_int(cpu, BACKTRACE_BUF, pid);
106 gator_buffer_write_packed_int(cpu, BACKTRACE_BUF, inKernel);
91 107
92 return false; 108 return true;
93} 109}
94 110
95static void marshal_backtrace(unsigned long address, int cookie) 111static void marshal_backtrace(unsigned long address, int cookie)
@@ -99,13 +115,13 @@ static void marshal_backtrace(unsigned long address, int cookie)
99 gator_buffer_write_packed_int64(cpu, BACKTRACE_BUF, address); 115 gator_buffer_write_packed_int64(cpu, BACKTRACE_BUF, address);
100} 116}
101 117
102static void marshal_backtrace_footer(void) 118static void marshal_backtrace_footer(u64 time)
103{ 119{
104 int cpu = get_physical_cpu(); 120 int cpu = get_physical_cpu();
105 gator_buffer_write_packed_int(cpu, BACKTRACE_BUF, MESSAGE_END_BACKTRACE); 121 gator_buffer_write_packed_int(cpu, BACKTRACE_BUF, MESSAGE_END_BACKTRACE);
106 122
107 // Check and commit; commit is set to occur once buffer is 3/4 full 123 // Check and commit; commit is set to occur once buffer is 3/4 full
108 buffer_check(cpu, BACKTRACE_BUF, gator_get_time()); 124 buffer_check(cpu, BACKTRACE_BUF, time);
109} 125}
110 126
111static bool marshal_event_header(u64 time) 127static bool marshal_event_header(u64 time)
@@ -239,6 +255,28 @@ static void marshal_sched_gpu_stop(int unit, int core)
239 local_irq_restore(flags); 255 local_irq_restore(flags);
240} 256}
241 257
258static void marshal_sched_trace_start(int tgid, int pid, int cookie)
259{
260 unsigned long cpu = get_physical_cpu(), flags;
261 u64 time;
262
263 if (!per_cpu(gator_buffer, cpu)[SCHED_TRACE_BUF])
264 return;
265
266 local_irq_save(flags);
267 time = gator_get_time();
268 if (buffer_check_space(cpu, SCHED_TRACE_BUF, MAXSIZE_PACK64 + 5 * MAXSIZE_PACK32)) {
269 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, MESSAGE_SCHED_START);
270 gator_buffer_write_packed_int64(cpu, SCHED_TRACE_BUF, time);
271 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, tgid);
272 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, pid);
273 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, cookie);
274 }
275 // Check and commit; commit is set to occur once buffer is 3/4 full
276 buffer_check(cpu, SCHED_TRACE_BUF, time);
277 local_irq_restore(flags);
278}
279
242static void marshal_sched_trace_switch(int tgid, int pid, int cookie, int state) 280static void marshal_sched_trace_switch(int tgid, int pid, int cookie, int state)
243{ 281{
244 unsigned long cpu = get_physical_cpu(), flags; 282 unsigned long cpu = get_physical_cpu(), flags;
@@ -357,17 +395,19 @@ static void marshal_frame(int cpu, int buftype)
357} 395}
358 396
359#if defined(__arm__) || defined(__aarch64__) 397#if defined(__arm__) || defined(__aarch64__)
360static void marshal_core_name(const int cpuid, const char *name) 398static void marshal_core_name(const int core, const int cpuid, const char *name)
361{ 399{
362 int cpu = get_physical_cpu(); 400 int cpu = get_physical_cpu();
363 unsigned long flags; 401 unsigned long flags;
364 local_irq_save(flags); 402 local_irq_save(flags);
365 if (buffer_check_space(cpu, NAME_BUF, MAXSIZE_PACK32 + MAXSIZE_CORE_NAME)) { 403 if (buffer_check_space(cpu, NAME_BUF, MAXSIZE_PACK32 + MAXSIZE_CORE_NAME)) {
366 gator_buffer_write_packed_int(cpu, NAME_BUF, HRTIMER_CORE_NAME); 404 gator_buffer_write_packed_int(cpu, NAME_BUF, HRTIMER_CORE_NAME);
405 gator_buffer_write_packed_int(cpu, NAME_BUF, core);
367 gator_buffer_write_packed_int(cpu, NAME_BUF, cpuid); 406 gator_buffer_write_packed_int(cpu, NAME_BUF, cpuid);
368 gator_buffer_write_string(cpu, NAME_BUF, name); 407 gator_buffer_write_string(cpu, NAME_BUF, name);
369 } 408 }
370 buffer_check(cpu, NAME_BUF, gator_get_time()); 409 // Commit core names now so that they can show up in live
410 gator_commit_buffer(cpu, NAME_BUF, gator_get_time());
371 local_irq_restore(flags); 411 local_irq_restore(flags);
372} 412}
373#endif 413#endif
diff --git a/driver/gator_trace_gpu.c b/driver/gator_trace_gpu.c
index 61ecbe3..12623c4 100644
--- a/driver/gator_trace_gpu.c
+++ b/driver/gator_trace_gpu.c
@@ -40,21 +40,27 @@ enum {
40 NUMBER_OF_GPU_UNITS 40 NUMBER_OF_GPU_UNITS
41}; 41};
42 42
43#define MALI_400 (0x0b07) 43#define MALI_4xx (0x0b07)
44#define MALI_T6xx (0x0056) 44#define MALI_T6xx (0x0056)
45 45
46struct mali_gpu_job { 46struct mali_gpu_job {
47 int count; 47 int count;
48 int last_core;
49 int last_tgid; 48 int last_tgid;
50 int last_pid; 49 int last_pid;
50 int last_job_id;
51}; 51};
52 52
53#define NUMBER_OF_GPU_CORES 16 53#define NUMBER_OF_GPU_CORES 16
54static struct mali_gpu_job mali_gpu_jobs[NUMBER_OF_GPU_UNITS][NUMBER_OF_GPU_CORES]; 54static struct mali_gpu_job mali_gpu_jobs[NUMBER_OF_GPU_UNITS][NUMBER_OF_GPU_CORES];
55static DEFINE_SPINLOCK(mali_gpu_jobs_lock); 55static DEFINE_SPINLOCK(mali_gpu_jobs_lock);
56 56
57static void mali_gpu_enqueue(int unit, int core, int tgid, int pid) 57/* Only one event should be running on a unit and core at a time (ie, a start
58 * event can only be followed by a stop and vice versa), but because the kernel
59 * only knows when a job is enqueued and not started, it is possible for a
60 * start1, start2, stop1, stop2. Change it back into start1, stop1, start2,
61 * stop2 by queueing up start2 and releasing it when stop1 is received.
62 */
63static void mali_gpu_enqueue(int unit, int core, int tgid, int pid, int job_id)
58{ 64{
59 int count; 65 int count;
60 66
@@ -63,23 +69,23 @@ static void mali_gpu_enqueue(int unit, int core, int tgid, int pid)
63 BUG_ON(count < 0); 69 BUG_ON(count < 0);
64 ++mali_gpu_jobs[unit][core].count; 70 ++mali_gpu_jobs[unit][core].count;
65 if (count) { 71 if (count) {
66 mali_gpu_jobs[unit][core].last_core = core;
67 mali_gpu_jobs[unit][core].last_tgid = tgid; 72 mali_gpu_jobs[unit][core].last_tgid = tgid;
68 mali_gpu_jobs[unit][core].last_pid = pid; 73 mali_gpu_jobs[unit][core].last_pid = pid;
74 mali_gpu_jobs[unit][core].last_job_id = job_id;
69 } 75 }
70 spin_unlock(&mali_gpu_jobs_lock); 76 spin_unlock(&mali_gpu_jobs_lock);
71 77
72 if (!count) { 78 if (!count) {
73 marshal_sched_gpu_start(unit, core, tgid, pid); 79 marshal_sched_gpu_start(unit, core, tgid, pid/*, job_id*/);
74 } 80 }
75} 81}
76 82
77static void mali_gpu_stop(int unit, int core) 83static void mali_gpu_stop(int unit, int core)
78{ 84{
79 int count; 85 int count;
80 int last_core = 0;
81 int last_tgid = 0; 86 int last_tgid = 0;
82 int last_pid = 0; 87 int last_pid = 0;
88 int last_job_id = 0;
83 89
84 spin_lock(&mali_gpu_jobs_lock); 90 spin_lock(&mali_gpu_jobs_lock);
85 if (mali_gpu_jobs[unit][core].count == 0) { 91 if (mali_gpu_jobs[unit][core].count == 0) {
@@ -89,20 +95,20 @@ static void mali_gpu_stop(int unit, int core)
89 --mali_gpu_jobs[unit][core].count; 95 --mali_gpu_jobs[unit][core].count;
90 count = mali_gpu_jobs[unit][core].count; 96 count = mali_gpu_jobs[unit][core].count;
91 if (count) { 97 if (count) {
92 last_core = mali_gpu_jobs[unit][core].last_core;
93 last_tgid = mali_gpu_jobs[unit][core].last_tgid; 98 last_tgid = mali_gpu_jobs[unit][core].last_tgid;
94 last_pid = mali_gpu_jobs[unit][core].last_pid; 99 last_pid = mali_gpu_jobs[unit][core].last_pid;
100 last_job_id = mali_gpu_jobs[unit][core].last_job_id;
95 } 101 }
96 spin_unlock(&mali_gpu_jobs_lock); 102 spin_unlock(&mali_gpu_jobs_lock);