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/arbiter/mali_kbase_arbiter_pm.c |   71 ++++++++++++++++++-----------------
 1 files changed, 36 insertions(+), 35 deletions(-)

diff --git a/kernel/drivers/gpu/arm/bifrost/arbiter/mali_kbase_arbiter_pm.c b/kernel/drivers/gpu/arm/bifrost/arbiter/mali_kbase_arbiter_pm.c
index 5c75686..667552c 100644
--- a/kernel/drivers/gpu/arm/bifrost/arbiter/mali_kbase_arbiter_pm.c
+++ b/kernel/drivers/gpu/arm/bifrost/arbiter/mali_kbase_arbiter_pm.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-2022 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
@@ -20,15 +20,12 @@
  */
 
 /**
- * @file
- * Mali arbiter power manager state machine and APIs
+ * DOC: Mali arbiter power manager state machine and APIs
  */
 
 #include <mali_kbase.h>
 #include <mali_kbase_pm.h>
-#include <mali_kbase_hwaccess_jm.h>
 #include <backend/gpu/mali_kbase_irq_internal.h>
-#include <mali_kbase_hwcnt_context.h>
 #include <backend/gpu/mali_kbase_pm_internal.h>
 #include <tl/mali_kbase_tracepoints.h>
 #include <mali_kbase_gpuprops.h>
