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

Commit 5a51da2e authored by Harshdeep Dhatt's avatar Harshdeep Dhatt Committed by Indira Biruduraju
Browse files

msm: kgsl: Take GMU snapshot on GMU failures



GMU can fail to turn on GX or it can fail the
START HFI. So take snapshot and put GMU in NMI.
When this happens, kgsl will call gmu_stop()
and as GMU is already in fault aka NMI, reset
the GMU and GPU.

Change-Id: Iafc9b34063a7ff2415d3462dd289b52e425fbf3b
Signed-off-by: default avatarHarshdeep Dhatt <hdhatt@codeaurora.org>
parent fbad67d3
Loading
Loading
Loading
Loading
+18 −15
Original line number Diff line number Diff line
@@ -2055,12 +2055,16 @@ static int _adreno_start(struct adreno_device *adreno_dev)

	/* Send OOB request to turn on the GX */
	status = gmu_core_dev_oob_set(device, oob_gpu);
	if (status)
	if (status) {
		gmu_core_snapshot(device);
		goto error_mmu_off;
	}

	status = gmu_core_dev_hfi_start_msg(device);
	if (status)
	if (status) {
		gmu_core_snapshot(device);
		goto error_oob_clear;
	}

	_set_secvid(device);

@@ -2310,26 +2314,15 @@ static int adreno_stop(struct kgsl_device *device)
	error = gmu_core_dev_oob_set(device, oob_gpu);
	if (error) {
		gmu_core_dev_oob_clear(device, oob_gpu);

		if (gmu_core_regulator_isenabled(device)) {
			/* GPU is on. Try recovery */
			set_bit(GMU_FAULT, &device->gmu_core.flags);
			gmu_core_snapshot(device);
			error = -EINVAL;
		}
			goto no_gx_power;
	}

	adreno_dispatcher_stop(adreno_dev);

	adreno_ringbuffer_stop(adreno_dev);

	kgsl_pwrscale_update_stats(device);

	adreno_irqctrl(adreno_dev, 0);

	adreno_llc_deactivate_slice(adreno_dev->gpu_llc_slice);
	adreno_llc_deactivate_slice(adreno_dev->gpuhtw_llc_slice);

	/* Save active coresight registers if applicable */
	adreno_coresight_stop(adreno_dev);

@@ -2347,7 +2340,6 @@ static int adreno_stop(struct kgsl_device *device)
	 */

	if (!error && gmu_core_dev_wait_for_lowest_idle(device)) {
		set_bit(GMU_FAULT, &device->gmu_core.flags);
		gmu_core_snapshot(device);
		/*
		 * Assume GMU hang after 10ms without responding.
@@ -2360,6 +2352,17 @@ static int adreno_stop(struct kgsl_device *device)

	adreno_clear_pending_transactions(device);

no_gx_power:
	adreno_dispatcher_stop(adreno_dev);

	adreno_ringbuffer_stop(adreno_dev);

	if (!IS_ERR_OR_NULL(adreno_dev->gpu_llc_slice))
		llcc_slice_deactivate(adreno_dev->gpu_llc_slice);

	if (!IS_ERR_OR_NULL(adreno_dev->gpuhtw_llc_slice))
		llcc_slice_deactivate(adreno_dev->gpuhtw_llc_slice);

	/*
	 * The halt is not cleared in the above function if we have GBIF.
	 * Clear it here if GMU is enabled as GMU stop needs access to
+11 −0
Original line number Diff line number Diff line
@@ -1693,6 +1693,12 @@ static void gmu_stop(struct kgsl_device *device)
	if (!test_bit(GMU_CLK_ON, &device->gmu_core.flags))
		return;

	/* Force suspend if gmu is already in fault */
	if (test_bit(GMU_FAULT, &device->gmu_core.flags)) {
		gmu_core_suspend(device);
		return;
	}

	/* Wait for the lowest idle level we requested */
	if (gmu_core_dev_wait_for_lowest_idle(device))
		goto error;
@@ -1726,6 +1732,11 @@ static void gmu_stop(struct kgsl_device *device)
	set_bit(GMU_FAULT, &device->gmu_core.flags);
	dev_err(&gmu->pdev->dev, "Failed to stop GMU\n");
	gmu_core_snapshot(device);
	/*
	 * We failed to stop the gmu successfully. Force a suspend
	 * to set things up for a fresh start.
	 */
	gmu_core_suspend(device);
}

static void gmu_remove(struct kgsl_device *device)