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

Commit 29607073 authored by Harshdeep Dhatt's avatar Harshdeep Dhatt
Browse files

msm: kgsl: Get rid of gmu_core_snapshot and gmu_core_dev_snapshot



Assign the gmu specific snapshot function to gpudev->snapshot instead
of creating a gmu_core_snapshot. This function will send an nmi if we
hit a gmu fault. Then, it will capture gmu snapshot followed by the generic
a6xx_snapshot as against a6xx snapshot calling the gmu snapshot.
Do the same for rgmu. This helps get rid of gmu_core_snapshot and
gmu_core_dev_snapshot() functions.

Change-Id: I0f72a930633557260b59a76f0161bcde8c5a6da2
Signed-off-by: default avatarHarshdeep Dhatt <hdhatt@codeaurora.org>
parent efa44eb2
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1877,4 +1877,12 @@ void adreno_get_bus_counters(struct adreno_device *adreno_dev);
 * power up the gpu
 */
void adreno_clear_dcvs_counters(struct adreno_device *adreno_dev);

/**
 * gmu_fault_snapshot - Set gmu fault and trigger snapshot
 * @device: Pointer to the kgsl device
 *
 * Set the gmu fault and take snapshot when we hit a gmu fault
 */
void gmu_fault_snapshot(struct kgsl_device *device);
#endif /*__ADRENO_H */
+3 −3
Original line number Diff line number Diff line
@@ -2654,7 +2654,7 @@ struct adreno_gpudev adreno_a6xx_gmu_gpudev = {
	.reg_offsets = a6xx_register_offsets,
	.probe = a6xx_gmu_device_probe,
	.start = a6xx_start,
	.snapshot = a6xx_snapshot,
	.snapshot = a6xx_gmu_snapshot,
	.init = a6xx_init,
	.irq_handler = a6xx_irq_handler,
	.rb_start = a6xx_rb_start,
@@ -2689,7 +2689,7 @@ struct adreno_gpudev adreno_a6xx_rgmu_gpudev = {
	.reg_offsets = a6xx_register_offsets,
	.probe = a6xx_rgmu_device_probe,
	.start = a6xx_start,
	.snapshot = a6xx_snapshot,
	.snapshot = a6xx_rgmu_snapshot,
	.init = a6xx_init,
	.irq_handler = a6xx_irq_handler,
	.rb_start = a6xx_rb_start,
@@ -2724,7 +2724,7 @@ struct adreno_gpudev adreno_a630_gpudev = {
	.reg_offsets = a6xx_register_offsets,
	.probe = a6xx_gmu_device_probe,
	.start = a6xx_start,
	.snapshot = a6xx_snapshot,
	.snapshot = a6xx_gmu_snapshot,
	.init = a6xx_init,
	.irq_handler = a6xx_irq_handler,
	.rb_start = a6xx_rb_start,
+27 −19
Original line number Diff line number Diff line
@@ -102,6 +102,12 @@ static struct gmu_iommu_context a6xx_gmu_ctx[] = {
	[GMU_CONTEXT_KERNEL] = { .name = "gmu_kernel" }
};

void gmu_fault_snapshot(struct kgsl_device *device)
{
	device->gmu_fault = true;
	kgsl_device_snapshot(device, NULL, true);
}

struct a6xx_gmu_device *to_a6xx_gmu(struct adreno_device *adreno_dev)
{
	struct a6xx_device *a6xx_dev = container_of(adreno_dev,
@@ -443,8 +449,7 @@ static int a6xx_gmu_device_start(struct adreno_device *adreno_dev)
		gmu_core_regread(device,
			A6XX_GMU_CM3_DTCM_START + (0x3fdc >> 2), &val);
		dev_err(&gmu->pdev->dev, "GMU doesn't boot: 0x%x\n", val);

		a6xx_gmu_snapshot(device);
		gmu_fault_snapshot(device);
		return -ETIMEDOUT;
	}

@@ -468,7 +473,7 @@ static int a6xx_gmu_hfi_start(struct adreno_device *adreno_dev)
			GMU_START_TIMEOUT,
			BIT(0))) {
		dev_err(&gmu->pdev->dev, "GMU HFI init failed\n");
		a6xx_gmu_snapshot(device);
		gmu_fault_snapshot(device);
		return -ETIMEDOUT;
	}

@@ -744,8 +749,8 @@ static int a6xx_gmu_oob_set(struct kgsl_device *device,

	if (timed_poll_check(device, A6XX_GMU_GMU2HOST_INTR_INFO, check,
		GPU_START_TIMEOUT, check)) {
		gmu_fault_snapshot(device);
		ret = -ETIMEDOUT;
		a6xx_gmu_snapshot(device);
		WARN(1, "OOB request %s timed out\n", oob_to_str(req));
	}

@@ -914,7 +919,7 @@ int a6xx_gmu_sptprac_enable(struct adreno_device *adreno_dev)
			SPTPRAC_CTRL_TIMEOUT,
			SPTPRAC_POWERON_STATUS_MASK)) {
		dev_err(&gmu->pdev->dev, "power on SPTPRAC fail\n");
		a6xx_gmu_snapshot(device);
		gmu_fault_snapshot(device);
		return -ETIMEDOUT;
	}

@@ -1112,6 +1117,7 @@ static int a6xx_gmu_wait_for_lowest_idle(struct adreno_device *adreno_dev)
	}

	WARN_ON(1);
	gmu_fault_snapshot(device);
	return -ETIMEDOUT;
}

