From 7e53b80b0b975db21fae21925a71a168a279407a Mon Sep 17 00:00:00 2001 From: Harshdeep Dhatt Date: Thu, 8 Aug 2019 21:00:42 -0600 Subject: [PATCH] msm: kgsl: Set gmu fault inside gmu_snapshot The two always happen together. So set the gmu_fault inside the gmu_snapshot function. Also, if we have already recorded a gmu fault, then do not send nmi or try to snapshot a gmu which is already in nmi. Change-Id: I403a9c2c3cb7a1330a7931c41a23b4b4a2b66998 Signed-off-by: Harshdeep Dhatt --- drivers/gpu/msm/kgsl_gmu.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/msm/kgsl_gmu.c b/drivers/gpu/msm/kgsl_gmu.c index a5d5a86cd5df..c9386b59da9f 100644 --- a/drivers/gpu/msm/kgsl_gmu.c +++ b/drivers/gpu/msm/kgsl_gmu.c @@ -1530,6 +1530,10 @@ static void gmu_snapshot(struct kgsl_device *device) struct gmu_dev_ops *gmu_dev_ops = GMU_DEVICE_OPS(device); struct gmu_device *gmu = KGSL_GMU_DEVICE(device); + /* Abstain from sending another nmi or over-writing snapshot */ + if (test_and_set_bit(GMU_FAULT, &device->gmu_core.flags)) + return; + adreno_gmu_send_nmi(adreno_dev); /* Wait for the NMI to be handled */ udelay(100); @@ -1695,12 +1699,6 @@ static void gmu_stop(struct kgsl_device *device) return; error: - /* - * The power controller will change state to SLUMBER anyway - * Set GMU_FAULT flag to indicate to power contrller - * that hang recovery is needed to power on GPU - */ - set_bit(GMU_FAULT, &device->gmu_core.flags); dev_err(&gmu->pdev->dev, "Failed to stop GMU\n"); gmu_core_snapshot(device); }