summaryrefslogtreecommitdiff
path: root/drivers/gpu/msm/adreno_iommu.c
diff options
context:
space:
mode:
authorMichael Bestas <mkbestas@lineageos.org>2024-10-11 02:00:13 +0300
committerMichael Bestas <mkbestas@lineageos.org>2024-10-11 02:00:13 +0300
commit5723bf36a6f222828f00962a067480a1ad7fd98f (patch)
treece330a13bb759307304f1676c1159dec7450e69b /drivers/gpu/msm/adreno_iommu.c
parent17d850f5a5bc1318b67a974b16d32a2dd3bab5cf (diff)
parentdc9abd24dd0943d1afb3a349bbacc19baa0f071d (diff)
Merge tag 'LA.UM.8.4.c25-11300-8x98.0' of https://git.codelinaro.org/clo/la/kernel/msm-4.4 into android13-4.4-msm8998
"LA.UM.8.4.c25-11300-8x98.0" * tag 'LA.UM.8.4.c25-11300-8x98.0' of https://git.codelinaro.org/clo/la/kernel/msm-4.4: msm: kgsl: Fix error handling during drawctxt switch dsp: q6voice: Adds checks for an integer overflow msm: adsprpc: Handle UAF in fastrpc internal munmap Conflicts: drivers/char/adsprpc.c Change-Id: I3b55e2f381f91677a3d739ba33f4f1d57f6573e0
Diffstat (limited to 'drivers/gpu/msm/adreno_iommu.c')
-rw-r--r--drivers/gpu/msm/adreno_iommu.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/gpu/msm/adreno_iommu.c b/drivers/gpu/msm/adreno_iommu.c
index 4bb7f6286664..9216d6f07119 100644
--- a/drivers/gpu/msm/adreno_iommu.c
+++ b/drivers/gpu/msm/adreno_iommu.c
@@ -1,4 +1,5 @@
/* Copyright (c) 2002,2007-2016, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -890,5 +891,17 @@ int adreno_iommu_set_pt_ctx(struct adreno_ringbuffer *rb,
else
result = _set_ctxt_gpu(rb, drawctxt);
+ /*
+ * In case ctxt switch fails, revert the pagetable back to the
+ * original. Not reverting the pagetable will lead to incorrect
+ * hardware state in the ringbuffer.
+ */
+ if (result && (new_pt != cur_pt)) {
+ if (cpu_path)
+ result = _set_pagetable_cpu(rb, cur_pt);
+ else
+ result = _set_pagetable_gpu(rb, cur_pt);
+ }
+
return result;
}