From bf39effde585ceaa8a00b09d3a0823daa05649d0 Mon Sep 17 00:00:00 2001 From: Akhil P Oommen Date: Tue, 20 Sep 2022 18:41:17 +0530 Subject: [PATCH] BACKPORT: msm: kgsl: Avoid unmap after kgsl system suspend Smmu driver cannot safely handle unmap request after smmu device is system suspended. So ensure kgsl doesn't initiate an unmap request after kgsl system suspend as smmu device suspend happens after gpu's. Kgsl does unmap from the following paths: 1. Userspace unmap calls 2. Mementry workqueue 3. During reclaim (1) is not a concern as userspace will be collapse before driver suspend. So we need to ensure that mementry/events workqueues are flushed and we don't participate in reclaim to take care off (2) & (3) before kgsl system suspend completes. [mkbestas]: Ignore kgsl_reclaim parts that don't exist in 5.4 Change-Id: Ibe2c8f5a90fd4d8d4cf212f17c04c52873738e36 Signed-off-by: Akhil P Oommen --- drivers/gpu/msm/adreno.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/msm/adreno.c b/drivers/gpu/msm/adreno.c index 3a898033c178..aa5589b7bf54 100644 --- a/drivers/gpu/msm/adreno.c +++ b/drivers/gpu/msm/adreno.c @@ -1743,6 +1743,12 @@ static int adreno_pm_suspend(struct device *dev) status = ops->pm_suspend(adreno_dev); mutex_unlock(&device->mutex); + if (status) + return status; + + flush_workqueue(device->events_wq); + flush_workqueue(kgsl_driver.mem_workqueue); + return status; }