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

Commit 7693a007 authored by Carter Cooper's avatar Carter Cooper
Browse files

msm: kgsl: Update GMU Snapshot types



Add all the current subsection types for GMU snapshots.

Change-Id: I5c3fac1ba0ba88e64c734b57e771d3628cc7465a
Signed-off-by: default avatarCarter Cooper <ccooper@codeaurora.org>
parent d9e15b3b
Loading
Loading
Loading
Loading
+15 −10
Original line number Diff line number Diff line
@@ -1480,27 +1480,31 @@ struct gmu_mem_type_desc {
static size_t a6xx_snapshot_gmu_mem(struct kgsl_device *device,
		u8 *buf, size_t remain, void *priv)
{
	struct kgsl_snapshot_gmu *header = (struct kgsl_snapshot_gmu *)buf;
	struct kgsl_snapshot_gmu_mem *mem_hdr =
		(struct kgsl_snapshot_gmu_mem *)buf;
	unsigned int *data = (unsigned int *)
		(buf + sizeof(*mem_hdr));
	struct gmu_mem_type_desc *desc = priv;
	unsigned int *data = (unsigned int *)(buf + sizeof(*header));

	if (priv == NULL)
		return 0;

	if (remain < desc->memdesc->size + sizeof(*header)) {
	if (remain < desc->memdesc->size + sizeof(*mem_hdr)) {
		dev_err(device->dev,
			"snapshot: Not enough memory for the gmu section %d\n",
			desc->type);
		return 0;
	}

	header->type = desc->type;
	header->size = desc->memdesc->size;
	mem_hdr->type = desc->type;
	mem_hdr->hostaddr = (uintptr_t)desc->memdesc->hostptr;
	mem_hdr->gmuaddr = desc->memdesc->gmuaddr;
	mem_hdr->gpuaddr = 0;

	/* Just copy the ringbuffer, there are no active IBs */
	memcpy(data, desc->memdesc->hostptr, desc->memdesc->size);

	return desc->memdesc->size + sizeof(*header);
	return desc->memdesc->size + sizeof(*mem_hdr);
}

/*
@@ -1516,9 +1520,10 @@ static void a6xx_gmu_snapshot(struct kgsl_device *device,
{
	struct gmu_device *gmu = KGSL_GMU_DEVICE(device);
	struct gmu_mem_type_desc desc[] = {
		{gmu->hfi_mem, SNAPSHOT_GMU_HFIMEM},
		{gmu->gmu_log, SNAPSHOT_GMU_LOG},
		{gmu->dump_mem, SNAPSHOT_GMU_DUMPMEM} };
		{gmu->hfi_mem, SNAPSHOT_GMU_MEM_HFI},
		{gmu->gmu_log, SNAPSHOT_GMU_MEM_LOG},
		{gmu->dump_mem, SNAPSHOT_GMU_MEM_DEBUG},
	};
	unsigned int val, i;

	if (!gmu_core_isenabled(device))
@@ -1527,7 +1532,7 @@ static void a6xx_gmu_snapshot(struct kgsl_device *device,
	for (i = 0; i < ARRAY_SIZE(desc); i++) {
		if (desc[i].memdesc)
			kgsl_snapshot_add_section(device,
					KGSL_SNAPSHOT_SECTION_GMU,
					KGSL_SNAPSHOT_SECTION_GMU_MEMORY,
					snapshot, a6xx_snapshot_gmu_mem,
					&desc[i]);
	}
+23 −12
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
 */

#ifndef _KGSL_SNAPSHOT_H_
@@ -52,6 +52,7 @@ struct kgsl_snapshot_section_header {
#define KGSL_SNAPSHOT_SECTION_SHADER       0x1201
#define KGSL_SNAPSHOT_SECTION_MVC          0x1501
#define KGSL_SNAPSHOT_SECTION_GMU          0x1601
#define KGSL_SNAPSHOT_SECTION_GMU_MEMORY   0x1701

#define KGSL_SNAPSHOT_SECTION_END          0xFFFF

@@ -176,17 +177,20 @@ struct kgsl_snapshot_ib_v2 {
	__u64 size;    /* Size of the IB */
} __packed;

#define SNAPSHOT_GMU_OTHER	0
#define SNAPSHOT_GMU_HFIMEM	1
#define SNAPSHOT_GMU_LOG	2
#define SNAPSHOT_GMU_BWMEM	3
#define SNAPSHOT_GMU_DUMPMEM	4
#define SNAPSHOT_GMU_DCACHE	5

/* Indirect buffer sub-section header */
struct kgsl_snapshot_gmu {
	int type;    /* Type of data to dump */
	int size;    /* Size in bytes to dump */
/* GMU memory ID's */
#define SNAPSHOT_GMU_MEM_UNKNOWN	0x00
#define SNAPSHOT_GMU_MEM_HFI		0x01
#define SNAPSHOT_GMU_MEM_LOG		0x02
#define SNAPSHOT_GMU_MEM_BWTABLE	0x03
#define SNAPSHOT_GMU_MEM_DEBUG		0x04
#define SNAPSHOT_GMU_MEM_BIN_BLOCK	0x05

/* GMU memory section data */
struct kgsl_snapshot_gmu_mem {
	int type;
	uint64_t hostaddr;
	uint64_t gmuaddr;
	uint64_t gpuaddr;
} __packed;

/* Register sub-section header */
@@ -232,6 +236,13 @@ struct kgsl_snapshot_istore {
#define SNAPSHOT_DEBUG_CP_MERCIU 12
#define SNAPSHOT_DEBUG_SQE_VERSION 14

/* GMU Version information */
#define SNAPSHOT_DEBUG_GMU_CORE_VERSION 15
#define SNAPSHOT_DEBUG_GMU_CORE_DEV_VERSION 16
#define SNAPSHOT_DEBUG_GMU_PWR_VERSION 17
#define SNAPSHOT_DEBUG_GMU_PWR_DEV_VERSION 18
#define SNAPSHOT_DEBUG_GMU_HFI_VERSION 19

struct kgsl_snapshot_debug {
	int type;    /* Type identifier for the attached tata */
	int size;   /* Size of the section in dwords */