summaryrefslogtreecommitdiff
path: root/mali_kbase/debug
diff options
context:
space:
mode:
authorSidath Senanayake <sidaths@google.com>2021-01-29 15:03:53 +0000
committerSidath Senanayake <sidaths@google.com>2021-01-29 15:03:53 +0000
commit9748305a584b9f1f7705303ce6e33a5e8b923e60 (patch)
treea73788e1d912a3202db3a99018002e0858e9a948 /mali_kbase/debug
parent201c8bfb4637601363b6e9283f3bdc510711a226 (diff)
downloadgpu-9748305a584b9f1f7705303ce6e33a5e8b923e60.tar.gz
Mali Valhall DDK r29p0 KMD
Provenance: afaca8da1 (collaborate/EAC/v_r29p0) VX504X08X-BU-00000-r29p0-01eac0 - Valhall Android DDK VX504X08X-BU-60000-r29p0-01eac0 - Valhall Android Document Bundle VX504X08X-DC-11001-r29p0-01eac0 - Valhall Android DDK Software Errata VX504X08X-SW-99006-r29p0-01eac0 - Valhall Android Renderscript AOSP parts Signed-off-by: Sidath Senanayake <sidaths@google.com> Change-Id: Ie0904c9223b7ec9311b848a52d3159ac2b07530e
Diffstat (limited to 'mali_kbase/debug')
-rw-r--r--mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_csf.h61
-rw-r--r--mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_jm.h21
-rw-r--r--mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.c88
-rw-r--r--mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.h86
-rw-r--r--mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_csf.h93
-rw-r--r--mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_jm.h49
-rw-r--r--mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.c44
-rw-r--r--mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.h21
-rw-r--r--mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_csf.h67
-rw-r--r--mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_jm.h21
-rw-r--r--mali_kbase/debug/mali_kbase_debug_ktrace.c11
-rw-r--r--mali_kbase/debug/mali_kbase_debug_ktrace.h21
-rw-r--r--mali_kbase/debug/mali_kbase_debug_ktrace_codes.h30
-rw-r--r--mali_kbase/debug/mali_kbase_debug_ktrace_defs.h44
-rw-r--r--mali_kbase/debug/mali_kbase_debug_ktrace_internal.h21
-rw-r--r--mali_kbase/debug/mali_kbase_debug_linux_ktrace.h27
16 files changed, 601 insertions, 104 deletions
diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_csf.h b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_csf.h
index 32181d7..51ab2f5 100644
--- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_csf.h
+++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_csf.h
@@ -1,6 +1,6 @@
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -18,6 +18,25 @@
*
* SPDX-License-Identifier: GPL-2.0
*
+ *//* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *
+ * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ *
*/
/*
@@ -109,6 +128,46 @@ int dummy_array[] = {
KBASE_KTRACE_CODE_MAKE_CODE(QUEUE_START),
KBASE_KTRACE_CODE_MAKE_CODE(QUEUE_STOP),
+ /*
+ * KCPU queue events
+ */
+ /* KTrace info_val == KCPU queue fence context
+ * KCPU extra_info_val == N/A.
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(KCPU_QUEUE_NEW),
+ /* KTrace info_val == Number of pending commands in KCPU queue when
+ * it is destroyed.
+ * KCPU extra_info_val == Number of CQS wait operations present in
+ * the KCPU queue when it is destroyed.
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(KCPU_QUEUE_DESTROY),
+ /* KTrace info_val == CQS event memory address
+ * KCPU extra_info_val == Upper 32 bits of event memory, i.e. contents
+ * of error field.
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(CQS_SET),
+ /* KTrace info_val == Number of CQS objects to be waited upon
+ * KCPU extra_info_val == N/A.
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(CQS_WAIT_START),
+ /* KTrace info_val == CQS event memory address
+ * KCPU extra_info_val == 1 if CQS was signaled with an error and queue
+ * inherited the error, otherwise 0.
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(CQS_WAIT_END),
+ /* KTrace info_val == Fence context
+ * KCPU extra_info_val == Fence seqno.
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(FENCE_SIGNAL),
+ /* KTrace info_val == Fence context
+ * KCPU extra_info_val == Fence seqno.
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(FENCE_WAIT_START),
+ /* KTrace info_val == Fence context
+ * KCPU extra_info_val == Fence seqno.
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(FENCE_WAIT_END),
+
#if 0 /* Dummy section to avoid breaking formatting */
};
#endif
diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_jm.h b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_jm.h
index b201e49..8e846ad 100644
--- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_jm.h
+++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_jm.h
@@ -1,6 +1,6 @@
/*
*
- * (C) COPYRIGHT 2011-2015,2018-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -18,6 +18,25 @@
*
* SPDX-License-Identifier: GPL-2.0
*
+ *//* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *
+ * (C) COPYRIGHT 2011-2015, 2018-2020 ARM Limited. All rights reserved.
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ *
*/
/*
diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.c b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.c
index 2ea901b..93a082a 100644
--- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.c
+++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
/*
*
* (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
@@ -19,6 +20,7 @@
* SPDX-License-Identifier: GPL-2.0
*
*/
+
#include <mali_kbase.h>
#include "debug/mali_kbase_debug_ktrace_internal.h"
#include "debug/backend/mali_kbase_debug_ktrace_csf.h"
@@ -28,30 +30,30 @@
void kbasep_ktrace_backend_format_header(char *buffer, int sz, s32 *written)
{
*written += MAX(snprintf(buffer + *written, MAX(sz - *written, 0),
- "group,slot,prio,csi"), 0);
+ "group,slot,prio,csi,kcpu"), 0);
}
void kbasep_ktrace_backend_format_msg(struct kbase_ktrace_msg *trace_msg,
char *buffer, int sz, s32 *written)
{
- const struct kbase_ktrace_backend * const be_msg = &trace_msg->backend;
+ const union kbase_ktrace_backend * const be_msg = &trace_msg->backend;
/* At present, no need to check for KBASE_KTRACE_FLAG_BACKEND, as the
* other backend-specific flags currently imply this anyway
*/
/* group parts */
- if (be_msg->flags & KBASE_KTRACE_FLAG_CSF_GROUP) {
- const s8 slot = be_msg->csg_nr;
+ if (be_msg->gpu.flags & KBASE_KTRACE_FLAG_CSF_GROUP) {
+ const s8 slot = be_msg->gpu.csg_nr;
/* group,slot, */
*written += MAX(snprintf(buffer + *written,
MAX(sz - *written, 0),
- "%u,%d,", be_msg->group_handle, slot), 0);
+ "%u,%d,", be_msg->gpu.group_handle, slot), 0);
/* prio */
if (slot >= 0)
*written += MAX(snprintf(buffer + *written,
MAX(sz - *written, 0),
- "%u", be_msg->slot_prio), 0);
+ "%u", be_msg->gpu.slot_prio), 0);
/* , */
*written += MAX(snprintf(buffer + *written,
@@ -65,10 +67,24 @@ void kbasep_ktrace_backend_format_msg(struct kbase_ktrace_msg *trace_msg,
}
/* queue parts: csi */
- if (trace_msg->backend.flags & KBASE_KTRACE_FLAG_CSF_QUEUE)
+ if (trace_msg->backend.gpu.flags & KBASE_KTRACE_FLAG_CSF_QUEUE)
+ *written += MAX(snprintf(buffer + *written,
+ MAX(sz - *written, 0),
+ "%d", be_msg->gpu.csi_index), 0);
+
+ /* , */
+ *written += MAX(snprintf(buffer + *written,
+ MAX(sz - *written, 0),
+ ","), 0);
+
+ if (be_msg->gpu.flags & KBASE_KTRACE_FLAG_CSF_KCPU) {
+ /* kcpu data */
*written += MAX(snprintf(buffer + *written,
MAX(sz - *written, 0),
- "%d", be_msg->csi_index), 0);
+ "kcpu %d (0x%llx)",
+ be_msg->kcpu.id,
+ be_msg->kcpu.extra_info_val), 0);
+ }
/* Don't end with a trailing "," - this is a 'standalone' formatted
* msg, caller will handle the delimiters
@@ -95,14 +111,14 @@ void kbasep_ktrace_add_csf(struct kbase_device *kbdev,
else if (queue)
kctx = queue->kctx;
- /* Fill the common part of the message (including backend.flags) */
+ /* Fill the common part of the message (including backend.gpu.flags) */
kbasep_ktrace_msg_init(&kbdev->ktrace, trace_msg, code, kctx, flags,
info_val);
/* Indicate to the common code that backend-specific parts will be
* valid
*/
- trace_msg->backend.flags |= KBASE_KTRACE_FLAG_BACKEND;
+ trace_msg->backend.gpu.flags |= KBASE_KTRACE_FLAG_BACKEND;
/* Fill the CSF-specific parts of the message
*
@@ -111,30 +127,66 @@ void kbasep_ktrace_add_csf(struct kbase_device *kbdev,
*/
if (queue) {
- trace_msg->backend.flags |= KBASE_KTRACE_FLAG_CSF_QUEUE;
- trace_msg->backend.csi_index = queue->csi_index;
+ trace_msg->backend.gpu.flags |= KBASE_KTRACE_FLAG_CSF_QUEUE;
+ trace_msg->backend.gpu.csi_index = queue->csi_index;
}
if (group) {
const s8 slot = group->csg_nr;
- trace_msg->backend.flags |= KBASE_KTRACE_FLAG_CSF_GROUP;
+ trace_msg->backend.gpu.flags |= KBASE_KTRACE_FLAG_CSF_GROUP;
- trace_msg->backend.csg_nr = slot;
+ trace_msg->backend.gpu.csg_nr = slot;
if (slot >= 0) {
- struct kbase_csf_csg_slot *csg_slot = &kbdev->csf.scheduler.csg_slots[slot];
+ struct kbase_csf_csg_slot *csg_slot =
+ &kbdev->csf.scheduler.csg_slots[slot];
- trace_msg->backend.slot_prio = csg_slot->priority;
+ trace_msg->backend.gpu.slot_prio =
+ csg_slot->priority;
}
/* slot >=0 indicates whether slot_prio valid, so no need to
* initialize in the case where it's invalid
*/
- trace_msg->backend.group_handle = group->handle;
+ trace_msg->backend.gpu.group_handle = group->handle;
}
- WARN_ON((trace_msg->backend.flags & ~KBASE_KTRACE_FLAG_ALL));
+ WARN_ON((trace_msg->backend.gpu.flags & ~KBASE_KTRACE_FLAG_ALL));
+
+ /* Done */
+ spin_unlock_irqrestore(&kbdev->ktrace.lock, irqflags);
+}
+
+void kbasep_ktrace_add_csf_kcpu(struct kbase_device *kbdev,
+ enum kbase_ktrace_code code,
+ struct kbase_kcpu_command_queue *queue,
+ u64 info_val1, u64 info_val2)
+{
+ unsigned long irqflags;
+ struct kbase_ktrace_msg *trace_msg;
+ struct kbase_context *kctx = queue->kctx;
+
+ spin_lock_irqsave(&kbdev->ktrace.lock, irqflags);
+
+ /* Reserve and update indices */
+ trace_msg = kbasep_ktrace_reserve(&kbdev->ktrace);
+
+ /* Fill the common part of the message */
+ kbasep_ktrace_msg_init(&kbdev->ktrace, trace_msg, code, kctx, 0,
+ info_val1);
+
+ /* Indicate to the common code that backend-specific parts will be
+ * valid
+ */
+ trace_msg->backend.gpu.flags |= KBASE_KTRACE_FLAG_BACKEND;
+
+ /* Fill the KCPU-specific parts of the message */
+ trace_msg->backend.kcpu.id = queue->id;
+ trace_msg->backend.kcpu.extra_info_val = info_val2;
+ trace_msg->backend.gpu.flags |= KBASE_KTRACE_FLAG_CSF_KCPU;
+
+ WARN_ON((trace_msg->backend.gpu.flags & ~KBASE_KTRACE_FLAG_ALL));
/* Done */
spin_unlock_irqrestore(&kbdev->ktrace.lock, irqflags);
diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.h b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.h
index 6c539b7..a229333 100644
--- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.h
+++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.h
@@ -1,6 +1,6 @@
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -18,6 +18,25 @@
*
* SPDX-License-Identifier: GPL-2.0
*
+ *//* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *
+ * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ *
*/
#ifndef _KBASE_DEBUG_KTRACE_CSF_H_
@@ -44,9 +63,33 @@ void kbasep_ktrace_add_csf(struct kbase_device *kbdev,
struct kbase_queue *queue, kbase_ktrace_flag_t flags,
u64 info_val);
+/**
+ * kbasep_ktrace_add_csf_kcpu - internal function to add trace about the CSF
+ * KCPU queues.
+ * @kbdev: kbase device
+ * @code: trace code
+ * @queue: queue, or NULL if no queue
+ * @info_val1: Main infoval variable with information based on the KCPU
+ * ktrace call. Refer to mali_kbase_debug_ktrace_codes_csf.h
+ * for information on the infoval values.
+ * @info_val2: Extra infoval variable with information based on the KCPU
+ * ktrace call. Refer to mali_kbase_debug_ktrace_codes_csf.h
+ * for information on the infoval values.
+ *
+ * PRIVATE: do not use directly. Use KBASE_KTRACE_ADD_CSF_KCPU() instead.
+ */
+void kbasep_ktrace_add_csf_kcpu(struct kbase_device *kbdev,
+ enum kbase_ktrace_code code,
+ struct kbase_kcpu_command_queue *queue,
+ u64 info_val1, u64 info_val2);
+
#define KBASE_KTRACE_RBUF_ADD_CSF(kbdev, code, group, queue, flags, info_val) \
kbasep_ktrace_add_csf(kbdev, KBASE_KTRACE_CODE(code), group, queue, \
- flags, info_val)
+ flags, info_val)
+
+#define KBASE_KTRACE_RBUF_ADD_CSF_KCPU(kbdev, code, queue, info_val1, \
+ info_val2) kbasep_ktrace_add_csf_kcpu(kbdev, KBASE_KTRACE_CODE(code), \
+ queue, info_val1, info_val2)
#else /* KBASE_KTRACE_TARGET_RBUF */
@@ -55,12 +98,21 @@ void kbasep_ktrace_add_csf(struct kbase_device *kbdev,
CSTD_UNUSED(kbdev);\
CSTD_NOP(code);\
CSTD_UNUSED(group);\
- CSTD_UNUSED(queue); \
+ CSTD_UNUSED(queue);\
CSTD_UNUSED(flags);\
CSTD_UNUSED(info_val);\
CSTD_NOP(0);\
} while (0)
+#define KBASE_KTRACE_RBUF_ADD_CSF_KCPU(kbdev, code, queue, info_val1, info_val2) \
+ do {\
+ CSTD_UNUSED(kbdev);\
+ CSTD_NOP(code);\
+ CSTD_UNUSED(queue);\
+ CSTD_UNUSED(info_val1);\
+ CSTD_UNUSED(info_val2);\
+ } while (0)
+
#endif /* KBASE_KTRACE_TARGET_RBUF */
/*
@@ -74,6 +126,9 @@ void kbasep_ktrace_add_csf(struct kbase_device *kbdev,
#define KBASE_KTRACE_FTRACE_ADD_CSF(kbdev, code, group, queue, info_val) \
trace_mali_##code(kbdev, group, queue, info_val)
+#define KBASE_KTRACE_FTRACE_ADD_KCPU(code, queue, info_val1, info_val2) \
+ trace_mali_##code(queue, info_val1, info_val2)
+
#else /* KBASE_KTRACE_TARGET_FTRACE */
#define KBASE_KTRACE_FTRACE_ADD_CSF(kbdev, code, group, queue, info_val) \
@@ -86,6 +141,14 @@ void kbasep_ktrace_add_csf(struct kbase_device *kbdev,
CSTD_NOP(0);\
} while (0)
+#define KBASE_KTRACE_FTRACE_ADD_KCPU(code, queue, info_val1, info_val2) \
+ do {\
+ CSTD_NOP(code);\
+ CSTD_UNUSED(queue);\
+ CSTD_UNUSED(info_val1);\
+ CSTD_UNUSED(info_val2);\
+ } while (0)
+
#endif /* KBASE_KTRACE_TARGET_FTRACE */
/*
@@ -108,7 +171,7 @@ void kbasep_ktrace_add_csf(struct kbase_device *kbdev,
*/
#define KBASE_KTRACE_ADD_CSF_GRP(kbdev, code, group, info_val) \
do { \
- /* capture values that could come from non-pure function calls */ \
+ /* capture values that could come from non-pure fn calls */ \
struct kbase_queue_group *__group = group; \
u64 __info_val = info_val; \
KBASE_KTRACE_RBUF_ADD_CSF(kbdev, code, __group, NULL, 0u, \
@@ -134,7 +197,7 @@ void kbasep_ktrace_add_csf(struct kbase_device *kbdev,
*/
#define KBASE_KTRACE_ADD_CSF_GRP_Q(kbdev, code, group, queue, info_val) \
do { \
- /* capture values that could come from non-pure function calls */ \
+ /* capture values that could come from non-pure fn calls */ \
struct kbase_queue_group *__group = group; \
struct kbase_queue *__queue = queue; \
u64 __info_val = info_val; \
@@ -144,4 +207,17 @@ void kbasep_ktrace_add_csf(struct kbase_device *kbdev,
__queue, __info_val); \
} while (0)
+
+#define KBASE_KTRACE_ADD_CSF_KCPU(kbdev, code, queue, info_val1, info_val2) \
+ do { \
+ /* capture values that could come from non-pure fn calls */ \
+ struct kbase_kcpu_command_queue *__queue = queue; \
+ u64 __info_val1 = info_val1; \
+ u64 __info_val2 = info_val2; \
+ KBASE_KTRACE_RBUF_ADD_CSF_KCPU(kbdev, code, __queue, \
+ __info_val1, __info_val2); \
+ KBASE_KTRACE_FTRACE_ADD_KCPU(code, __queue, \
+ __info_val1, __info_val2); \
+ } while (0)
+
#endif /* _KBASE_DEBUG_KTRACE_CSF_H_ */
diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_csf.h b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_csf.h
index 722b410..426218b 100644
--- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_csf.h
+++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_csf.h
@@ -1,6 +1,6 @@
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -18,6 +18,25 @@
*
* SPDX-License-Identifier: GPL-2.0
*
+ *//* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *
+ * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ *
*/
#ifndef _KBASE_DEBUG_KTRACE_DEFS_CSF_H_
@@ -38,9 +57,15 @@
* ftrace backend now outputs kctx field (as %d_%u format).
*
* Add fields group, slot, prio, csi into backend-specific part.
+ *
+ * 1.2:
+ * There is a new class of KCPU traces; with this, a new KCPU column in the
+ * ringbuffer RBUF (mali_trace) between csi and info_val, which is empty
+ * for non-kcpu related traces, and usually displays the KCPU Queue ID and
+ * an extra information value. ftrace also displays these KCPU traces.
*/
#define KBASE_KTRACE_VERSION_MAJOR 1
-#define KBASE_KTRACE_VERSION_MINOR 1
+#define KBASE_KTRACE_VERSION_MINOR 2
/* indicates if the trace message has valid queue-group related info. */
#define KBASE_KTRACE_FLAG_CSF_GROUP (((kbase_ktrace_flag_t)1) << 0)
@@ -48,37 +73,55 @@
/* indicates if the trace message has valid queue related info. */
#define KBASE_KTRACE_FLAG_CSF_QUEUE (((kbase_ktrace_flag_t)1) << 1)
+/* indicates if the trace message has valid KCPU-queue related info. */
+#define KBASE_KTRACE_FLAG_CSF_KCPU (((kbase_ktrace_flag_t)1) << 2)
+
/* Collect all the flags together for debug checking */
#define KBASE_KTRACE_FLAG_BACKEND_ALL \
- (KBASE_KTRACE_FLAG_CSF_GROUP | KBASE_KTRACE_FLAG_CSF_QUEUE)
+ (KBASE_KTRACE_FLAG_CSF_GROUP | KBASE_KTRACE_FLAG_CSF_QUEUE | \
+ KBASE_KTRACE_FLAG_CSF_KCPU)
/**
- * struct kbase_ktrace_backend - backend specific part of a trace message
- *
- * @code: Identifies the event, refer to enum kbase_ktrace_code.
- * @flags: indicates information about the trace message itself. Used
- * during dumping of the message.
- * @group_handle: Handle identifying the associated queue group. Only valid
- * when @flags contains KBASE_KTRACE_FLAG_CSF_GROUP.
- * @csg_nr: Number/index of the associated queue group's CS
- * group to which it is mapped, or negative if none associated.
- * Only valid when @flags contains KBASE_KTRACE_FLAG_CSF_GROUP.
- * @slot_prio: The priority of the slot for the associated group, if it was
- * scheduled. Hence, only valid when @csg_nr >=0 and @flags
- * contains KBASE_KTRACE_FLAG_CSF_GROUP.
- * @csi_index: ID of the associated queue's CS HW interface.
- * Only valid when @flags contains KBASE_KTRACE_FLAG_CSF_QUEUE.
+ * union kbase_ktrace_backend - backend specific part of a trace message
+ *
+ * @code: Identifies the event, refer to enum kbase_ktrace_code.
+ * @flags: indicates information about the trace message itself. Used
+ * during dumping of the message.
+ * @id: ID of the KCPU queue.
+ * @extra_info_val: value specific to the type of KCPU event being traced.
+ * Refer to the KPU specific code in enum kbase_ktrace_code in
+ * mali_kbase_debug_ktrace_codes_csf.h
+ * @group_handle: Handle identifying the associated queue group. Only valid
+ * when @flags contains KBASE_KTRACE_FLAG_CSF_GROUP.
+ * @csg_nr: Number/index of the associated queue group's CS
+ * group to which it is mapped, or negative if none associated.
+ * Only valid when @flags contains KBASE_KTRACE_FLAG_CSF_GROUP.
+ * @slot_prio: The priority of the slot for the associated group, if it was
+ * scheduled. Hence, only valid when @csg_nr >=0 and @flags
+ * contains KBASE_KTRACE_FLAG_CSF_GROUP.
+ * @csi_index: ID of the associated queue's CS HW interface.
+ * Only valid when @flags contains KBASE_KTRACE_FLAG_CSF_QUEUE.
*/
-struct kbase_ktrace_backend {
+
+union kbase_ktrace_backend {
/* Place 64 and 32-bit members together */
/* Pack smaller members together */
- kbase_ktrace_code_t code;
- kbase_ktrace_flag_t flags;
- u8 group_handle;
- s8 csg_nr;
- u8 slot_prio;
- s8 csi_index;
+ struct {
+ kbase_ktrace_code_t code;
+ kbase_ktrace_flag_t flags;
+ u8 id;
+ u64 extra_info_val;
+ } kcpu;
+
+ struct {
+ kbase_ktrace_code_t code;
+ kbase_ktrace_flag_t flags;
+ u8 group_handle;
+ s8 csg_nr;
+ u8 slot_prio;
+ s8 csi_index;
+ } gpu;
};
#endif /* KBASE_KTRACE_TARGET_RBUF */
diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_jm.h b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_jm.h
index ea8e01a..4b4cefc 100644
--- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_jm.h
+++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_jm.h
@@ -1,6 +1,6 @@
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -18,6 +18,25 @@
*
* SPDX-License-Identifier: GPL-2.0
*
+ *//* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *
+ * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ *
*/
#ifndef _KBASE_DEBUG_KTRACE_DEFS_JM_H_
@@ -71,7 +90,9 @@
| KBASE_KTRACE_FLAG_JM_ATOM)
/**
- * struct kbase_ktrace_backend - backend specific part of a trace message
+ * union kbase_ktrace_backend - backend specific part of a trace message
+ * Contains only a struct but is a union such that it is compatible with
+ * generic JM and CSF KTrace calls.
*
* @atom_udata: Copy of the user data sent for the atom in base_jd_submit.
* Only valid if KBASE_KTRACE_FLAG_JM_ATOM is set in @flags
@@ -86,16 +107,20 @@
* @refcount: reference count for the context, valid for certain events
* related to scheduler core and policy.
*/
-struct kbase_ktrace_backend {
- /* Place 64 and 32-bit members together */
- u64 atom_udata[2]; /* Only valid for KBASE_KTRACE_FLAG_JM_ATOM */
- u64 gpu_addr;
- int atom_number; /* Only valid for KBASE_KTRACE_FLAG_JM_ATOM */
- /* Pack smaller members together */
- kbase_ktrace_code_t code;
- kbase_ktrace_flag_t flags;
- u8 jobslot;
- u8 refcount;
+union kbase_ktrace_backend {
+ struct {
+ /* Place 64 and 32-bit members together */
+ u64 atom_udata[2]; /* Only valid for
+ * KBASE_KTRACE_FLAG_JM_ATOM
+ */
+ u64 gpu_addr;
+ int atom_number; /* Only valid for KBASE_KTRACE_FLAG_JM_ATOM */
+ /* Pack smaller members together */
+ kbase_ktrace_code_t code;
+ kbase_ktrace_flag_t flags;
+ u8 jobslot;
+ u8 refcount;
+ } gpu;
};
#endif /* KBASE_KTRACE_TARGET_RBUF */
diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.c b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.c
index 1b82128..55e4391 100644
--- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.c
+++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
/*
*
* (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
@@ -19,6 +20,7 @@
* SPDX-License-Identifier: GPL-2.0
*
*/
+
#include <mali_kbase.h>
#include "debug/mali_kbase_debug_ktrace_internal.h"
#include "debug/backend/mali_kbase_debug_ktrace_jm.h"
@@ -35,38 +37,39 @@ void kbasep_ktrace_backend_format_msg(struct kbase_ktrace_msg *trace_msg,
char *buffer, int sz, s32 *written)
{
/* katom */
- if (trace_msg->backend.flags & KBASE_KTRACE_FLAG_JM_ATOM)
+ if (trace_msg->backend.gpu.flags & KBASE_KTRACE_FLAG_JM_ATOM)
*written += MAX(snprintf(buffer + *written,
MAX(sz - *written, 0),
"atom %d (ud: 0x%llx 0x%llx)",
- trace_msg->backend.atom_number,
- trace_msg->backend.atom_udata[0],
- trace_msg->backend.atom_udata[1]), 0);
+ trace_msg->backend.gpu.atom_number,
+ trace_msg->backend.gpu.atom_udata[0],
+ trace_msg->backend.gpu.atom_udata[1]), 0);
/* gpu_addr */
- if (trace_msg->backend.flags & KBASE_KTRACE_FLAG_BACKEND)
+ if (trace_msg->backend.gpu.flags & KBASE_KTRACE_FLAG_BACKEND)
*written += MAX(snprintf(buffer + *written,
MAX(sz - *written, 0),
- ",%.8llx,", trace_msg->backend.gpu_addr), 0);
+ ",%.8llx,", trace_msg->backend.gpu.gpu_addr),
+ 0);
else
*written += MAX(snprintf(buffer + *written,
MAX(sz - *written, 0),
",,"), 0);
/* jobslot */
- if (trace_msg->backend.flags & KBASE_KTRACE_FLAG_JM_JOBSLOT)
+ if (trace_msg->backend.gpu.flags & KBASE_KTRACE_FLAG_JM_JOBSLOT)
*written += MAX(snprintf(buffer + *written,
MAX(sz - *written, 0),
- "%d", trace_msg->backend.jobslot), 0);
+ "%d", trace_msg->backend.gpu.jobslot), 0);
*written += MAX(snprintf(buffer + *written, MAX(sz - *written, 0),
","), 0);
/* refcount */
- if (trace_msg->backend.flags & KBASE_KTRACE_FLAG_JM_REFCOUNT)
+ if (trace_msg->backend.gpu.flags & KBASE_KTRACE_FLAG_JM_REFCOUNT)
*written += MAX(snprintf(buffer + *written,
MAX(sz - *written, 0),
- "%d", trace_msg->backend.refcount), 0);
+ "%d", trace_msg->backend.gpu.refcount), 0);
}
void kbasep_ktrace_add_jm(struct kbase_device *kbdev,
@@ -83,30 +86,31 @@ void kbasep_ktrace_add_jm(struct kbase_device *kbdev,
/* Reserve and update indices */
trace_msg = kbasep_ktrace_reserve(&kbdev->ktrace);
- /* Fill the common part of the message (including backend.flags) */
+ /* Fill the common part of the message (including backend.gpu.flags) */
kbasep_ktrace_msg_init(&kbdev->ktrace, trace_msg, code, kctx, flags,
info_val);
/* Indicate to the common code that backend-specific parts will be
* valid
*/
- trace_msg->backend.flags |= KBASE_KTRACE_FLAG_BACKEND;
+ trace_msg->backend.gpu.flags |= KBASE_KTRACE_FLAG_BACKEND;
/* Fill the JM-specific parts of the message */
if (katom) {
- trace_msg->backend.flags |= KBASE_KTRACE_FLAG_JM_ATOM;
+ trace_msg->backend.gpu.flags |= KBASE_KTRACE_FLAG_JM_ATOM;
- trace_msg->backend.atom_number = kbase_jd_atom_id(katom->kctx, katom);
- trace_msg->backend.atom_udata[0] = katom->udata.blob[0];
- trace_msg->backend.atom_udata[1] = katom->udata.blob[1];
+ trace_msg->backend.gpu.atom_number =
+ kbase_jd_atom_id(katom->kctx, katom);
+ trace_msg->backend.gpu.atom_udata[0] = katom->udata.blob[0];
+ trace_msg->backend.gpu.atom_udata[1] = katom->udata.blob[1];
}
- trace_msg->backend.gpu_addr = gpu_addr;
- trace_msg->backend.jobslot = jobslot;
+ trace_msg->backend.gpu.gpu_addr = gpu_addr;
+ trace_msg->backend.gpu.jobslot = jobslot;
/* Clamp refcount */
- trace_msg->backend.refcount = MIN((unsigned int)refcount, 0xFF);
+ trace_msg->backend.gpu.refcount = MIN((unsigned int)refcount, 0xFF);
- WARN_ON((trace_msg->backend.flags & ~KBASE_KTRACE_FLAG_ALL));
+ WARN_ON((trace_msg->backend.gpu.flags & ~KBASE_KTRACE_FLAG_ALL));
/* Done */
spin_unlock_irqrestore(&kbdev->ktrace.lock, irqflags);
diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.h b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.h
index bf258d6..43f5526 100644
--- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.h
+++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.h
@@ -1,6 +1,6 @@
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -18,6 +18,25 @@
*
* SPDX-License-Identifier: GPL-2.0
*
+ *//* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *
+ * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ *
*/
#ifndef _KBASE_DEBUG_KTRACE_JM_H_
diff --git a/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_csf.h b/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_csf.h
index d103e57..bb5db30 100644
--- a/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_csf.h
+++ b/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_csf.h
@@ -1,6 +1,6 @@
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -18,6 +18,25 @@
*
* SPDX-License-Identifier: GPL-2.0
*
+ *//* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *
+ * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ *
*/
/*
@@ -144,4 +163,50 @@ DEFINE_MALI_CSF_GRP_Q_EVENT(QUEUE_STOP);
#undef DEFINE_MALI_CSF_GRP_Q_EVENT
+/*
+ * KCPU queue events
+ */
+DECLARE_EVENT_CLASS(mali_csf_kcpu_queue_template,
+ TP_PROTO(struct kbase_kcpu_command_queue *queue,
+ u64 info_val1, u64 info_val2),
+ TP_ARGS(queue, info_val1, info_val2),
+ TP_STRUCT__entry(
+ __field(u64, info_val1)
+ __field(u64, info_val2)
+ __field(pid_t, kctx_tgid)
+ __field(u32, kctx_id)
+ __field(u8, id)
+ ),
+ TP_fast_assign(
+ {
+ __entry->info_val1 = info_val1;
+ __entry->info_val2 = info_val2;
+ __entry->kctx_id = queue->kctx->id;
+ __entry->kctx_tgid = queue->kctx->tgid;
+ __entry->id = queue->id;
+ }
+
+ ),
+ TP_printk("kctx=%d_%u id=%u info_val1=0x%llx info_val2=0x%llx",
+ __entry->kctx_tgid, __entry->kctx_id, __entry->id,
+ __entry->info_val1, __entry->info_val2)
+);
+
+#define DEFINE_MALI_CSF_KCPU_EVENT(name) \
+ DEFINE_EVENT(mali_csf_kcpu_queue_template, mali_##name, \
+ TP_PROTO(struct kbase_kcpu_command_queue *queue, \
+ u64 info_val1, u64 info_val2), \
+ TP_ARGS(queue, info_val1, info_val2))
+
+DEFINE_MALI_CSF_KCPU_EVENT(KCPU_QUEUE_NEW);
+DEFINE_MALI_CSF_KCPU_EVENT(KCPU_QUEUE_DESTROY);
+DEFINE_MALI_CSF_KCPU_EVENT(CQS_SET);
+DEFINE_MALI_CSF_KCPU_EVENT(CQS_WAIT_START);
+DEFINE_MALI_CSF_KCPU_EVENT(CQS_WAIT_END);
+DEFINE_MALI_CSF_KCPU_EVENT(FENCE_SIGNAL);
+DEFINE_MALI_CSF_KCPU_EVENT(FENCE_WAIT_START);
+DEFINE_MALI_CSF_KCPU_EVENT(FENCE_WAIT_END);
+
+#undef DEFINE_MALI_CSF_KCPU_EVENT
+
#endif /* !defined(_KBASE_DEBUG_LINUX_KTRACE_CSF_H_) || defined(TRACE_HEADER_MULTI_READ) */
diff --git a/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_jm.h b/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_jm.h
index 037b1ed..b0722f9 100644
--- a/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_jm.h
+++ b/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_jm.h
@@ -1,6 +1,6 @@
/*
*
- * (C) COPYRIGHT 2014,2018,2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -18,6 +18,25 @@
*
* SPDX-License-Identifier: GPL-2.0
*
+ *//* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *
+ * (C) COPYRIGHT 2014, 2018, 2020 ARM Limited. All rights reserved.
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ *
*/
/*
diff --git a/mali_kbase/debug/mali_kbase_debug_ktrace.c b/mali_kbase/debug/mali_kbase_debug_ktrace.c
index a13c0ba..a38a656 100644
--- a/mali_kbase/debug/mali_kbase_debug_ktrace.c
+++ b/mali_kbase/debug/mali_kbase_debug_ktrace.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
/*
*
* (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
@@ -19,6 +20,7 @@
* SPDX-License-Identifier: GPL-2.0
*
*/
+
#include <mali_kbase.h>
#include "debug/mali_kbase_debug_ktrace_internal.h"
@@ -93,7 +95,8 @@ static void kbasep_ktrace_format_msg(struct kbase_ktrace_msg *trace_msg,
(int)trace_msg->timestamp.tv_sec,
(int)(trace_msg->timestamp.tv_nsec / 1000),
trace_msg->thread_id, trace_msg->cpu,
- kbasep_ktrace_code_string[trace_msg->backend.code]), 0);
+ kbasep_ktrace_code_string[trace_msg->backend.gpu.code]),
+ 0);
/* kctx part: */
if (trace_msg->kctx_tgid) {
@@ -171,8 +174,8 @@ void kbasep_ktrace_msg_init(struct kbase_ktrace *ktrace,
trace_msg->kctx_id = 0;
}
trace_msg->info_val = info_val;
- trace_msg->backend.code = code;
- trace_msg->backend.flags = flags;
+ trace_msg->backend.gpu.code = code;
+ trace_msg->backend.gpu.flags = flags;
}
void kbasep_ktrace_add(struct kbase_device *kbdev, enum kbase_ktrace_code code,
@@ -189,7 +192,7 @@ void kbasep_ktrace_add(struct kbase_device *kbdev, enum kbase_ktrace_code code,
/* Reserve and update indices */
trace_msg = kbasep_ktrace_reserve(&kbdev->ktrace);
- /* Fill the common part of the message (including backend.flags) */
+ /* Fill the common part of the message (including backend.gpu.flags) */
kbasep_ktrace_msg_init(&kbdev->ktrace, trace_msg, code, kctx, flags,
info_val);
diff --git a/mali_kbase/debug/mali_kbase_debug_ktrace.h b/mali_kbase/debug/mali_kbase_debug_ktrace.h
index 7263e0c..71f0fd7 100644
--- a/mali_kbase/debug/mali_kbase_debug_ktrace.h
+++ b/mali_kbase/debug/mali_kbase_debug_ktrace.h
@@ -1,6 +1,6 @@
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -18,6 +18,25 @@
*
* SPDX-License-Identifier: GPL-2.0
*
+ *//* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *
+ * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ *
*/
/*
diff --git a/mali_kbase/debug/mali_kbase_debug_ktrace_codes.h b/mali_kbase/debug/mali_kbase_debug_ktrace_codes.h
index dd0ad06..fa842f9 100644
--- a/mali_kbase/debug/mali_kbase_debug_ktrace_codes.h
+++ b/mali_kbase/debug/mali_kbase_debug_ktrace_codes.h
@@ -1,6 +1,6 @@
/*
*
- * (C) COPYRIGHT 2011-2015,2018-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -18,6 +18,25 @@
*
* SPDX-License-Identifier: GPL-2.0
*
+ *//* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *
+ * (C) COPYRIGHT 2011-2015, 2018-2020 ARM Limited. All rights reserved.
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ *
*/
/*
@@ -146,7 +165,14 @@ int dummy_array[] = {
KBASE_KTRACE_CODE_MAKE_CODE(SCHED_RETAIN_CTX_NOLOCK),
/* info_val == kctx->refcount */
KBASE_KTRACE_CODE_MAKE_CODE(SCHED_RELEASE_CTX),
-
+#ifdef CONFIG_MALI_ARBITER_SUPPORT
+ /*
+ * Arbitration events
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(ARB_GPU_LOST),
+ KBASE_KTRACE_CODE_MAKE_CODE(ARB_VM_STATE),
+ KBASE_KTRACE_CODE_MAKE_CODE(ARB_VM_EVT),
+#endif
#if MALI_USE_CSF
#include "debug/backend/mali_kbase_debug_ktrace_codes_csf.h"
diff --git a/mali_kbase/debug/mali_kbase_debug_ktrace_defs.h b/mali_kbase/debug/mali_kbase_debug_ktrace_defs.h
index 3b7db2e..841f11b 100644
--- a/mali_kbase/debug/mali_kbase_debug_ktrace_defs.h
+++ b/mali_kbase/debug/mali_kbase_debug_ktrace_defs.h
@@ -1,6 +1,6 @@
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -18,6 +18,25 @@
*
* SPDX-License-Identifier: GPL-2.0
*
+ *//* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *
+ * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ *
*/
#ifndef _KBASE_DEBUG_KTRACE_DEFS_H_
@@ -78,12 +97,18 @@ typedef u8 kbase_ktrace_code_t;
*/
/*
- * struct kbase_ktrace_backend - backend specific part of a trace message
- *
- * At the very least, this must contain a kbase_ktrace_code_t 'code' member and
- * a kbase_ktrace_flag_t 'flags' member
+ * union kbase_ktrace_backend - backend specific part of a trace message.
+ * At the very least, this must contain a kbase_ktrace_code_t 'code' member
+ * and a kbase_ktrace_flag_t 'flags' inside a "gpu" sub-struct. Should a
+ * backend need several sub structs in its union to optimize the data storage
+ * for different message types, then it can use a "common initial sequence" to
+ * allow 'flags' and 'code' to pack optimally without corrupting them.
+ * Different backends need not share common initial sequences between them, they
+ * only need to ensure they have gpu.flags and gpu.code members, it
+ * is up to the backend then how to order these.
*/
-struct kbase_ktrace_backend;
+union kbase_ktrace_backend;
+
#endif /* KBASE_KTRACE_TARGET_RBUF */
#if MALI_USE_CSF
@@ -145,9 +170,9 @@ enum kbase_ktrace_code {
* @kctx_id: Unique identifier of the &kbase_context associated with the
* message. Only valid if @kctx_tgid != 0.
* @info_val: value specific to the type of event being traced. Refer to the
- * specific code in enum kbase_ktrace_code
+ * specific code in enum kbase_ktrace_code.
* @backend: backend-specific trace information. All backends must implement
- * a minimum common set of members
+ * a minimum common set of members.
*/
struct kbase_ktrace_msg {
struct timespec64 timestamp;
@@ -156,8 +181,7 @@ struct kbase_ktrace_msg {
pid_t kctx_tgid;
u32 kctx_id;
u64 info_val;
-
- struct kbase_ktrace_backend backend;
+ union kbase_ktrace_backend backend;
};
struct kbase_ktrace {
diff --git a/mali_kbase/debug/mali_kbase_debug_ktrace_internal.h b/mali_kbase/debug/mali_kbase_debug_ktrace_internal.h
index e450760..02b90ab 100644
--- a/mali_kbase/debug/mali_kbase_debug_ktrace_internal.h
+++ b/mali_kbase/debug/mali_kbase_debug_ktrace_internal.h
@@ -1,6 +1,6 @@
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -18,6 +18,25 @@
*
* SPDX-License-Identifier: GPL-2.0
*
+ *//* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *
+ * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ *
*/
#ifndef _KBASE_DEBUG_KTRACE_INTERNAL_H_
diff --git a/mali_kbase/debug/mali_kbase_debug_linux_ktrace.h b/mali_kbase/debug/mali_kbase_debug_linux_ktrace.h
index a7310eb..86efdc4 100644
--- a/mali_kbase/debug/mali_kbase_debug_linux_ktrace.h
+++ b/mali_kbase/debug/mali_kbase_debug_linux_ktrace.h
@@ -1,6 +1,6 @@
/*
*
- * (C) COPYRIGHT 2014,2018,2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -18,6 +18,25 @@
*
* SPDX-License-Identifier: GPL-2.0
*
+ *//* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *
+ * (C) COPYRIGHT 2014, 2018, 2020 ARM Limited. All rights reserved.
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ *
*/
/*
@@ -98,7 +117,13 @@ DEFINE_MALI_ADD_EVENT(PM_CONTEXT_IDLE);
DEFINE_MALI_ADD_EVENT(PM_WAKE_WAITERS);
DEFINE_MALI_ADD_EVENT(SCHED_RETAIN_CTX_NOLOCK);
DEFINE_MALI_ADD_EVENT(SCHED_RELEASE_CTX);
+#ifdef CONFIG_MALI_ARBITER_SUPPORT
+DEFINE_MALI_ADD_EVENT(ARB_GPU_LOST);
+DEFINE_MALI_ADD_EVENT(ARB_VM_STATE);
+DEFINE_MALI_ADD_EVENT(ARB_VM_EVT);
+
+#endif
#if MALI_USE_CSF
#include "mali_kbase_debug_linux_ktrace_csf.h"
#else