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

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

Merge "msm: kgsl: Take GMU snapshot on GMU failures"

parents b5fd9597 5a51da2e
Loading
Loading
Loading
Loading
+18 −15
Original line number Original line 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 */
	/* Send OOB request to turn on the GX */
	status = gmu_core_dev_oob_set(device, oob_gpu);
	status = gmu_core_dev_oob_set(device, oob_gpu);
	if (status)
	if (status) {
		gmu_core_snapshot(device);
		goto error_mmu_off;
		goto error_mmu_off;
	}


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


	_set_secvid(device);
	_set_secvid(device);


@@ -2310,26 +2314,15 @@ static int adreno_stop(struct kgsl_device *device)
	error = gmu_core_dev_oob_set(device, oob_gpu);
	error = gmu_core_dev_oob_set(device, oob_gpu);
	if (error) {
	if (error) {
		gmu_core_dev_oob_clear(device, oob_gpu);
		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);
			gmu_core_snapshot(device);
			error = -EINVAL;
			error = -EINVAL;
		}
			goto no_gx_power;
	}
	}


	adreno_dispatcher_stop(adreno_dev);

	adreno_ringbuffer_stop(adreno_dev);

	kgsl_pwrscale_update_stats(device);
	kgsl_pwrscale_update_stats(device);


	adreno_irqctrl(adreno_dev, 0);
	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 */
	/* Save active coresight registers if applicable */
	adreno_coresight_stop(adreno_dev);
	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)) {
	if (!error && gmu_core_dev_wait_for_lowest_idle(device)) {
		set_bit(GMU_FAULT, &device->gmu_core.flags);
		gmu_core_snapshot(device);
		gmu_core_snapshot(device);
		/*
		/*
		 * Assume GMU hang after 10ms without responding.
		 * Assume GMU hang after 10ms without responding.
@@ -2360,6 +2352,17 @@ static int adreno_stop(struct kgsl_device *device)


	adreno_clear_pending_transactions(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.
	 * 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
	 * Clear it here if GMU is enabled as GMU stop needs access to
+11 −0
Original line number Original line Diff line number Diff line
@@ -1692,6 +1692,12 @@ static void gmu_stop(struct kgsl_device *device)
	if (!test_bit(GMU_CLK_ON, &device->gmu_core.flags))
	if (!test_bit(GMU_CLK_ON, &device->gmu_core.flags))
		return;
		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 */
	/* Wait for the lowest idle level we requested */
	if (gmu_core_dev_wait_for_lowest_idle(device))
	if (gmu_core_dev_wait_for_lowest_idle(device))
		goto error;
		goto error;
@@ -1725,6 +1731,11 @@ static void gmu_stop(struct kgsl_device *device)
	set_bit(GMU_FAULT, &device->gmu_core.flags);
	set_bit(GMU_FAULT, &device->gmu_core.flags);
	dev_err(&gmu->pdev->dev, "Failed to stop GMU\n");
	dev_err(&gmu->pdev->dev, "Failed to stop GMU\n");
	gmu_core_snapshot(device);
	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)
static void gmu_remove(struct kgsl_device *device)