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

Commit 957aee4a authored by Carter Cooper's avatar Carter Cooper
Browse files

msm: kgsl: Add ITCM/DTCM as part of the memory snapshot



While ITCM/DTCM are mapped as registers it doesn't make
any sense to dump them as registers. From the GMU point
of view it is just memory. Dump the registers as memory instead.

Change-Id: Iecdaaad304332fc4dd9d668710bcd373668664d8
Signed-off-by: default avatarCarter Cooper <ccooper@codeaurora.org>
parent 6b0bbc65
Loading
Loading
Loading
Loading
+65 −2
Original line number Diff line number Diff line
@@ -29,9 +29,14 @@ static const unsigned int a6xx_gmu_gx_registers[] = {
	0x1A900, 0x1A92B, 0x1A940, 0x1A940,
};

static const unsigned int a6xx_gmu_tcm_registers[] = {
	/* ITCM */
	0x1B400, 0x1C3FF,
	/* DTCM */
	0x1C400, 0x1D3FF,
};

static const unsigned int a6xx_gmu_registers[] = {
	/* GMU TCM */
	0x1B400, 0x1C3FF, 0x1C400, 0x1D3FF,
	/* GMU CX */
	0x1F400, 0x1F407, 0x1F410, 0x1F412, 0x1F500, 0x1F500, 0x1F507, 0x1F50A,
	0x1F800, 0x1F804, 0x1F807, 0x1F808, 0x1F80B, 0x1F80C, 0x1F80F, 0x1F81C,
@@ -1557,6 +1562,39 @@ static void a6xx_gmu_snapshot_versions(struct kgsl_device *device,
				&gmu_vers[i]);
}

struct a6xx_tcm_data {
	enum gmu_mem_type type;
	u32 start;
	u32 last;
};

static size_t a6xx_snapshot_gmu_tcm(struct kgsl_device *device,
		u8 *buf, size_t remain, void *priv)
{
	struct kgsl_snapshot_gmu_mem *mem_hdr =
		(struct kgsl_snapshot_gmu_mem *)buf;
	unsigned int *data = (unsigned int *)(buf + sizeof(*mem_hdr));
	unsigned int i, bytes;
	struct a6xx_tcm_data *tcm = priv;

	bytes = (tcm->last - tcm->start + 1) << 2;

	if (remain < bytes + sizeof(*mem_hdr)) {
		SNAPSHOT_ERR_NOMEM(device, "GMU Memory");
		return 0;
	}

	mem_hdr->type = SNAPSHOT_GMU_MEM_BIN_BLOCK;
	mem_hdr->hostaddr = 0;
	mem_hdr->gmuaddr = gmu_get_memtype_base(tcm->type);
	mem_hdr->gpuaddr = 0;

	for (i = tcm->start; i <= tcm->last; i++)
		kgsl_regread(device, i, data++);

	return bytes + sizeof(*mem_hdr);
}

/*
 * a6xx_gmu_snapshot() - A6XX GMU snapshot function
 * @adreno_dev: Device being snapshotted
@@ -1589,6 +1627,31 @@ static void a6xx_gmu_snapshot(struct kgsl_device *device,
					&desc[i]);
	}

	if (adreno_is_a640(adreno_dev) || adreno_is_a650(adreno_dev) ||
			adreno_is_a680(adreno_dev)) {
		struct a6xx_tcm_data tcm = {
			.type = GMU_ITCM,
			.start = a6xx_gmu_tcm_registers[0],
			.last = a6xx_gmu_tcm_registers[1],
		};

		kgsl_snapshot_add_section(device,
				KGSL_SNAPSHOT_SECTION_GMU_MEMORY,
				snapshot, a6xx_snapshot_gmu_tcm, &tcm);

		tcm.type = GMU_DTCM;
		tcm.start = a6xx_gmu_tcm_registers[2],
		tcm.last = a6xx_gmu_tcm_registers[3],

		kgsl_snapshot_add_section(device,
				KGSL_SNAPSHOT_SECTION_GMU_MEMORY,
				snapshot, a6xx_snapshot_gmu_tcm, &tcm);
	} else {
		adreno_snapshot_registers(device, snapshot,
				a6xx_gmu_tcm_registers,
				ARRAY_SIZE(a6xx_gmu_tcm_registers) / 2);
	}

	adreno_snapshot_registers(device, snapshot, a6xx_gmu_registers,
					ARRAY_SIZE(a6xx_gmu_registers) / 2);

+5 −0
Original line number Diff line number Diff line
@@ -73,6 +73,11 @@ static unsigned int next_uncached_user_alloc;
static void gmu_snapshot(struct kgsl_device *device);
static void gmu_remove(struct kgsl_device *device);

unsigned int gmu_get_memtype_base(enum gmu_mem_type type)
{
	return gmu_vma[type].start;
}

static int _gmu_iommu_fault_handler(struct device *dev,
		unsigned long addr, int flags, const char *name)
{
+1 −0
Original line number Diff line number Diff line
@@ -209,5 +209,6 @@ struct gmu_device {
};

struct gmu_memdesc *gmu_get_memdesc(unsigned int addr, unsigned int size);
unsigned int gmu_get_memtype_base(enum gmu_mem_type type);

#endif /* __KGSL_GMU_H */