summaryrefslogtreecommitdiff
path: root/mali_kbase/context
diff options
context:
space:
mode:
authorJack Diver <diverj@google.com>2022-05-05 12:00:16 +0000
committerJack Diver <diverj@google.com>2022-05-06 16:47:09 +0000
commitd6c306f413a32d460c310aab5c3f7f5449ed5599 (patch)
tree4097ffa630868fa9c3ac13c2c16d980aeac4a828 /mali_kbase/context
parent76ee8a596d1df56bd958e2197abcc3e8b4849171 (diff)
downloadgpu-d6c306f413a32d460c310aab5c3f7f5449ed5599.tar.gz
mali_kbase: Ensure GPU L2 is up prior to MMU cmd
Fix races where the L2 has not finished powering up before we issue an MMU command. It's possible that the power up be deferred until after a scheduled power off, and in that case l2_desired may transiently be false. Replacing the current wait, with one that explicitly waits for L2 power up ensures that we don't issue a command for L2 power up has completed. Bug: 229473975 Signed-off-by: Jack Diver <diverj@google.com> Change-Id: Ic93eaf5f5cb520e0d34a5d3df8df9be05c477260
Diffstat (limited to 'mali_kbase/context')
-rw-r--r--mali_kbase/context/backend/mali_kbase_context_csf.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/mali_kbase/context/backend/mali_kbase_context_csf.c b/mali_kbase/context/backend/mali_kbase_context_csf.c
index 7e6d0e4..34504f7 100644
--- a/mali_kbase/context/backend/mali_kbase_context_csf.c
+++ b/mali_kbase/context/backend/mali_kbase_context_csf.c
@@ -31,6 +31,7 @@
#include <mali_kbase_mem_pool_group.h>
#include <mmu/mali_kbase_mmu.h>
#include <tl/mali_kbase_timeline.h>
+#include <backend/gpu/mali_kbase_pm_internal.h>
#if IS_ENABLED(CONFIG_DEBUG_FS)
#include <csf/mali_kbase_csf_csg_debugfs.h>
@@ -174,6 +175,7 @@ KBASE_EXPORT_SYMBOL(kbase_create_context);
void kbase_destroy_context(struct kbase_context *kctx)
{
struct kbase_device *kbdev;
+ int err;
if (WARN_ON(!kctx))
return;
@@ -194,6 +196,17 @@ void kbase_destroy_context(struct kbase_context *kctx)
wait_event(kbdev->pm.resume_wait,
!kbase_pm_is_suspending(kbdev));
}
+ /*
+ * Taking a pm reference does not guarantee that the GPU has finished powering up.
+ * It's possible that the power up has been deferred until after a scheduled power down.
+ * We must wait here for the L2 to be powered up, and holding a pm reference guarantees that
+ * it will not be powered down afterwards.
+ */
+ err = kbase_pm_wait_for_l2_powered(kbdev);
+ if (err) {
+ dev_err(kbdev->dev, "Wait for L2 power up failed on term of ctx %d_%d",
+ kctx->tgid, kctx->id);
+ }
kbase_mem_pool_group_mark_dying(&kctx->mem_pools);