summaryrefslogtreecommitdiff
path: root/mali_kbase/context
diff options
context:
space:
mode:
authorSuzanne Candanedo <suzanne.candanedo@arm.com>2022-12-16 12:07:45 +0000
committerGuus Sliepen <gsliepen@google.com>2023-01-13 16:31:47 +0000
commitc48886fd473a20e28bb0199fc40f78ed1ec88b1d (patch)
tree0508d24a04d09627402ac38a8a57ae64bbf1fa06 /mali_kbase/context
parent422aa1fad7e63f16000ffb9303e816b54ef3d8ca (diff)
downloadgpu-c48886fd473a20e28bb0199fc40f78ed1ec88b1d.tar.gz
Move the code to disable the MMU for a kctx (which also will flush the GPU caches for that kctx's Address Space) from the end of kctx termination to JM/CSF kctx-scheduler termination time. This ensures the GPU cached writes for that kctx are clear before we free the kctx's GPU memory pages in the region tracker, and before the MMU tables are freed. This in turn ensures the GPU cached writes do not land in freed memory (which would be a security issue). Change-Id: I2730a5762cb106ca2179cf9a2f789b8764f21901 (cherry picked from commit 09e14ccf27007dcb2cc0d4d64f5087ccc620a0b5) Provenance: https://code.ipdelivery.arm.com/c/GPU/mali-ddk/+/4810 Bug: 260123838
Diffstat (limited to 'mali_kbase/context')
-rw-r--r--mali_kbase/context/mali_kbase_context.c11
1 files changed, 0 insertions, 11 deletions
diff --git a/mali_kbase/context/mali_kbase_context.c b/mali_kbase/context/mali_kbase_context.c
index 95bd641..5fc1636 100644
--- a/mali_kbase/context/mali_kbase_context.c
+++ b/mali_kbase/context/mali_kbase_context.c
@@ -176,10 +176,6 @@ int kbase_context_common_init(struct kbase_context *kctx)
/* creating a context is considered a disjoint event */
kbase_disjoint_event(kctx->kbdev);
- kctx->as_nr = KBASEP_AS_NR_INVALID;
-
- atomic_set(&kctx->refcount, 0);
-
spin_lock_init(&kctx->mm_update_lock);
kctx->process_mm = NULL;
atomic_set(&kctx->nonmapped_pages, 0);
@@ -298,15 +294,8 @@ static void kbase_remove_kctx_from_process(struct kbase_context *kctx)
void kbase_context_common_term(struct kbase_context *kctx)
{
- unsigned long flags;
int pages;
- mutex_lock(&kctx->kbdev->mmu_hw_mutex);
- spin_lock_irqsave(&kctx->kbdev->hwaccess_lock, flags);
- kbase_ctx_sched_remove_ctx(kctx);
- spin_unlock_irqrestore(&kctx->kbdev->hwaccess_lock, flags);
- mutex_unlock(&kctx->kbdev->mmu_hw_mutex);
-
pages = atomic_read(&kctx->used_pages);
if (pages != 0)
dev_warn(kctx->kbdev->dev,