summaryrefslogtreecommitdiff
path: root/mali_kbase/device/backend/mali_kbase_device_csf.c
diff options
context:
space:
mode:
Diffstat (limited to 'mali_kbase/device/backend/mali_kbase_device_csf.c')
-rw-r--r--mali_kbase/device/backend/mali_kbase_device_csf.c121
1 files changed, 64 insertions, 57 deletions
diff --git a/mali_kbase/device/backend/mali_kbase_device_csf.c b/mali_kbase/device/backend/mali_kbase_device_csf.c
index 5325658..571761f 100644
--- a/mali_kbase/device/backend/mali_kbase_device_csf.c
+++ b/mali_kbase/device/backend/mali_kbase_device_csf.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
/*
*
- * (C) COPYRIGHT 2019-2022 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
@@ -23,26 +23,27 @@
#include <device/mali_kbase_device.h>
#include <mali_kbase_hwaccess_backend.h>
-#include <mali_kbase_hwcnt_backend_csf_if_fw.h>
-#include <mali_kbase_hwcnt_watchdog_if_timer.h>
+#include <hwcnt/backend/mali_kbase_hwcnt_backend_csf_if_fw.h>
+#include <hwcnt/mali_kbase_hwcnt_watchdog_if_timer.h>
#include <mali_kbase_ctx_sched.h>
#include <mali_kbase_reset_gpu.h>
#include <csf/mali_kbase_csf.h>
#include <csf/ipa_control/mali_kbase_csf_ipa_control.h>
-
-#if IS_ENABLED(CONFIG_MALI_NO_MALI)
#include <backend/gpu/mali_kbase_model_linux.h>
-#endif
#include <mali_kbase.h>
#include <backend/gpu/mali_kbase_irq_internal.h>
#include <backend/gpu/mali_kbase_pm_internal.h>
-#include <backend/gpu/mali_kbase_js_internal.h>
#include <backend/gpu/mali_kbase_clk_rate_trace_mgr.h>
#include <csf/mali_kbase_csf_csg_debugfs.h>
-#include <mali_kbase_hwcnt_virtualizer.h>
+#include <csf/mali_kbase_csf_kcpu_fence_debugfs.h>
+#include <hwcnt/mali_kbase_hwcnt_virtualizer.h>
#include <mali_kbase_kinstr_prfcnt.h>
#include <mali_kbase_vinstr.h>
+#include <tl/mali_kbase_timeline.h>
+#if IS_ENABLED(CONFIG_MALI_TRACE_POWER_GPU_WORK_PERIOD)
+#include <mali_kbase_gpu_metrics.h>
+#endif
/**
* kbase_device_firmware_hwcnt_term - Terminate CSF firmware and HWC
@@ -60,7 +61,7 @@ static void kbase_device_firmware_hwcnt_term(struct kbase_device *kbdev)
kbase_vinstr_term(kbdev->vinstr_ctx);
kbase_hwcnt_virtualizer_term(kbdev->hwcnt_gpu_virt);
kbase_hwcnt_backend_csf_metadata_term(&kbdev->hwcnt_gpu_iface);
- kbase_csf_firmware_term(kbdev);
+ kbase_csf_firmware_unload_term(kbdev);
}
}
@@ -86,18 +87,14 @@ static int kbase_backend_late_init(struct kbase_device *kbdev)
if (err)
goto fail_pm_powerup;
- err = kbase_backend_timer_init(kbdev);
- if (err)
- goto fail_timer;
-
#ifdef CONFIG_MALI_DEBUG
-#ifndef CONFIG_MALI_NO_MALI
+#if IS_ENABLED(CONFIG_MALI_REAL_HW)
if (kbasep_common_test_interrupt_handlers(kbdev) != 0) {
dev_err(kbdev->dev, "Interrupt assignment check failed.\n");
err = -EINVAL;
goto fail_interrupt_test;
}
-#endif /* !CONFIG_MALI_NO_MALI */
+#endif /* IS_ENABLED(CONFIG_MALI_REAL_HW) */
#endif /* CONFIG_MALI_DEBUG */
kbase_ipa_control_init(kbdev);
@@ -141,13 +138,11 @@ fail_pm_metrics_init:
kbase_ipa_control_term(kbdev);
#ifdef CONFIG_MALI_DEBUG
-#ifndef CONFIG_MALI_NO_MALI
+#if IS_ENABLED(CONFIG_MALI_REAL_HW)
fail_interrupt_test:
-#endif /* !CONFIG_MALI_NO_MALI */
+#endif /* IS_ENABLED(CONFIG_MALI_REAL_HW) */
#endif /* CONFIG_MALI_DEBUG */
- kbase_backend_timer_term(kbdev);
-fail_timer:
kbase_pm_context_idle(kbdev);
kbase_hwaccess_pm_halt(kbdev);
fail_pm_powerup:
@@ -191,12 +186,26 @@ static int kbase_csf_early_init(struct kbase_device *kbdev)
}
/**
- * kbase_csf_early_init - Early termination for firmware & scheduler.
+ * kbase_csf_early_term() - Early termination for firmware & scheduler.
* @kbdev: Device pointer
*/
static void kbase_csf_early_term(struct kbase_device *kbdev)
{
kbase_csf_scheduler_early_term(kbdev);
+ kbase_csf_firmware_early_term(kbdev);
+}
+
+/**
+ * kbase_csf_late_init - late initialization for firmware.
+ * @kbdev: Device pointer
+ *
+ * Return: 0 on success, error code otherwise.
+ */
+static int kbase_csf_late_init(struct kbase_device *kbdev)
+{
+ int err = kbase_csf_firmware_late_init(kbdev);
+
+ return err;
}
/**
@@ -268,60 +277,55 @@ static void kbase_device_hwcnt_backend_csf_term(struct kbase_device *kbdev)
}
static const struct kbase_device_init dev_init[] = {
-#if IS_ENABLED(CONFIG_MALI_NO_MALI)
- { kbase_gpu_device_create, kbase_gpu_device_destroy,
- "Dummy model initialization failed" },
-#else
+#if !IS_ENABLED(CONFIG_MALI_REAL_HW)
+ { kbase_gpu_device_create, kbase_gpu_device_destroy, "Dummy model initialization failed" },
+#else /* !IS_ENABLED(CONFIG_MALI_REAL_HW) */
{ assign_irqs, NULL, "IRQ search failed" },
+#endif /* !IS_ENABLED(CONFIG_MALI_REAL_HW) */
+#if !IS_ENABLED(CONFIG_MALI_NO_MALI)
{ registers_map, registers_unmap, "Register map failed" },
-#endif
- { power_control_init, power_control_term,
- "Power control initialization failed" },
+#endif /* !IS_ENABLED(CONFIG_MALI_NO_MALI) */
+#if IS_ENABLED(CONFIG_MALI_TRACE_POWER_GPU_WORK_PERIOD)
+ { kbase_gpu_metrics_init, kbase_gpu_metrics_term, "GPU metrics initialization failed" },
+#endif /* IS_ENABLED(CONFIG_MALI_TRACE_POWER_GPU_WORK_PERIOD) */
+ { power_control_init, power_control_term, "Power control initialization failed" },
{ kbase_device_io_history_init, kbase_device_io_history_term,
"Register access history initialization failed" },
- { kbase_device_early_init, kbase_device_early_term,
- "Early device initialization failed" },
- { kbase_device_populate_max_freq, NULL,
- "Populating max frequency failed" },
+ { kbase_device_early_init, kbase_device_early_term, "Early device initialization failed" },
+ { kbase_backend_time_init, NULL, "Time backend initialization failed" },
{ kbase_device_misc_init, kbase_device_misc_term,
"Miscellaneous device initialization failed" },
{ kbase_device_pcm_dev_init, kbase_device_pcm_dev_term,
"Priority control manager initialization failed" },
- { kbase_ctx_sched_init, kbase_ctx_sched_term,
- "Context scheduler initialization failed" },
- { kbase_mem_init, kbase_mem_term,
- "Memory subsystem initialization failed" },
+ { kbase_ctx_sched_init, kbase_ctx_sched_term, "Context scheduler initialization failed" },
+ { kbase_mem_init, kbase_mem_term, "Memory subsystem initialization failed" },
{ kbase_csf_protected_memory_init, kbase_csf_protected_memory_term,
"Protected memory allocator initialization failed" },
{ kbase_device_coherency_init, NULL, "Device coherency init failed" },
{ kbase_protected_mode_init, kbase_protected_mode_term,
"Protected mode subsystem initialization failed" },
- { kbase_device_list_init, kbase_device_list_term,
- "Device list setup failed" },
+ { kbase_device_list_init, kbase_device_list_term, "Device list setup failed" },
{ kbase_device_timeline_init, kbase_device_timeline_term,
"Timeline stream initialization failed" },
{ kbase_clk_rate_trace_manager_init, kbase_clk_rate_trace_manager_term,
"Clock rate trace manager initialization failed" },
- { kbase_lowest_gpu_freq_init, NULL,
- "Lowest freq initialization failed" },
- { kbase_device_hwcnt_watchdog_if_init,
- kbase_device_hwcnt_watchdog_if_term,
+ { kbase_device_hwcnt_watchdog_if_init, kbase_device_hwcnt_watchdog_if_term,
"GPU hwcnt backend watchdog interface creation failed" },
- { kbase_device_hwcnt_backend_csf_if_init,
- kbase_device_hwcnt_backend_csf_if_term,
+ { kbase_device_hwcnt_backend_csf_if_init, kbase_device_hwcnt_backend_csf_if_term,
"GPU hwcnt backend CSF interface creation failed" },
- { kbase_device_hwcnt_backend_csf_init,
- kbase_device_hwcnt_backend_csf_term,
+ { kbase_device_hwcnt_backend_csf_init, kbase_device_hwcnt_backend_csf_term,
"GPU hwcnt backend creation failed" },
{ kbase_device_hwcnt_context_init, kbase_device_hwcnt_context_term,
"GPU hwcnt context initialization failed" },
- { kbase_backend_late_init, kbase_backend_late_term,
- "Late backend initialization failed" },
- { kbase_csf_early_init, kbase_csf_early_term,
- "Early CSF initialization failed" },
+ { kbase_csf_early_init, kbase_csf_early_term, "Early CSF initialization failed" },
+ { kbase_backend_late_init, kbase_backend_late_term, "Late backend initialization failed" },
+ { kbase_csf_late_init, NULL, "Late CSF initialization failed" },
{ NULL, kbase_device_firmware_hwcnt_term, NULL },
- { kbase_device_debugfs_init, kbase_device_debugfs_term,
- "DebugFS initialization failed" },
+ { kbase_debug_csf_fault_init, kbase_debug_csf_fault_term,
+ "CSF fault debug initialization failed" },
+ { kbase_device_debugfs_init, kbase_device_debugfs_term, "DebugFS initialization failed" },
+ { kbase_csf_fence_timer_debugfs_init, kbase_csf_fence_timer_debugfs_term,
+ "Fence timeout DebugFS initialization failed" },
/* Sysfs init needs to happen before registering the device with
* misc_register(), otherwise it causes a race condition between
* registering the device and a uevent event being generated for
@@ -339,8 +343,11 @@ static const struct kbase_device_init dev_init[] = {
"Misc device registration failed" },
{ kbase_gpuprops_populate_user_buffer, kbase_gpuprops_free_user_buffer,
"GPU property population failed" },
- { kbase_device_late_init, kbase_device_late_term,
- "Late device initialization failed" },
+ { kbase_device_late_init, kbase_device_late_term, "Late device initialization failed" },
+#if IS_ENABLED(CONFIG_MALI_CORESIGHT)
+ { kbase_debug_coresight_csf_init, kbase_debug_coresight_csf_term,
+ "Coresight initialization failed" },
+#endif /* IS_ENABLED(CONFIG_MALI_CORESIGHT) */
};
static void kbase_device_term_partial(struct kbase_device *kbdev,
@@ -354,7 +361,6 @@ static void kbase_device_term_partial(struct kbase_device *kbdev,
void kbase_device_term(struct kbase_device *kbdev)
{
- kbdev->csf.mali_file_inode = NULL;
kbase_device_term_partial(kbdev, ARRAY_SIZE(dev_init));
kbase_mem_halt(kbdev);
}
@@ -468,7 +474,7 @@ static int kbase_csf_firmware_deferred_init(struct kbase_device *kbdev)
lockdep_assert_held(&kbdev->fw_load_lock);
- err = kbase_csf_firmware_init(kbdev);
+ err = kbase_csf_firmware_load_init(kbdev);
if (!err) {
unsigned long flags;
@@ -498,11 +504,12 @@ int kbase_device_firmware_init_once(struct kbase_device *kbdev)
ret = kbase_device_hwcnt_csf_deferred_init(kbdev);
if (ret) {
- kbase_csf_firmware_term(kbdev);
+ kbase_csf_firmware_unload_term(kbdev);
goto out;
}
kbase_csf_debugfs_init(kbdev);
+ kbase_timeline_io_debugfs_init(kbdev);
out:
kbase_pm_context_idle(kbdev);
}
@@ -511,4 +518,4 @@ out:
return ret;
}
-KBASE_EXPORT_TEST_API(kbase_device_firmware_init_once);
+KBASE_EXPORT_TEST_API(kbase_device_firmware_init_once); \ No newline at end of file