Merge "msm: kgsl: Use readl_poll_timeout() for crashdumper status"

This commit is contained in:
qctecmdr 2020-10-08 21:56:16 -07:00 • committed by Gerrit - the friendly Code Review server
commit d616f838d1

View file

@ -3,6 +3,8 @@
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
*/
#include <linux/iopoll.h>
#include "adreno.h"
#include "adreno_a6xx.h"
#include "adreno_snapshot.h"
@ -1564,8 +1566,8 @@ static size_t a6xx_snapshot_sqe(struct kgsl_device *device, u8 *buf,
static void _a6xx_do_crashdump(struct kgsl_device *device)
{
unsigned long wait_time;
unsigned int reg = 0;
u32 val = 0;
int ret;
crash_dump_valid = false;
@ -1590,19 +1592,21 @@ static void _a6xx_do_crashdump(struct kgsl_device *device)
upper_32_bits(a6xx_capturescript->gpuaddr));
kgsl_regwrite(device, A6XX_CP_CRASH_DUMP_CNTL, 1);
wait_time = jiffies + msecs_to_jiffies(CP_CRASH_DUMPER_TIMEOUT);
while (!time_after(jiffies, wait_time)) {
kgsl_regread(device, A6XX_CP_CRASH_DUMP_STATUS, &reg);
if (reg & 0x2)
break;
cpu_relax();
}
/* wait 100 ms before starting the loop */
schedule_timeout_interruptible(HZ/10);
/* Read every 10ms for 900ms */
ret = readl_poll_timeout(device->reg_virt +
(A6XX_CP_CRASH_DUMP_STATUS << 2),
val, val & 0x02, 10000, 900 * 1000);
if (ret)
kgsl_regread(device, A6XX_CP_CRASH_DUMP_STATUS, &val);
if (!ADRENO_FEATURE(ADRENO_DEVICE(device), ADRENO_APRIV))
kgsl_regwrite(device, A6XX_CP_MISC_CNTL, 0);
if (!(reg & 0x2)) {
dev_err(device->dev, "Crash dump timed out: 0x%X\n", reg);
if (ret) {
dev_err(device->dev, "Crash dump timed out: 0x%X\n", val);
return;
}