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

Commit 238dd0f1 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Try again if GPU zap shader loading fails"

parents 62d39308 564ede41
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -174,6 +174,9 @@
/* Number of times to try hard reset */
#define NUM_TIMES_RESET_RETRY 5

/* Number of times to try loading of zap shader */
#define ZAP_RETRY_MAX	5

/* Number of times to poll the AHB fence in ISR */
#define FENCE_RETRY_MAX 100

+18 −8
Original line number Diff line number Diff line
@@ -2211,6 +2211,7 @@ static int a5xx_microcode_load(struct adreno_device *adreno_dev)
	struct adreno_firmware *pm4_fw = ADRENO_FW(adreno_dev, ADRENO_FW_PM4);
	struct adreno_firmware *pfp_fw = ADRENO_FW(adreno_dev, ADRENO_FW_PFP);
	uint64_t gpuaddr;
	int ret = 0, zap_retry = 0;

	gpuaddr = pm4_fw->memdesc.gpuaddr;
	kgsl_regwrite(device, A5XX_CP_PM4_INSTR_BASE_LO,
@@ -2231,7 +2232,6 @@ static int a5xx_microcode_load(struct adreno_device *adreno_dev)
	 */
	if (adreno_dev->zap_loaded && !(ADRENO_FEATURE(adreno_dev,
		ADRENO_CPZ_RETENTION))) {
		int ret;
		struct scm_desc desc = {0};

		desc.args[0] = 0;
@@ -2248,15 +2248,25 @@ static int a5xx_microcode_load(struct adreno_device *adreno_dev)

	/* Load the zap shader firmware through PIL if its available */
	if (adreno_dev->gpucore->zap_name && !adreno_dev->zap_loaded) {
		/*
		 * subsystem_get() may return -EAGAIN in case system is busy
		 * and unable to load the firmware. So keep trying since this
		 * is not a fatal error.
		 */
		do {
			ret = 0;
			ptr = subsystem_get(adreno_dev->gpucore->zap_name);

			/* Return error if the zap shader cannot be loaded */
		if (IS_ERR_OR_NULL(ptr))
			return (ptr == NULL) ? -ENODEV : PTR_ERR(ptr);
			if (IS_ERR_OR_NULL(ptr)) {
				ret = (ptr == NULL) ? -ENODEV : PTR_ERR(ptr);
				ptr = NULL;
			} else
				adreno_dev->zap_loaded = 1;
		} while ((ret == -EAGAIN) && (zap_retry++ < ZAP_RETRY_MAX));
	}

	return 0;
	return ret;
}

static int _me_init_ucode_workarounds(struct adreno_device *adreno_dev)
+17 −9
Original line number Diff line number Diff line
@@ -845,7 +845,7 @@ static int a6xx_microcode_load(struct adreno_device *adreno_dev)
	struct adreno_firmware *fw = ADRENO_FW(adreno_dev, ADRENO_FW_SQE);
	uint64_t gpuaddr;
	void *zap;
	int ret = 0;
	int ret = 0, zap_retry = 0;

	gpuaddr = fw->memdesc.gpuaddr;
	kgsl_regwrite(device, A6XX_CP_SQE_INSTR_BASE_LO,
@@ -855,6 +855,13 @@ static int a6xx_microcode_load(struct adreno_device *adreno_dev)

	/* Load the zap shader firmware through PIL if its available */
	if (adreno_dev->gpucore->zap_name && !adreno_dev->zap_loaded) {
		/*
		 * subsystem_get() may return -EAGAIN in case system is busy
		 * and unable to load the firmware. So keep trying since this
		 * is not a fatal error.
		 */
		do {
			ret = 0;
			zap = subsystem_get(adreno_dev->gpucore->zap_name);

			/* Return error if the zap shader cannot be loaded */
@@ -863,6 +870,7 @@ static int a6xx_microcode_load(struct adreno_device *adreno_dev)
				zap = NULL;
			} else
				adreno_dev->zap_loaded = 1;
		} while ((ret == -EAGAIN) && (zap_retry++ < ZAP_RETRY_MAX));
	}

	return ret;