msm: kgsl: Add support to disable CP Crash Dumper

By default A5xx GPUs use CP crash dumper to get GPU
snapshot in case of any fault.

At times it is required to disable crash dumper
in case of any abnormalities, add support to do so.

Change-Id: Iea6497778bcd711e769f0e509103bd3bd0fd8574
Signed-off-by: Rajesh Kemisetti <rajeshk@codeaurora.org>
This commit is contained in:
Rajesh Kemisetti 2016-12-01 21:49:33 +05:30 committed by Gerrit - the friendly Code Review server
parent 5142c18bae
commit edccdc6e41
3 changed files with 41 additions and 1 deletions

View file

@ -834,7 +834,8 @@ void a5xx_snapshot(struct adreno_device *adreno_dev,
a5xx_hwcg_set(adreno_dev, false);
/* Try to run the crash dumper */
_a5xx_do_crashdump(device);
if (device->snapshot_crashdumper)
_a5xx_do_crashdump(device);
kgsl_snapshot_add_section(device, KGSL_SNAPSHOT_SECTION_REGS,
snapshot, a5xx_snapshot_registers, NULL);

View file

@ -264,6 +264,10 @@ struct kgsl_device {
u32 snapshot_faultcount; /* Total number of faults since boot */
bool force_panic; /* Force panic after snapshot dump */
/* Use CP Crash dumper to get GPU snapshot*/
bool snapshot_crashdumper;
struct kobject snapshot_kobj;
struct kobject ppd_kobj;

View file

@ -833,6 +833,32 @@ static ssize_t force_panic_store(struct kgsl_device *device, const char *buf,
return (ssize_t) ret < 0 ? ret : count;
}
/* Show the snapshot_crashdumper request status */
static ssize_t snapshot_crashdumper_show(struct kgsl_device *device, char *buf)
{
return snprintf(buf, PAGE_SIZE, "%d\n", device->snapshot_crashdumper);
}
/* Store the value to snapshot_crashdumper*/
static ssize_t snapshot_crashdumper_store(struct kgsl_device *device,
const char *buf, size_t count)
{
unsigned int val = 0;
int ret;
if (device && count > 0)
device->snapshot_crashdumper = 1;
ret = kgsl_sysfs_store(buf, &val);
if (!ret && device)
device->snapshot_crashdumper = (bool)val;
return (ssize_t) ret < 0 ? ret : count;
}
/* Show the timestamp of the last collected snapshot */
static ssize_t timestamp_show(struct kgsl_device *device, char *buf)
{
@ -859,6 +885,8 @@ struct kgsl_snapshot_attribute attr_##_name = { \
static SNAPSHOT_ATTR(timestamp, 0444, timestamp_show, NULL);
static SNAPSHOT_ATTR(faultcount, 0644, faultcount_show, faultcount_store);
static SNAPSHOT_ATTR(force_panic, 0644, force_panic_show, force_panic_store);
static SNAPSHOT_ATTR(snapshot_crashdumper, 0644, snapshot_crashdumper_show,
snapshot_crashdumper_store);
static ssize_t snapshot_sysfs_show(struct kobject *kobj,
struct attribute *attr, char *buf)
@ -939,6 +967,7 @@ int kgsl_device_snapshot_init(struct kgsl_device *device)
device->snapshot = NULL;
device->snapshot_faultcount = 0;
device->force_panic = 0;
device->snapshot_crashdumper = 1;
ret = kobject_init_and_add(&device->snapshot_kobj, &ktype_snapshot,
&device->dev->kobj, "snapshot");
@ -959,6 +988,11 @@ int kgsl_device_snapshot_init(struct kgsl_device *device)
ret = sysfs_create_file(&device->snapshot_kobj,
&attr_force_panic.attr);
if (ret)
goto done;
ret = sysfs_create_file(&device->snapshot_kobj,
&attr_snapshot_crashdumper.attr);
done:
return ret;
}
@ -984,6 +1018,7 @@ void kgsl_device_snapshot_close(struct kgsl_device *device)
device->snapshot_memory.size = 0;
device->snapshot_faultcount = 0;
device->force_panic = 0;
device->snapshot_crashdumper = 1;
}
EXPORT_SYMBOL(kgsl_device_snapshot_close);