@@ -1133,6 +1139,7 @@ static int a6xx_gmu_wait_for_idle(struct adreno_device *adreno_dev)
				"GMU not idling: status2=0x%x %llx %llx\n",
				status2, ts1,
				a6xx_read_alwayson(ADRENO_DEVICE(device)));
		gmu_fault_snapshot(device);
		return -ETIMEDOUT;
	}

@@ -1936,14 +1943,13 @@ static irqreturn_t a6xx_gmu_irq_handler(int irq, void *data)
	return IRQ_HANDLED;
}


void a6xx_gmu_snapshot(struct kgsl_device *device)
static void a6xx_gmu_nmi(struct adreno_device *adreno_dev)
{
	struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
	struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev);

	/* Abstain from sending another nmi or over-writing snapshot */
	if (device->gmu_fault)
	/* No need to nmi if it was a gpu fault */
	if (!device->gmu_fault)
		return;

	/* make sure we're reading the latest cm3_fault */
@@ -1960,16 +1966,24 @@ void a6xx_gmu_snapshot(struct kgsl_device *device)
		/* Wait for the NMI to be handled */
		udelay(100);
	}
}

	kgsl_device_snapshot(device, NULL, true);
void a6xx_gmu_snapshot(struct adreno_device *adreno_dev,
	struct kgsl_snapshot *snapshot)
{
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);

	a6xx_gmu_nmi(adreno_dev);

	a6xx_gmu_device_snapshot(device, snapshot);

	a6xx_snapshot(adreno_dev, snapshot);

	gmu_core_regwrite(device, A6XX_GMU_GMU2HOST_INTR_CLR,
		0xffffffff);
	gmu_core_regwrite(device, A6XX_GMU_GMU2HOST_INTR_MASK,
		HFI_IRQ_MASK);

	device->gmu_fault = true;

}

static int a6xx_gmu_aop_send_acd_state(struct mbox_chan *channel, bool flag)
@@ -2245,14 +2259,9 @@ static struct gmu_dev_ops a6xx_gmudev = {
	.gx_is_on = a6xx_gmu_gx_is_on,
	.ifpc_store = a6xx_gmu_ifpc_store,
	.ifpc_show = a6xx_gmu_ifpc_show,
	.snapshot = a6xx_gmu_device_snapshot,
	.cooperative_reset = a6xx_gmu_cooperative_reset,
	.wait_for_active_transition = a6xx_gmu_wait_for_active_transition,
	.scales_bandwidth = a6xx_gmu_scales_bandwidth,
};

static struct gmu_core_ops a6xx_gmu_ops = {
	.snapshot = a6xx_gmu_snapshot,
	.acd_set = a6xx_gmu_acd_set,
};

