summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mali_kbase/mali_kbase_core_linux.c5
-rw-r--r--mali_kbase/platform/pixel/pixel_gpu_dvfs.c38
-rw-r--r--mali_kbase/platform/pixel/pixel_gpu_power.c38
-rw-r--r--mali_kbase/platform/pixel/pixel_gpu_sscd.c16
4 files changed, 47 insertions, 50 deletions
diff --git a/mali_kbase/mali_kbase_core_linux.c b/mali_kbase/mali_kbase_core_linux.c
index b54b805..52f53a9 100644
--- a/mali_kbase/mali_kbase_core_linux.c
+++ b/mali_kbase/mali_kbase_core_linux.c
@@ -6141,6 +6141,11 @@ static int kbase_platform_device_probe(struct platform_device *pdev)
struct kbase_device *kbdev;
int err = 0;
+#if IS_ENABLED(CONFIG_GOOGLE_BCL)
+ if (!google_retrieve_bcl_handle())
+ return -EPROBE_DEFER;
+#endif
+
mali_kbase_print_cs_experimental();
kbdev = kbase_device_alloc();
diff --git a/mali_kbase/platform/pixel/pixel_gpu_dvfs.c b/mali_kbase/platform/pixel/pixel_gpu_dvfs.c
index 08e65ff..c72ee67 100644
--- a/mali_kbase/platform/pixel/pixel_gpu_dvfs.c
+++ b/mali_kbase/platform/pixel/pixel_gpu_dvfs.c
@@ -883,6 +883,31 @@ static int gpu_dvfs_set_initial_level(struct kbase_device *kbdev)
return ret;
}
+#if IS_ENABLED(CONFIG_GOOGLE_BCL)
+static int google_bcl_callback(struct notifier_block *nb, unsigned long max_clk, void *data) {
+ struct pixel_context *pc = container_of(nb, struct pixel_context, pm.qos_nb);
+ struct kbase_device *kbdev = pc->kbdev;
+ int max_level = -1;
+ int level;
+
+ CSTD_UNUSED(data);
+
+ // Find the throttling level that satisfies the requested maximum clock frequency.
+ for (level = 0; level < pc->dvfs.table_size; level++) {
+ max_level = level;
+ if (pc->dvfs.table[level].clk[GPU_DVFS_CLK_SHADERS] <= max_clk)
+ break;
+ }
+
+ mutex_lock(&pc->dvfs.lock);
+ gpu_dvfs_update_level_lock(kbdev, GPU_DVFS_LEVEL_LOCK_BCL, -1, max_level);
+ gpu_dvfs_select_level(kbdev);
+ mutex_unlock(&pc->dvfs.lock);
+
+ return NOTIFY_OK;
+}
+#endif /* CONFIG_GOOGLE_BCL */
+
/**
* gpu_dvfs_init() - Initializes the Pixel GPU DVFS system.
*
@@ -1019,6 +1044,13 @@ int gpu_dvfs_init(struct kbase_device *kbdev)
pc->dvfs.clockdown_wq = create_singlethread_workqueue("gpu-dvfs-clockdown");
INIT_DELAYED_WORK(&pc->dvfs.clockdown_work, gpu_dvfs_clockdown_worker);
+#if IS_ENABLED(CONFIG_GOOGLE_BCL)
+ pc->pm.bcl_dev = google_retrieve_bcl_handle();
+ if (pc->pm.bcl_dev) {
+ pc->pm.qos_nb.notifier_call = google_bcl_callback;
+ exynos_pm_qos_add_notifier(PM_QOS_GPU_FREQ_MAX, &pc->pm.qos_nb);
+ }
+#endif
/* Initialization was successful */
goto done;
@@ -1055,7 +1087,11 @@ void gpu_dvfs_term(struct kbase_device *kbdev)
cancel_work_sync(&pc->dvfs.control_work);
destroy_workqueue(pc->dvfs.control_wq);
-
+#if IS_ENABLED(CONFIG_GOOGLE_BCL)
+ if (pc->pm.bcl_dev) {
+ exynos_pm_qos_remove_notifier(PM_QOS_GPU_FREQ_MAX, &pc->pm.qos_nb);
+ }
+#endif
#ifdef CONFIG_MALI_PIXEL_GPU_THERMAL
gpu_tmu_term(kbdev);
#endif /* CONFIG_MALI_PIXEL_GPU_THERMAL */
diff --git a/mali_kbase/platform/pixel/pixel_gpu_power.c b/mali_kbase/platform/pixel/pixel_gpu_power.c
index 1cd0673..c4b5892 100644
--- a/mali_kbase/platform/pixel/pixel_gpu_power.c
+++ b/mali_kbase/platform/pixel/pixel_gpu_power.c
@@ -730,31 +730,6 @@ bool gpu_pm_get_power_state(struct kbase_device *kbdev)
return ret;
}
-#if IS_ENABLED(CONFIG_GOOGLE_BCL)
-static int google_bcl_callback(struct notifier_block *nb, unsigned long max_clk, void *data) {
- struct pixel_context *pc = container_of(nb, struct pixel_context, pm.qos_nb);
- struct kbase_device *kbdev = pc->kbdev;
- int max_level = -1;
- int level;
-
- CSTD_UNUSED(data);
-
- // Find the throttling level that satisfies the requested maximum clock frequency.
- for (level = 0; level < pc->dvfs.table_size; level++) {
- max_level = level;
- if (pc->dvfs.table[level].clk[GPU_DVFS_CLK_SHADERS] <= max_clk)
- break;
- }
-
- mutex_lock(&pc->dvfs.lock);
- gpu_dvfs_update_level_lock(kbdev, GPU_DVFS_LEVEL_LOCK_BCL, -1, max_level);
- gpu_dvfs_select_level(kbdev);
- mutex_unlock(&pc->dvfs.lock);
-
- return NOTIFY_OK;
-}
-#endif /* CONFIG_GOOGLE_BCL */
-
/**
* gpu_pm_init() - Initializes power management control for a GPU.
*
@@ -884,14 +859,6 @@ int gpu_pm_init(struct kbase_device *kbdev)
return -ENODEV;
}
-#if IS_ENABLED(CONFIG_GOOGLE_BCL)
- pc->pm.bcl_dev = google_retrieve_bcl_handle();
- if (pc->pm.bcl_dev) {
- pc->pm.qos_nb.notifier_call = google_bcl_callback;
- exynos_pm_qos_add_notifier(PM_QOS_GPU_FREQ_MAX, &pc->pm.qos_nb);
- }
-#endif
-
pc->pm.rail_state_log = gpu_pm_rail_state_log_init(kbdev);
return 0;
@@ -916,11 +883,6 @@ void gpu_pm_term(struct kbase_device *kbdev)
gpu_pm_rail_state_log_term(pc->pm.rail_state_log);
-#if IS_ENABLED(CONFIG_GOOGLE_BCL)
- if (pc->pm.bcl_dev) {
- exynos_pm_qos_remove_notifier(PM_QOS_GPU_FREQ_MAX, &pc->pm.qos_nb);
- }
-#endif
for (i = 0; i < GPU_PM_DOMAIN_COUNT; i++) {
if (pc->pm.domain_devs[i]) {
diff --git a/mali_kbase/platform/pixel/pixel_gpu_sscd.c b/mali_kbase/platform/pixel/pixel_gpu_sscd.c
index ed1f973..ba38c53 100644
--- a/mali_kbase/platform/pixel/pixel_gpu_sscd.c
+++ b/mali_kbase/platform/pixel/pixel_gpu_sscd.c
@@ -553,7 +553,8 @@ static void segments_term(struct kbase_device *kbdev, struct sscd_segment* segme
kfree(segments[PM_EVENT_LOG].addr);
kfree(segments[KTRACE].addr);
#if MALI_USE_CSF
- pixel_context_snapshot_term(segments);
+ pixel_context_snapshot_term(&segments[CONTEXTS]);
+ kfree(segments[FW_CORE_DUMP].addr);
#endif
/* Null out the pointers */
memset(segments, 0, sizeof(struct sscd_segment) * NUM_SEGMENTS);
@@ -578,9 +579,6 @@ void gpu_sscd_dump(struct kbase_device *kbdev, const char* reason)
unsigned long flags, current_ts = jiffies;
struct pixel_gpu_pdc_status pdc_status;
static unsigned long last_hang_sscd_ts;
-#if MALI_USE_CSF
- int fwcd_err;
-#endif
if (!strcmp(reason, "GPU hang")) {
/* GPU hang - avoid multiple coredumps for the same hang until
@@ -603,12 +601,6 @@ void gpu_sscd_dump(struct kbase_device *kbdev, const char* reason)
return;
}
-#if MALI_USE_CSF
- fwcd_err = fw_core_dump_create(kbdev);
- if (fwcd_err)
- dev_err(kbdev->dev, "pixel: failed to create firmware core dump (%d)", fwcd_err);
-#endif
-
ec = segments_init(kbdev, segs);
if (ec != 0) {
dev_err(kbdev->dev,
@@ -649,8 +641,10 @@ void gpu_sscd_dump(struct kbase_device *kbdev, const char* reason)
"could not collect active contexts: rc: %i", ec);
}
- if (!fwcd_err)
+ if (!strcmp(reason, "Internal firmware error"))
get_and_init_fw_core_dump(kbdev, &segs[FW_CORE_DUMP]);
+ else
+ dev_warn(kbdev->dev, "pixel: sscd: skipping FW core");
#endif
spin_unlock_irqrestore(&kbdev->hwaccess_lock, flags);