Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 93d8db2e authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Add snapshot memory region in minidump only once"

parents b3589b50 8abd7613
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/* SPDX-License-Identifier: GPL-2.0-only */
/*
/*
 * Copyright (c) 2002,2007-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2002,2007-2021, The Linux Foundation. All rights reserved.
 */
 */
#ifndef __KGSL_DEVICE_H
#ifndef __KGSL_DEVICE_H
#define __KGSL_DEVICE_H
#define __KGSL_DEVICE_H
@@ -261,6 +261,7 @@ struct kgsl_device {
	struct {
	struct {
		void *ptr;
		void *ptr;
		u32 size;
		u32 size;
		bool in_minidump;
	} snapshot_memory;
	} snapshot_memory;


	struct kgsl_snapshot *snapshot;
	struct kgsl_snapshot *snapshot;
+16 −2
Original line number Original line Diff line number Diff line
@@ -35,16 +35,18 @@ static void add_to_minidump(struct kgsl_device *device)
	struct md_region md_entry;
	struct md_region md_entry;
	int ret;
	int ret;


	if (!msm_minidump_enabled())
	if (!msm_minidump_enabled() || device->snapshot_memory.in_minidump)
		return;
		return;


	scnprintf(md_entry.name, sizeof(md_entry.name), "GPU_SNAPSHOT");
	scnprintf(md_entry.name, sizeof(md_entry.name), "GPU_SNAPSHOT");
	md_entry.virt_addr = (u64)(device->snapshot_memory.ptr);
	md_entry.virt_addr = (u64)(device->snapshot_memory.ptr);
	md_entry.phys_addr = __pa(device->snapshot_memory.ptr);
	md_entry.phys_addr = __pa(device->snapshot_memory.ptr);
	md_entry.size = device->snapshot->size;
	md_entry.size = device->snapshot_memory.size;
	ret = msm_minidump_add_region(&md_entry);
	ret = msm_minidump_add_region(&md_entry);
	if (ret < 0)
	if (ret < 0)
		dev_err(device->dev, "Failed to register snapshot with minidump: %d\n", ret);
		dev_err(device->dev, "Failed to register snapshot with minidump: %d\n", ret);
	else
		device->snapshot_memory.in_minidump = true;
}
}


static void obj_itr_init(struct snapshot_obj_itr *itr, u8 *buf,
static void obj_itr_init(struct snapshot_obj_itr *itr, u8 *buf,
@@ -1165,6 +1167,7 @@ void kgsl_device_snapshot_probe(struct kgsl_device *device, u32 size)
		return;
		return;
	}
	}


	device->snapshot_memory.in_minidump = false;
	device->snapshot = NULL;
	device->snapshot = NULL;
	device->snapshot_faultcount = 0;
	device->snapshot_faultcount = 0;
	device->force_panic = false;
	device->force_panic = false;
@@ -1195,6 +1198,17 @@ void kgsl_device_snapshot_probe(struct kgsl_device *device, u32 size)
 */
 */
void kgsl_device_snapshot_close(struct kgsl_device *device)
void kgsl_device_snapshot_close(struct kgsl_device *device)
{
{
	if (msm_minidump_enabled() && device->snapshot_memory.in_minidump) {
		struct md_region md_entry;

		scnprintf(md_entry.name, sizeof(md_entry.name), "GPU_SNAPSHOT");
		md_entry.virt_addr = (u64)(device->snapshot_memory.ptr);
		md_entry.phys_addr = __pa(device->snapshot_memory.ptr);
		md_entry.size = device->snapshot_memory.size;
		if (msm_minidump_remove_region(&md_entry) < 0)
			dev_err(device->dev, "Failed to remove snapshot with minidump\n");
	}

	sysfs_remove_bin_file(&device->snapshot_kobj, &snapshot_attr);
	sysfs_remove_bin_file(&device->snapshot_kobj, &snapshot_attr);
	sysfs_remove_files(&device->snapshot_kobj, snapshot_attrs);
	sysfs_remove_files(&device->snapshot_kobj, snapshot_attrs);