@@ -2592,7 +2601,6 @@ static int a6xx_gmu_probe(struct kgsl_device *device,

	set_bit(GMU_ENABLED, &device->gmu_core.flags);

	device->gmu_core.core_ops = &a6xx_gmu_ops;
	device->gmu_core.dev_ops = &a6xx_gmudev;

	/* Initialize HFI and GMU interrupts */
+7 −3
Original line number Diff line number Diff line
@@ -286,9 +286,13 @@ void a6xx_enable_gpu_irq(struct adreno_device *adreno_dev);
void a6xx_disable_gpu_irq(struct adreno_device *adreno_dev);

/**
 * a6xx_gmu_snapshot - Send nmi to gmu and take snapshot
 * @device: Pointer to the kgsl device
 * a6xx_gmu_snapshot- Take snapshot for gmu targets
 * @adreno_dev: Pointer to the adreno device
 * @snapshot: Pointer to the snapshot structure
 *
 * Send an NMI to gmu if we hit a gmu fault. Then take gmu
 * snapshot and carry on with rest of the a6xx snapshot
 */
void a6xx_gmu_snapshot(struct kgsl_device *device);
void a6xx_gmu_snapshot(struct adreno_device *adreno_dev,
	struct kgsl_snapshot *snapshot);
#endif
+7 −4
Original line number Diff line number Diff line
@@ -245,6 +245,7 @@ static int receive_ack_cmd(struct a6xx_gmu_device *gmu, void *rcvd,
	struct pending_cmd *ret_cmd)
{
	struct adreno_device *adreno_dev = a6xx_gmu_to_adreno(gmu);
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
	uint32_t *ack = rcvd;
	uint32_t hdr = ack[0];
	uint32_t req_hdr = ack[1];
@@ -266,7 +267,7 @@ static int receive_ack_cmd(struct a6xx_gmu_device *gmu, void *rcvd,
		"HFI ACK: Cannot find sender for 0x%8.8x Waiter: 0x%8.8x\n",
		req_hdr, ret_cmd->sent_hdr);

	a6xx_gmu_snapshot(KGSL_DEVICE(adreno_dev));
	gmu_fault_snapshot(device);

	return -ENODEV;
}
@@ -310,6 +311,7 @@ static int a6xx_hfi_send_cmd(struct adreno_device *adreno_dev,
	uint32_t queue_idx, void *data, struct pending_cmd *ret_cmd)
{
	struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev);
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
	int rc;
	uint32_t *cmd = data;
	struct a6xx_hfi *hfi = &gmu->hfi;
@@ -329,7 +331,7 @@ static int a6xx_hfi_send_cmd(struct adreno_device *adreno_dev,
		HFI_IRQ_MSGQ_MASK, HFI_IRQ_MSGQ_MASK, HFI_RSP_TIMEOUT);

	if (rc) {
		a6xx_gmu_snapshot(KGSL_DEVICE(adreno_dev));
		gmu_fault_snapshot(device);
		dev_err(&gmu->pdev->dev,
		"Timed out waiting on ack for 0x%8.8x (id %d, sequence %d)\n",
		cmd[0], MSG_HDR_GET_ID(*cmd), MSG_HDR_GET_SEQNUM(*cmd));
@@ -337,7 +339,7 @@ static int a6xx_hfi_send_cmd(struct adreno_device *adreno_dev,
	}

	/* Clear the interrupt */
	gmu_core_regwrite(KGSL_DEVICE(adreno_dev), A6XX_GMU_GMU2HOST_INTR_CLR,
	gmu_core_regwrite(device, A6XX_GMU_GMU2HOST_INTR_CLR,
		HFI_IRQ_MSGQ_MASK);

	rc = a6xx_hfi_process_queue(gmu, HFI_MSG_ID, ret_cmd);
@@ -359,8 +361,9 @@ static int a6xx_hfi_send_generic_req(struct adreno_device *adreno_dev,

	if (!rc && ret_cmd.results[2] == HFI_ACK_ERROR) {
		struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev);
		struct kgsl_device *device = KGSL_DEVICE(adreno_dev);

		a6xx_gmu_snapshot(KGSL_DEVICE(adreno_dev));
		gmu_fault_snapshot(device);
		dev_err(&gmu->pdev->dev, "HFI ACK failure: Req 0x%8.8X\n",
						ret_cmd.results[1]);
		return -EINVAL;
Loading