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

Commit f265b303 authored by Sujeev Dias's avatar Sujeev Dias
Browse files

mhi: core: avoid triggering SYSERR if device is already in RDDM



If device gets a fatal error and a kernel panic follows, MHI host
would trigger the device to RDDM when it has already entered
RDDM. This would result in a stall on the device blocking ramdump
collection. Avoid sending SYS_ERROR to trigger device to RDDM
from kernel panic path if it is already in RDDM.

CRs-Fixed: 2425417
Change-Id: I86132e2d485f57c3f68dc97faeb1c0f90bde8832
Acked-by: default avatarBhaumik Vasav Bhatt <bbhatt@qti.qualcomm.com>
Signed-off-by: default avatarSujeev Dias <sdias@codeaurora.org>
parent 76b7b507
Loading
Loading
Loading
Loading
+30 −18
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2018, The Linux Foundation. All rights reserved. */
/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. */

#include <linux/debugfs.h>
#include <linux/delay.h>
@@ -91,7 +91,16 @@ static int __mhi_download_rddm_in_panic(struct mhi_controller *mhi_cntrl)
			    BHIE_RXVECDB_SEQNUM_BMSK, BHIE_RXVECDB_SEQNUM_SHFT,
			    sequence_id);

	MHI_LOG("Trigger device into RDDM mode\n");
	/*
	 * Make sure device is not already in RDDM.
	 * In case device asserts and a kernel panic follows, device will
	 * already be in RDDM. Do not trigger SYS ERR again and proceed with
	 * waiting for image download completion.
	 */
	ee = mhi_get_exec_env(mhi_cntrl);
	if (ee != MHI_EE_RDDM) {

		MHI_LOG("Trigger device into RDDM mode using SYSERR\n");
		mhi_set_mhi_state(mhi_cntrl, MHI_STATE_SYS_ERR);

		MHI_LOG("Waiting for device to enter RDDM\n");
@@ -104,15 +113,18 @@ static int __mhi_download_rddm_in_panic(struct mhi_controller *mhi_cntrl)
		}

		if (rddm_retry <= 0) {
		/* This is a hardware reset, will force device to enter rddm */
			/* Hardware reset; force device to enter rddm */
			MHI_LOG(
			"Did not enter RDDM triggering host req. reset to force rddm\n");
				"Did not enter RDDM, do a host req. reset\n");
			mhi_write_reg(mhi_cntrl, mhi_cntrl->regs,
			      MHI_SOC_RESET_REQ_OFFSET, MHI_SOC_RESET_REQ);
				      MHI_SOC_RESET_REQ_OFFSET,
				      MHI_SOC_RESET_REQ);
			udelay(delayus);
		}

		ee = mhi_get_exec_env(mhi_cntrl);
	}

	MHI_LOG("Waiting for image download completion, current EE:%s\n",
		TO_MHI_EXEC_STR(ee));
	while (retry--) {