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

Commit 10389085 authored by Rishabh Bhatnagar's avatar Rishabh Bhatnagar
Browse files

esoc: Wait for modem status to go low in crash shutdown



Wait for modem status to go low in crash shutdown. This helps
cover the race condition where there is a crash during graceful
shutdown and we end up in crash path and send crash notification
to clients even before the modem status has gone low. Also set
the crash flag in interrupt path to avoid double queueing of ssr
work.

Change-Id: I680b79c7a1de5e44cb9fcfa0f9d67517c0398f62
Signed-off-by: default avatarRishabh Bhatnagar <rishabhb@codeaurora.org>
parent aac560a6
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -184,6 +184,7 @@ static void mdm_handle_clink_evt(enum esoc_evt evt,
			esoc_mdm_log("Modem not up. Ignoring.\n");
			esoc_mdm_log("Modem not up. Ignoring.\n");
		if (mdm_drv->mode == CRASH || mdm_drv->mode != RUN)
		if (mdm_drv->mode == CRASH || mdm_drv->mode != RUN)
			return;
			return;
		mdm_drv->mode = CRASH;
		queue_work(mdm_drv->mdm_queue, &mdm_drv->ssr_work);
		queue_work(mdm_drv->mdm_queue, &mdm_drv->ssr_work);
		break;
		break;
	case ESOC_REQ_ENG_ON:
	case ESOC_REQ_ENG_ON:
@@ -205,8 +206,7 @@ static void mdm_ssr_fn(struct work_struct *work)


	mdm_wait_for_status_low(mdm, false);
	mdm_wait_for_status_low(mdm, false);


	esoc_mdm_log("Starting SSR work and setting crash state\n");
	esoc_mdm_log("Starting SSR work\n");
	mdm_drv->mode = CRASH;


	/*
	/*
	 * If restarting esoc fails, the SSR framework triggers a kernel panic
	 * If restarting esoc fails, the SSR framework triggers a kernel panic
@@ -289,12 +289,14 @@ static int mdm_subsys_shutdown(const struct subsys_desc *crashed_subsys,
	 container_of(crashed_subsys, struct esoc_clink, subsys);
	 container_of(crashed_subsys, struct esoc_clink, subsys);
	struct mdm_drv *mdm_drv = esoc_get_drv_data(esoc_clink);
	struct mdm_drv *mdm_drv = esoc_get_drv_data(esoc_clink);
	const struct esoc_clink_ops * const clink_ops = esoc_clink->clink_ops;
	const struct esoc_clink_ops * const clink_ops = esoc_clink->clink_ops;
	struct mdm_ctrl *mdm = get_esoc_clink_data(mdm_drv->esoc_clink);


	esoc_mdm_log("Shutdown request from SSR\n");
	esoc_mdm_log("Shutdown request from SSR\n");


	mutex_lock(&mdm_drv->poff_lock);
	mutex_lock(&mdm_drv->poff_lock);
	if (mdm_drv->mode == CRASH || mdm_drv->mode == PEER_CRASH) {
	if (mdm_drv->mode == CRASH || mdm_drv->mode == PEER_CRASH) {
		esoc_mdm_log("Shutdown in crash mode\n");
		esoc_mdm_log("Shutdown in crash mode\n");
		mdm_wait_for_status_low(mdm, false);
		if (mdm_dbg_stall_cmd(ESOC_PREPARE_DEBUG)) {
		if (mdm_dbg_stall_cmd(ESOC_PREPARE_DEBUG)) {
			/* We want to mask debug command.
			/* We want to mask debug command.
			 * In this case return success
			 * In this case return success