From 1543e317f1da31b75942316931e8f491a8920811 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Thu, 04 Jan 2024 10:08:02 +0000
Subject: [PATCH] disable FB
---
kernel/drivers/gpu/arm/bifrost/csf/mali_kbase_csf_tl_reader.c | 121 ++++-----------------------------------
1 files changed, 14 insertions(+), 107 deletions(-)
diff --git a/kernel/drivers/gpu/arm/bifrost/csf/mali_kbase_csf_tl_reader.c b/kernel/drivers/gpu/arm/bifrost/csf/mali_kbase_csf_tl_reader.c
index 1824c2d..6859d65 100644
--- a/kernel/drivers/gpu/arm/bifrost/csf/mali_kbase_csf_tl_reader.c
+++ b/kernel/drivers/gpu/arm/bifrost/csf/mali_kbase_csf_tl_reader.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
/*
*
- * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2023 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
@@ -31,17 +31,11 @@
#include "mali_kbase_pm.h"
#include "mali_kbase_hwaccess_time.h"
-#include <linux/gcd.h>
#include <linux/math64.h>
-#include <asm/arch_timer.h>
#if IS_ENABLED(CONFIG_DEBUG_FS)
#include "tl/mali_kbase_timeline_priv.h"
#include <linux/debugfs.h>
-
-#if (KERNEL_VERSION(4, 7, 0) > LINUX_VERSION_CODE)
-#define DEFINE_DEBUGFS_ATTRIBUTE DEFINE_SIMPLE_ATTRIBUTE
-#endif
#endif
/* Name of the CSFFW timeline tracebuffer. */
@@ -80,9 +74,8 @@
struct kbase_device *kbdev = (struct kbase_device *)data;
struct kbase_csf_tl_reader *self = &kbdev->timeline->csf_tl_reader;
- if (val > KBASE_CSF_TL_READ_INTERVAL_MAX || val < KBASE_CSF_TL_READ_INTERVAL_MIN) {
+ if (val > KBASE_CSF_TL_READ_INTERVAL_MAX || val < KBASE_CSF_TL_READ_INTERVAL_MIN)
return -EINVAL;
- }
self->timer_interval = (u32)val;
@@ -93,92 +86,13 @@
kbase_csf_tl_debugfs_poll_interval_read,
kbase_csf_tl_debugfs_poll_interval_write, "%llu\n");
-
void kbase_csf_tl_reader_debugfs_init(struct kbase_device *kbdev)
{
- debugfs_create_file("csf_tl_poll_interval_in_ms", S_IRUGO | S_IWUSR,
+ debugfs_create_file("csf_tl_poll_interval_in_ms", 0644,
kbdev->debugfs_instr_directory, kbdev,
&kbase_csf_tl_poll_interval_fops);
-
}
#endif
-
-/**
- * get_cpu_gpu_time() - Get current CPU and GPU timestamps.
- *
- * @kbdev: Kbase device.
- * @cpu_ts: Output CPU timestamp.
- * @gpu_ts: Output GPU timestamp.
- * @gpu_cycle: Output GPU cycle counts.
- */
-static void get_cpu_gpu_time(
- struct kbase_device *kbdev,
- u64 *cpu_ts,
- u64 *gpu_ts,
- u64 *gpu_cycle)
-{
- struct timespec64 ts;
-
- kbase_pm_context_active(kbdev);
- kbase_backend_get_gpu_time(kbdev, gpu_cycle, gpu_ts, &ts);
- kbase_pm_context_idle(kbdev);
-
- if (cpu_ts)
- *cpu_ts = ts.tv_sec * NSEC_PER_SEC + ts.tv_nsec;
-}
-
-
-/**
- * kbase_ts_converter_init() - Initialize system timestamp converter.
- *
- * @self: System Timestamp Converter instance.
- * @kbdev: Kbase device pointer
- *
- * Return: Zero on success, -1 otherwise.
- */
-static int kbase_ts_converter_init(
- struct kbase_ts_converter *self,
- struct kbase_device *kbdev)
-{
- u64 cpu_ts = 0;
- u64 gpu_ts = 0;
- u64 freq;
- u64 common_factor;
-
- get_cpu_gpu_time(kbdev, &cpu_ts, &gpu_ts, NULL);
- freq = arch_timer_get_cntfrq();
-
- if (!freq) {
- dev_warn(kbdev->dev, "arch_timer_get_rate() is zero!");
- return -1;
- }
-
- common_factor = gcd(NSEC_PER_SEC, freq);
-
- self->multiplier = div64_u64(NSEC_PER_SEC, common_factor);
- self->divisor = div64_u64(freq, common_factor);
- self->offset =
- cpu_ts - div64_u64(gpu_ts * self->multiplier, self->divisor);
-
- return 0;
-}
-
-/**
- * kbase_ts_converter_convert() - Convert GPU timestamp to CPU timestamp.
- *
- * @self: System Timestamp Converter instance.
- * @gpu_ts: System timestamp value to converter.
- *
- * Return: The CPU timestamp.
- */
-static void kbase_ts_converter_convert(
- const struct kbase_ts_converter *self,
- u64 *gpu_ts)
-{
- u64 old_gpu_ts = *gpu_ts;
- *gpu_ts = div64_u64(old_gpu_ts * self->multiplier,
- self->divisor) + self->offset;
-}
/**
* tl_reader_overflow_notify() - Emit stream overflow tracepoint.
@@ -301,7 +215,7 @@
dev_warn(
kbdev->dev,
"Unable to parse CSFFW tracebuffer event header.");
- ret = -EBUSY;
+ ret = -EBUSY;
break;
}
@@ -322,7 +236,7 @@
dev_warn(kbdev->dev,
"event_id: %u, can't read with event_size: %u.",
event_id, event_size);
- ret = -EBUSY;
+ ret = -EBUSY;
break;
}
@@ -330,9 +244,8 @@
{
struct kbase_csffw_tl_message *msg =
(struct kbase_csffw_tl_message *) csffw_data_it;
- kbase_ts_converter_convert(
- &self->ts_converter,
- &msg->timestamp);
+ msg->timestamp =
+ kbase_backend_time_convert_gpu_to_cpu(kbdev, msg->timestamp);
}
/* Copy the message out to the tl_stream. */
@@ -406,10 +319,6 @@
return -1;
}
- if (kbase_ts_converter_init(&self->ts_converter, kbdev)) {
- return -1;
- }
-
self->kbdev = kbdev;
self->trace_buffer = tb;
self->tl_header.data = hdr;
@@ -477,7 +386,14 @@
return 0;
if (tl_reader_init_late(self, kbdev)) {
+#if IS_ENABLED(CONFIG_MALI_BIFROST_NO_MALI)
+ dev_warn(
+ kbdev->dev,
+ "CSFFW timeline is not available for MALI_BIFROST_NO_MALI builds!");
+ return 0;
+#else
return -EINVAL;
+#endif
}
tl_reader_reset(self);
@@ -521,14 +437,5 @@
void kbase_csf_tl_reader_reset(struct kbase_csf_tl_reader *self)
{
- u64 gpu_cycle = 0;
- struct kbase_device *kbdev = self->kbdev;
-
- if (!kbdev)
- return;
-
kbase_csf_tl_reader_flush_buffer(self);
-
- get_cpu_gpu_time(kbdev, NULL, NULL, &gpu_cycle);
- KBASE_TLSTREAM_TL_KBASE_CSFFW_RESET(kbdev, gpu_cycle);
}
--
Gitblit v1.6.2