summaryrefslogtreecommitdiff
path: root/mali_kbase/tl
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/tl
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/tl')
-rw-r--r--mali_kbase/tl/backend/mali_kbase_timeline_csf.c7
-rw-r--r--mali_kbase/tl/backend/mali_kbase_timeline_jm.c11
-rw-r--r--mali_kbase/tl/mali_kbase_timeline.c83
-rw-r--r--mali_kbase/tl/mali_kbase_timeline.h45
-rw-r--r--mali_kbase/tl/mali_kbase_timeline_io.c1
-rw-r--r--mali_kbase/tl/mali_kbase_timeline_priv.h25
-rw-r--r--mali_kbase/tl/mali_kbase_tl_serialize.h21
-rw-r--r--mali_kbase/tl/mali_kbase_tlstream.c10
-rw-r--r--mali_kbase/tl/mali_kbase_tlstream.h21
-rw-r--r--mali_kbase/tl/mali_kbase_tracepoints.c60
-rw-r--r--mali_kbase/tl/mali_kbase_tracepoints.h68
11 files changed, 329 insertions, 23 deletions
diff --git a/mali_kbase/tl/backend/mali_kbase_timeline_csf.c b/mali_kbase/tl/backend/mali_kbase_timeline_csf.c
index abaa6bb..476214d 100644
--- a/mali_kbase/tl/backend/mali_kbase_timeline_csf.c
+++ b/mali_kbase/tl/backend/mali_kbase_timeline_csf.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
/*
*
* (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
@@ -60,7 +61,7 @@ void kbase_create_timeline_objects(struct kbase_device *kbdev)
/* Lock the context list, to ensure no changes to the list are made
* while we're summarizing the contexts and their contents.
*/
- mutex_lock(&kbdev->kctx_list_lock);
+ mutex_lock(&timeline->tl_kctx_list_lock);
/* Hold the scheduler lock while we emit the current state
* We also need to continue holding the lock until after the first body
@@ -90,7 +91,7 @@ void kbase_create_timeline_objects(struct kbase_device *kbdev)
mutex_unlock(&kbdev->csf.scheduler.lock);
/* For each context in the device... */
- list_for_each_entry(kctx, &kbdev->kctx_list, kctx_list_link) {
+ list_for_each_entry(kctx, &timeline->tl_kctx_list, tl_kctx_list_node) {
size_t i;
struct kbase_tlstream *body =
&timeline->streams[TL_STREAM_TYPE_OBJ];
@@ -162,7 +163,7 @@ void kbase_create_timeline_objects(struct kbase_device *kbdev)
*/
};
- mutex_unlock(&kbdev->kctx_list_lock);
+ mutex_unlock(&timeline->tl_kctx_list_lock);
/* Static object are placed into summary packet that needs to be
* transmitted first. Flush all streams to make it available to
diff --git a/mali_kbase/tl/backend/mali_kbase_timeline_jm.c b/mali_kbase/tl/backend/mali_kbase_timeline_jm.c
index c368ac7..4babd1e 100644
--- a/mali_kbase/tl/backend/mali_kbase_timeline_jm.c
+++ b/mali_kbase/tl/backend/mali_kbase_timeline_jm.c
@@ -1,6 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2019 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-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
@@ -66,10 +67,10 @@ void kbase_create_timeline_objects(struct kbase_device *kbdev)
/* Lock the context list, to ensure no changes to the list are made
* while we're summarizing the contexts and their contents.
*/
- mutex_lock(&kbdev->kctx_list_lock);
+ mutex_lock(&timeline->tl_kctx_list_lock);
/* For each context in the device... */
- list_for_each_entry(kctx, &kbdev->kctx_list, kctx_list_link) {
+ list_for_each_entry(kctx, &timeline->tl_kctx_list, tl_kctx_list_node) {
/* Summarize the context itself */
__kbase_tlstream_tl_new_ctx(summary,
kctx,
@@ -87,11 +88,11 @@ void kbase_create_timeline_objects(struct kbase_device *kbdev)
*/
kbase_timeline_streams_body_reset(timeline);
- mutex_unlock(&kbdev->kctx_list_lock);
+ mutex_unlock(&timeline->tl_kctx_list_lock);
/* Static object are placed into summary packet that needs to be
* transmitted first. Flush all streams to make it available to
* user space.
*/
kbase_timeline_streams_flush(timeline);
-} \ No newline at end of file
+}
diff --git a/mali_kbase/tl/mali_kbase_timeline.c b/mali_kbase/tl/mali_kbase_timeline.c
index 8ebc075..98185e9 100644
--- a/mali_kbase/tl/mali_kbase_timeline.c
+++ b/mali_kbase/tl/mali_kbase_timeline.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
/*
*
* (C) COPYRIGHT 2015-2020 ARM Limited. All rights reserved.
@@ -116,7 +117,7 @@ int kbase_timeline_init(struct kbase_timeline **timeline,
if (!timeline || !timeline_flags)
return -EINVAL;
- result = kzalloc(sizeof(*result), GFP_KERNEL);
+ result = vzalloc(sizeof(*result));
if (!result)
return -ENOMEM;
@@ -128,6 +129,10 @@ int kbase_timeline_init(struct kbase_timeline **timeline,
kbase_tlstream_init(&result->streams[i], i,
&result->event_queue);
+ /* Initialize the kctx list */
+ mutex_init(&result->tl_kctx_list_lock);
+ INIT_LIST_HEAD(&result->tl_kctx_list);
+
/* Initialize autoflush timer. */
atomic_set(&result->autoflush_timer_active, 0);
kbase_timer_setup(&result->autoflush_timer,
@@ -154,10 +159,12 @@ void kbase_timeline_term(struct kbase_timeline *timeline)
kbase_csf_tl_reader_term(&timeline->csf_tl_reader);
#endif
+ WARN_ON(!list_empty(&timeline->tl_kctx_list));
+
for (i = (enum tl_stream_type)0; i < TL_STREAM_TYPE_COUNT; i++)
kbase_tlstream_term(&timeline->streams[i]);
- kfree(timeline);
+ vfree(timeline);
}
#ifdef CONFIG_MALI_DEVFREQ
@@ -172,11 +179,7 @@ static void kbase_tlstream_current_devfreq_target(struct kbase_device *kbdev)
unsigned long cur_freq = 0;
mutex_lock(&devfreq->lock);
-#if KERNEL_VERSION(4, 3, 0) > LINUX_VERSION_CODE
- cur_freq = kbdev->current_nominal_freq;
-#else
cur_freq = devfreq->last_status.current_frequency;
-#endif
KBASE_TLSTREAM_AUX_DEVFREQ_TARGET(kbdev, (u64)cur_freq);
mutex_unlock(&devfreq->lock);
}
@@ -288,6 +291,74 @@ void kbase_timeline_streams_body_reset(struct kbase_timeline *timeline)
#endif
}
+void kbase_timeline_pre_kbase_context_destroy(struct kbase_context *kctx)
+{
+ struct kbase_device *const kbdev = kctx->kbdev;
+ struct kbase_timeline *timeline = kbdev->timeline;
+
+ /* Remove the context from the list to ensure we don't try and
+ * summarize a context that is being destroyed.
+ *
+ * It's unsafe to try and summarize a context being destroyed as the
+ * locks we might normally attempt to acquire, and the data structures
+ * we would normally attempt to traverse could already be destroyed.
+ *
+ * In the case where the tlstream is acquired between this pre destroy
+ * call and the post destroy call, we will get a context destroy
+ * tracepoint without the corresponding context create tracepoint,
+ * but this will not affect the correctness of the object model.
+ */
+ mutex_lock(&timeline->tl_kctx_list_lock);
+ list_del_init(&kctx->tl_kctx_list_node);
+ mutex_unlock(&timeline->tl_kctx_list_lock);
+}
+
+void kbase_timeline_post_kbase_context_create(struct kbase_context *kctx)
+{
+ struct kbase_device *const kbdev = kctx->kbdev;
+ struct kbase_timeline *timeline = kbdev->timeline;
+
+ /* On context create, add the context to the list to ensure it is
+ * summarized when timeline is acquired
+ */
+ mutex_lock(&timeline->tl_kctx_list_lock);
+
+ list_add(&kctx->tl_kctx_list_node, &timeline->tl_kctx_list);
+
+ /* Fire the tracepoints with the lock held to ensure the tracepoints
+ * are either fired before or after the summarization,
+ * never in parallel with it. If fired in parallel, we could get
+ * duplicate creation tracepoints.
+ */
+#if MALI_USE_CSF
+ KBASE_TLSTREAM_TL_KBASE_NEW_CTX(
+ kbdev, kctx->id, kbdev->gpu_props.props.raw_props.gpu_id);
+#endif
+ /* Trace with the AOM tracepoint even in CSF for dumping */
+ KBASE_TLSTREAM_TL_NEW_CTX(kbdev, kctx, kctx->id, 0);
+
+ mutex_unlock(&timeline->tl_kctx_list_lock);
+}
+
+void kbase_timeline_post_kbase_context_destroy(struct kbase_context *kctx)
+{
+ struct kbase_device *const kbdev = kctx->kbdev;
+
+ /* Trace with the AOM tracepoint even in CSF for dumping */
+ KBASE_TLSTREAM_TL_DEL_CTX(kbdev, kctx);
+#if MALI_USE_CSF
+ KBASE_TLSTREAM_TL_KBASE_DEL_CTX(kbdev, kctx->id);
+#endif
+
+ /* Flush the timeline stream, so the user can see the termination
+ * tracepoints being fired.
+ * The "if" statement below is for optimization. It is safe to call
+ * kbase_timeline_streams_flush when timeline is disabled.
+ */
+ if (atomic_read(&kbdev->timeline_flags) != 0)
+ kbase_timeline_streams_flush(kbdev->timeline);
+}
+
#if MALI_UNIT_TEST
void kbase_timeline_stats(struct kbase_timeline *timeline,
u32 *bytes_collected, u32 *bytes_generated)
diff --git a/mali_kbase/tl/mali_kbase_timeline.h b/mali_kbase/tl/mali_kbase_timeline.h
index cd48411..ea75a69 100644
--- a/mali_kbase/tl/mali_kbase_timeline.h
+++ b/mali_kbase/tl/mali_kbase_timeline.h
@@ -1,6 +1,6 @@
/*
*
- * (C) COPYRIGHT 2015-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 2015-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.
+ *
*/
#if !defined(_KBASE_TIMELINE_H)
@@ -81,6 +100,30 @@ void kbase_timeline_streams_flush(struct kbase_timeline *timeline);
*/
void kbase_timeline_streams_body_reset(struct kbase_timeline *timeline);
+/**
+ * kbase_timeline_post_kbase_context_create - Inform timeline that a new KBase
+ * Context has been created.
+ * @kctx: KBase Context
+ */
+void kbase_timeline_post_kbase_context_create(struct kbase_context *kctx);
+
+/**
+ * kbase_timeline_pre_kbase_context_destroy - Inform timeline that a KBase
+ * Context is about to be destroyed.
+ * @kctx: KBase Context
+ */
+void kbase_timeline_pre_kbase_context_destroy(struct kbase_context *kctx);
+
+/**
+ * kbase_timeline_post_kbase_context_destroy - Inform timeline that a KBase
+ * Context has been destroyed.
+ * @kctx: KBase Context
+ *
+ * Should be called immediately before the memory is freed, and the context ID
+ * and kbdev pointer should still be valid.
+ */
+void kbase_timeline_post_kbase_context_destroy(struct kbase_context *kctx);
+
#if MALI_UNIT_TEST
/**
* kbase_timeline_test - start timeline stream data generator
diff --git a/mali_kbase/tl/mali_kbase_timeline_io.c b/mali_kbase/tl/mali_kbase_timeline_io.c
index 724f5fa..a6d02b9 100644
--- a/mali_kbase/tl/mali_kbase_timeline_io.c
+++ b/mali_kbase/tl/mali_kbase_timeline_io.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
/*
*
* (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
diff --git a/mali_kbase/tl/mali_kbase_timeline_priv.h b/mali_kbase/tl/mali_kbase_timeline_priv.h
index 35eec46..d305bb3 100644
--- a/mali_kbase/tl/mali_kbase_timeline_priv.h
+++ b/mali_kbase/tl/mali_kbase_timeline_priv.h
@@ -1,6 +1,6 @@
/*
*
- * (C) COPYRIGHT 2019-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 2019-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.
+ *
*/
#if !defined(_KBASE_TIMELINE_PRIV_H)
@@ -38,6 +57,8 @@
/**
* struct kbase_timeline - timeline state structure
* @streams: The timeline streams generated by kernel
+ * @tl_kctx_list: List of contexts for timeline.
+ * @tl_kctx_list_lock: Lock to protect @tl_kctx_list.
* @autoflush_timer: Autoflush timer
* @autoflush_timer_active: If non-zero autoflush timer is active
* @reader_lock: Reader lock. Only one reader is allowed to
@@ -51,6 +72,8 @@
*/
struct kbase_timeline {
struct kbase_tlstream streams[TL_STREAM_TYPE_COUNT];
+ struct list_head tl_kctx_list;
+ struct mutex tl_kctx_list_lock;
struct timer_list autoflush_timer;
atomic_t autoflush_timer_active;
struct mutex reader_lock;
diff --git a/mali_kbase/tl/mali_kbase_tl_serialize.h b/mali_kbase/tl/mali_kbase_tl_serialize.h
index 3e37827..78aee83 100644
--- a/mali_kbase/tl/mali_kbase_tl_serialize.h
+++ b/mali_kbase/tl/mali_kbase_tl_serialize.h
@@ -1,6 +1,6 @@
/*
*
- * (C) COPYRIGHT 2019-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 2019-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.
+ *
*/
#if !defined(_KBASE_TL_SERIALIZE_H)
diff --git a/mali_kbase/tl/mali_kbase_tlstream.c b/mali_kbase/tl/mali_kbase_tlstream.c
index f4239cf..b682ecd 100644
--- a/mali_kbase/tl/mali_kbase_tlstream.c
+++ b/mali_kbase/tl/mali_kbase_tlstream.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
/*
*
* (C) COPYRIGHT 2015-2020 ARM Limited. All rights reserved.
@@ -149,12 +150,12 @@ void kbase_tlstream_init(
unsigned int i;
KBASE_DEBUG_ASSERT(stream);
- KBASE_DEBUG_ASSERT(TL_STREAM_TYPE_COUNT > stream_type);
+ KBASE_DEBUG_ASSERT(stream_type < TL_STREAM_TYPE_COUNT);
spin_lock_init(&stream->lock);
/* All packets carrying tracepoints shall be numbered. */
- if (TL_PACKET_TYPE_BODY == tl_stream_cfg[stream_type].pkt_type)
+ if (tl_stream_cfg[stream_type].pkt_type == TL_PACKET_TYPE_BODY)
stream->numbered = 1;
else
stream->numbered = 0;
@@ -217,7 +218,8 @@ static size_t kbasep_tlstream_msgbuf_submit(
/* Increasing write buffer index will expose this packet to the reader.
* As stream->lock is not taken on reader side we must make sure memory
- * is updated correctly before this will happen. */
+ * is updated correctly before this will happen.
+ */
smp_wmb();
atomic_inc(&stream->wbi);
@@ -251,7 +253,7 @@ char *kbase_tlstream_msgbuf_acquire(
wb_size = atomic_read(&stream->buffer[wb_idx].size);
/* Select next buffer if data will not fit into current one. */
- if (PACKET_SIZE < wb_size + msg_size) {
+ if (wb_size + msg_size > PACKET_SIZE) {
wb_size = kbasep_tlstream_msgbuf_submit(
stream, wb_idx_raw, wb_size);
wb_idx = (wb_idx_raw + 1) % PACKET_COUNT;
diff --git a/mali_kbase/tl/mali_kbase_tlstream.h b/mali_kbase/tl/mali_kbase_tlstream.h
index faf88d6..4ad4ad1 100644
--- a/mali_kbase/tl/mali_kbase_tlstream.h
+++ b/mali_kbase/tl/mali_kbase_tlstream.h
@@ -1,6 +1,6 @@
/*
*
- * (C) COPYRIGHT 2015-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 2015-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.
+ *
*/
#if !defined(_KBASE_TLSTREAM_H)
diff --git a/mali_kbase/tl/mali_kbase_tracepoints.c b/mali_kbase/tl/mali_kbase_tracepoints.c
index 0502c0d..9a2d7db 100644
--- a/mali_kbase/tl/mali_kbase_tracepoints.c
+++ b/mali_kbase/tl/mali_kbase_tracepoints.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
/*
*
* (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved.
@@ -135,6 +136,7 @@ enum tl_msg_id_aux {
KBASE_AUX_PROTECTED_LEAVE_START,
KBASE_AUX_PROTECTED_LEAVE_END,
KBASE_AUX_JIT_STATS,
+ KBASE_AUX_TILER_HEAP_STATS,
KBASE_AUX_EVENT_JOB_SLOT,
KBASE_AUX_MSG_COUNT,
};
@@ -541,6 +543,10 @@ const size_t obj_desc_header_size = sizeof(__obj_desc_header);
"per-bin JIT statistics", \
"@IIIIII", \
"ctx_nr,bid,max_allocs,allocs,va_pages,ph_pages") \
+ TRACEPOINT_DESC(KBASE_AUX_TILER_HEAP_STATS, \
+ "Tiler Heap statistics", \
+ "@ILIIIIIII", \
+ "ctx_nr,heap_id,va_pages,ph_pages,max_chunks,chunk_size,chunk_count,target_in_flight,nr_in_flight") \
TRACEPOINT_DESC(KBASE_AUX_EVENT_JOB_SLOT, \
"event on a given job slot", \
"@pIII", \
@@ -1817,6 +1823,60 @@ void __kbase_tlstream_aux_jit_stats(
kbase_tlstream_msgbuf_release(stream, acq_flags);
}
+void __kbase_tlstream_aux_tiler_heap_stats(
+ struct kbase_tlstream *stream,
+ u32 ctx_nr,
+ u64 heap_id,
+ u32 va_pages,
+ u32 ph_pages,
+ u32 max_chunks,
+ u32 chunk_size,
+ u32 chunk_count,
+ u32 target_in_flight,
+ u32 nr_in_flight)
+{
+ const u32 msg_id = KBASE_AUX_TILER_HEAP_STATS;
+ const size_t msg_size = sizeof(msg_id) + sizeof(u64)
+ + sizeof(ctx_nr)
+ + sizeof(heap_id)
+ + sizeof(va_pages)
+ + sizeof(ph_pages)
+ + sizeof(max_chunks)
+ + sizeof(chunk_size)
+ + sizeof(chunk_count)
+ + sizeof(target_in_flight)
+ + sizeof(nr_in_flight)
+ ;
+ char *buffer;
+ unsigned long acq_flags;
+ size_t pos = 0;
+
+ buffer = kbase_tlstream_msgbuf_acquire(stream, msg_size, &acq_flags);
+
+ pos = kbasep_serialize_bytes(buffer, pos, &msg_id, sizeof(msg_id));
+ pos = kbasep_serialize_timestamp(buffer, pos);
+ pos = kbasep_serialize_bytes(buffer,
+ pos, &ctx_nr, sizeof(ctx_nr));
+ pos = kbasep_serialize_bytes(buffer,
+ pos, &heap_id, sizeof(heap_id));
+ pos = kbasep_serialize_bytes(buffer,
+ pos, &va_pages, sizeof(va_pages));
+ pos = kbasep_serialize_bytes(buffer,
+ pos, &ph_pages, sizeof(ph_pages));
+ pos = kbasep_serialize_bytes(buffer,
+ pos, &max_chunks, sizeof(max_chunks));
+ pos = kbasep_serialize_bytes(buffer,
+ pos, &chunk_size, sizeof(chunk_size));
+ pos = kbasep_serialize_bytes(buffer,
+ pos, &chunk_count, sizeof(chunk_count));
+ pos = kbasep_serialize_bytes(buffer,
+ pos, &target_in_flight, sizeof(target_in_flight));
+ pos = kbasep_serialize_bytes(buffer,
+ pos, &nr_in_flight, sizeof(nr_in_flight));
+
+ kbase_tlstream_msgbuf_release(stream, acq_flags);
+}
+
void __kbase_tlstream_aux_event_job_slot(
struct kbase_tlstream *stream,
const void *ctx,
diff --git a/mali_kbase/tl/mali_kbase_tracepoints.h b/mali_kbase/tl/mali_kbase_tracepoints.h
index 3cd94e2..844bdf4 100644
--- a/mali_kbase/tl/mali_kbase_tracepoints.h
+++ b/mali_kbase/tl/mali_kbase_tracepoints.h
@@ -1,6 +1,6 @@
/*
*
- * (C) COPYRIGHT 2010-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 2010-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.
+ *
*/
/*
@@ -277,6 +296,17 @@ void __kbase_tlstream_aux_jit_stats(
u32 allocs,
u32 va_pages,
u32 ph_pages);
+void __kbase_tlstream_aux_tiler_heap_stats(
+ struct kbase_tlstream *stream,
+ u32 ctx_nr,
+ u64 heap_id,
+ u32 va_pages,
+ u32 ph_pages,
+ u32 max_chunks,
+ u32 chunk_size,
+ u32 chunk_count,
+ u32 target_in_flight,
+ u32 nr_in_flight);
void __kbase_tlstream_aux_event_job_slot(
struct kbase_tlstream *stream,
const void *ctx,
@@ -1500,6 +1530,42 @@ struct kbase_tlstream;
} while (0)
/**
+ * KBASE_TLSTREAM_AUX_TILER_HEAP_STATS -
+ * Tiler Heap statistics
+ *
+ * @kbdev: Kbase device
+ * @ctx_nr: Kernel context number
+ * @heap_id: Unique id used to represent a heap under a context
+ * @va_pages: Number of virtual pages allocated in this bin
+ * @ph_pages: Number of physical pages allocated in this bin
+ * @max_chunks: The maximum number of chunks that the heap should be allowed to use
+ * @chunk_size: Size of each chunk in tiler heap, in bytes
+ * @chunk_count: The number of chunks currently allocated in the tiler heap
+ * @target_in_flight: Number of render-passes that the driver should attempt
+ * to keep in flight for which allocation of new chunks is allowed
+ * @nr_in_flight: Number of render-passes that are in flight
+ */
+#define KBASE_TLSTREAM_AUX_TILER_HEAP_STATS( \
+ kbdev, \
+ ctx_nr, \
+ heap_id, \
+ va_pages, \
+ ph_pages, \
+ max_chunks, \
+ chunk_size, \
+ chunk_count, \
+ target_in_flight, \
+ nr_in_flight \
+ ) \
+ do { \
+ int enabled = atomic_read(&kbdev->timeline_flags); \
+ if (enabled & TLSTREAM_ENABLED) \
+ __kbase_tlstream_aux_tiler_heap_stats( \
+ __TL_DISPATCH_STREAM(kbdev, aux), \
+ ctx_nr, heap_id, va_pages, ph_pages, max_chunks, chunk_size, chunk_count, target_in_flight, nr_in_flight); \
+ } while (0)
+
+/**
* KBASE_TLSTREAM_AUX_EVENT_JOB_SLOT -
* event on a given job slot
*