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

Commit 943920d4 authored by Lior David's avatar Lior David
Browse files

msm_11ad: copy FW crash dump before starting SSR flow



Currently when WIGIG FW crashes and SSR is in SYSTEM mode,
SSR causes a kernel panic and its panic handler will call
msm_11ad_ssr_crash_shutdown which will copy the FW crash
dump. However this is done when kernel panic is in progress
and kernel is not fully operational, so sometimes the copy
fails and the FW crash dump will not be found in the DDR
dump from the device.
Fix this problem by copying the FW crash dump before
notifying SSR, so the crash dump will always be copied
correctly when WIGIG FW crashes.
We also keep copying in crash_shutdown so the WIGIG FW
crash dump will be available also after normal kernel
panics, though it is not always copied in this case.

Change-Id: Idabb1497d8a1f60a74191f1c93ec5b2ce3b3043c
Signed-off-by: default avatarLior David <liord@codeaurora.org>
parent 4166896b
Loading
Loading
Loading
Loading
+26 −21
Original line number Diff line number Diff line
@@ -729,6 +729,25 @@ static int msm_11ad_ssr_powerup(const struct subsys_desc *subsys)
	return rc;
}

static int msm_11ad_ssr_copy_ramdump(struct msm11ad_ctx *ctx)
{
	if (ctx->rops.ramdump && ctx->wil_handle) {
		int rc = ctx->rops.ramdump(ctx->wil_handle, ctx->ramdump_addr,
					   WIGIG_RAMDUMP_SIZE);
		if (rc) {
			dev_err(ctx->dev, "ramdump failed : %d\n", rc);
			return -EINVAL;
		}
	}

	ctx->dump_data.version = WIGIG_DUMP_FORMAT_VER;
	strlcpy(ctx->dump_data.name, WIGIG_SUBSYS_NAME,
		sizeof(ctx->dump_data.name));

	ctx->dump_data.magic = WIGIG_DUMP_MAGIC_VER_V1;
	return 0;
}

static int msm_11ad_ssr_ramdump(int enable, const struct subsys_desc *subsys)
{
	int rc;
@@ -745,13 +764,10 @@ static int msm_11ad_ssr_ramdump(int enable, const struct subsys_desc *subsys)
	if (!enable)
		return 0;

	if (ctx->rops.ramdump && ctx->wil_handle) {
		rc = ctx->rops.ramdump(ctx->wil_handle, ctx->ramdump_addr,
				       WIGIG_RAMDUMP_SIZE);
		if (rc) {
			dev_err(ctx->dev, "ramdump failed : %d\n", rc);
			return -EINVAL;
		}
	if (!ctx->recovery_in_progress) {
		rc = msm_11ad_ssr_copy_ramdump(ctx);
		if (rc)
			return rc;
	}

	memset(&segment, 0, sizeof(segment));
@@ -763,7 +779,6 @@ static int msm_11ad_ssr_ramdump(int enable, const struct subsys_desc *subsys)

static void msm_11ad_ssr_crash_shutdown(const struct subsys_desc *subsys)
{
	int rc;
	struct platform_device *pdev;
	struct msm11ad_ctx *ctx;

@@ -775,19 +790,8 @@ static void msm_11ad_ssr_crash_shutdown(const struct subsys_desc *subsys)
		return;
	}

	if (ctx->rops.ramdump && ctx->wil_handle) {
		rc = ctx->rops.ramdump(ctx->wil_handle, ctx->ramdump_addr,
				       WIGIG_RAMDUMP_SIZE);
		if (rc)
			dev_err(ctx->dev, "ramdump failed : %d\n", rc);
		/* continue */
	}

	ctx->dump_data.version = WIGIG_DUMP_FORMAT_VER;
	strlcpy(ctx->dump_data.name, WIGIG_SUBSYS_NAME,
		sizeof(ctx->dump_data.name));

	ctx->dump_data.magic = WIGIG_DUMP_MAGIC_VER_V1;
	if (!ctx->recovery_in_progress)
		(void)msm_11ad_ssr_copy_ramdump(ctx);
}

static void msm_11ad_ssr_deinit(struct msm11ad_ctx *ctx)
@@ -1264,6 +1268,7 @@ static int msm_11ad_notify_crash(struct msm11ad_ctx *ctx)

	if (ctx->subsys) {
		dev_info(ctx->dev, "SSR requested\n");
		(void)msm_11ad_ssr_copy_ramdump(ctx);
		ctx->recovery_in_progress = true;
		rc = subsystem_restart_dev(ctx->subsys);
		if (rc) {