@@ -319,6 +316,7 @@
 	if (kbdev->arb.arb_if) {
 		kbase_arbif_gpu_request(kbdev);
 		dev_dbg(kbdev->dev, "Waiting for initial GPU assignment...\n");
+
 		err = wait_event_timeout(arb_vm_state->vm_state_wait,
 			arb_vm_state->vm_state ==
 					KBASE_VM_STATE_INITIALIZING_WITH_GPU,
@@ -328,8 +326,9 @@
 			dev_dbg(kbdev->dev,
 			"Kbase probe Deferred after waiting %d ms to receive GPU_GRANT\n",
 			gpu_req_timeout);
-			err = -EPROBE_DEFER;
-			goto arbif_eprobe_defer;
+
+			err = -ENODEV;
+			goto arbif_timeout;
 		}
 
 		dev_dbg(kbdev->dev,
@@ -337,9 +336,10 @@
 	}
 	return 0;
 
-arbif_eprobe_defer:
+arbif_timeout:
 	kbase_arbiter_pm_early_term(kbdev);
 	return err;
+
 arbif_init_fail:
 	destroy_workqueue(arb_vm_state->vm_arb_wq);
 	kfree(arb_vm_state);
@@ -394,6 +394,8 @@
  * @kbdev: The kbase device structure for the device (must be a valid pointer)
  *
  * Install interrupts and set the interrupt_install flag to true.
+ *
+ * Return: 0 if success, or a Linux error code
  */
 int kbase_arbiter_pm_install_interrupts(struct kbase_device *kbdev)
 {
@@ -924,6 +926,8 @@
  * @kbdev: The kbase device structure for the device (must be a valid pointer)
  *
  * Checks if the virtual machine holds VM state lock.
+ *
+ * Return: true if GPU is assigned, else false.
  */
 static inline bool kbase_arbiter_pm_vm_gpu_assigned_lockheld(
 	struct kbase_device *kbdev)
@@ -951,7 +955,6 @@
 int kbase_arbiter_pm_ctx_active_handle_suspend(struct kbase_device *kbdev,
 	enum kbase_pm_suspend_handler suspend_handler)
 {
-	struct kbasep_js_device_data *js_devdata = &kbdev->js_data;
 	struct kbase_arbiter_vm_state *arb_vm_state = kbdev->pm.arb_vm_state;
 	int res = 0;
 
@@ -1004,11 +1007,9 @@
 			/* Need to synchronously wait for GPU assignment */
 			atomic_inc(&kbdev->pm.gpu_users_waiting);
 			mutex_unlock(&arb_vm_state->vm_state_lock);
-			mutex_unlock(&kbdev->pm.lock);
-			mutex_unlock(&js_devdata->runpool_mutex);
+			kbase_pm_unlock(kbdev);
 			kbase_arbiter_pm_vm_wait_gpu_assignment(kbdev);
-			mutex_lock(&js_devdata->runpool_mutex);
-			mutex_lock(&kbdev->pm.lock);
+			kbase_pm_lock(kbdev);
 			mutex_lock(&arb_vm_state->vm_state_lock);
 			atomic_dec(&kbdev->pm.gpu_users_waiting);
 		}
@@ -1020,8 +1021,8 @@
 /**
  * kbase_arbiter_pm_update_gpu_freq() - Updates GPU clock frequency received
  * from arbiter.
- * @arb_freq - Pointer to struchture holding GPU clock frequenecy data
- * @freq - New frequency value in KHz
+ * @arb_freq: Pointer to struchture holding GPU clock frequenecy data
+ * @freq: New frequency value in KHz
  */
 void kbase_arbiter_pm_update_gpu_freq(struct kbase_arbiter_freq *arb_freq,
 	uint32_t freq)
@@ -1030,8 +1031,8 @@
 
 	mutex_lock(&arb_freq->arb_freq_lock);
 	if (arb_freq->arb_freq != freq) {
-		ndata.new_rate = freq * KHZ_TO_HZ;
-		ndata.old_rate = arb_freq->arb_freq * KHZ_TO_HZ;
+		ndata.new_rate = (unsigned long)freq * KHZ_TO_HZ;
+		ndata.old_rate = (unsigned long)arb_freq->arb_freq * KHZ_TO_HZ;
 		ndata.gpu_clk_handle = arb_freq;
 		arb_freq->arb_freq = freq;
 		arb_freq->freq_updated = true;
@@ -1044,14 +1045,14 @@
 }
 
 /**
- * enumerate_arb_gpu_clk() - Enumerate a GPU clock on the given index
- * @kbdev - kbase_device pointer
- * @index - GPU clock index
+ * get_arb_gpu_clk() - Enumerate a GPU clock on the given index
+ * @kbdev: kbase_device pointer
+ * @index: GPU clock index
  *
- * Returns pointer to structure holding GPU clock frequency data reported from
+ * Return: Pointer to structure holding GPU clock frequency data reported from
  * arbiter, only index 0 is valid.
  */
-static void *enumerate_arb_gpu_clk(struct kbase_device *kbdev,
+static void *get_arb_gpu_clk(struct kbase_device *kbdev,
 		unsigned int index)
 {
 	if (index == 0)
@@ -1061,10 +1062,10 @@
 
 /**
  * get_arb_gpu_clk_rate() - Get the current rate of GPU clock frequency value
- * @kbdev - kbase_device pointer
- * @index - GPU clock index
+ * @kbdev:          kbase_device pointer
+ * @gpu_clk_handle: Handle unique to the enumerated GPU clock
  *
- * Returns the GPU clock frequency value saved when gpu is granted from arbiter
+ * Return: The GPU clock frequency value saved when gpu is granted from arbiter
  */
 static unsigned long get_arb_gpu_clk_rate(struct kbase_device *kbdev,
 		void *gpu_clk_handle)
@@ -1082,14 +1083,14 @@
 
 /**
  * arb_gpu_clk_notifier_register() - Register a clock rate change notifier.
- * @kbdev          - kbase_device pointer
- * @gpu_clk_handle - Handle unique to the enumerated GPU clock
- * @nb             - notifier block containing the callback function pointer
- *
- * Returns 0 on success, negative error code otherwise.
+ * @kbdev:           kbase_device pointer
+ * @gpu_clk_handle:  Handle unique to the enumerated GPU clock
+ * @nb:              notifier block containing the callback function pointer
  *
  * This function registers a callback function that is invoked whenever the
  * frequency of the clock corresponding to @gpu_clk_handle changes.
+ *
+ * Return: 0 on success, negative error code otherwise.
  */
 static int arb_gpu_clk_notifier_register(struct kbase_device *kbdev,
 	void *gpu_clk_handle, struct notifier_block *nb)
@@ -1107,10 +1108,10 @@
 }
 
 /**
- * gpu_clk_notifier_unregister() - Unregister clock rate change notifier
- * @kbdev          - kbase_device pointer
- * @gpu_clk_handle - Handle unique to the enumerated GPU clock
- * @nb             - notifier block containing the callback function pointer
+ * arb_gpu_clk_notifier_unregister() - Unregister clock rate change notifier
+ * @kbdev:           kbase_device pointer
+ * @gpu_clk_handle:  Handle unique to the enumerated GPU clock
+ * @nb:              notifier block containing the callback function pointer
  *
  * This function pointer is used to unregister a callback function that
  * was previously registered to get notified of a frequency change of the
@@ -1131,7 +1132,7 @@
 
 struct kbase_clk_rate_trace_op_conf arb_clk_rate_trace_ops = {
 	.get_gpu_clk_rate = get_arb_gpu_clk_rate,
-	.enumerate_gpu_clk = enumerate_arb_gpu_clk,
+	.enumerate_gpu_clk = get_arb_gpu_clk,
 	.gpu_clk_notifier_register = arb_gpu_clk_notifier_register,
 	.gpu_clk_notifier_unregister = arb_gpu_clk_notifier_unregister
 };

--
Gitblit v1.6.2