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

Commit cac81e5a authored by Sivan Reinstein's avatar Sivan Reinstein Committed by Gerrit - the friendly Code Review server
Browse files

msm: ipa: stop IPA QMI workqueues when SSR is detected



When SSR is detected, all APPS <-> MPSS communication needs to stop.
Since we're using workqueues, it's possible that a delayed work
will be triggered and executed after SSR has been detected.
This change prevents this from happening by stopping all delayed
work items and putting a flag to indicate that no other work items
can be queued (Until SSR recovery is detected and the IPA QMI
client is initialized).

Change-Id: I4913f58230d41c39a0662fd2dad08af79ce24628
Signed-off-by: default avatarSivan Reinstein <sivanr@codeaurora.org>
Acked-by: default avatarDavid Arinzon <darinzon@qti.qualcomm.com>
parent 0f0c42ba
Loading
Loading
Loading
Loading
+31 −8
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ static struct work_struct ipa_qmi_service_init_work;
static bool is_load_uc;
static uint32_t ipa_wan_platform;
struct ipa_qmi_context *ipa_qmi_ctx;
static bool workqueues_stopped;

/* QMI A5 service */

@@ -316,6 +317,7 @@ static void qmi_ipa_a5_svc_ntfy(struct qmi_handle *handle,
{
	switch (event) {
	case QMI_RECV_MSG:
		if (!workqueues_stopped)
			queue_delayed_work(ipa_svc_workqueue,
					   &work_recv_msg, 0);
		break;
@@ -675,6 +677,7 @@ static void ipa_q6_clnt_notify(struct qmi_handle *handle,
	switch (event) {
	case QMI_RECV_MSG:
		IPAWANDBG("client qmi recv message called");
		if (!workqueues_stopped)
			queue_delayed_work(ipa_clnt_resp_workqueue,
					   &work_recv_msg_client, 0);
		break;
@@ -766,10 +769,12 @@ static int ipa_q6_clnt_svc_event_notify(struct notifier_block *this,
	IPAWANDBG("event %ld\n", code);
	switch (code) {
	case QMI_SERVER_ARRIVE:
		if (!workqueues_stopped)
			queue_delayed_work(ipa_clnt_req_workqueue,
					   &work_svc_arrive, 0);
		break;
	case QMI_SERVER_EXIT:
		if (!workqueues_stopped)
			queue_delayed_work(ipa_clnt_req_workqueue,
					   &work_svc_exit, 0);
		break;
@@ -877,6 +882,8 @@ int ipa_qmi_service_init(bool load_uc, uint32_t wan_platform_type)
	is_load_uc = load_uc;
	qmi_modem_init_fin = false;
	qmi_indication_fin = false;
	workqueues_stopped = false;

	if (!ipa_svc_handle) {
		INIT_WORK(&ipa_qmi_service_init_work,
			ipa_qmi_service_init_worker);
@@ -889,6 +896,8 @@ void ipa_qmi_service_exit(void)
{
	int ret = 0;

	workqueues_stopped = true;

	/* qmi-service */
	if (ipa_svc_handle) {
		ret = qmi_svc_unregister(ipa_svc_handle);
@@ -941,3 +950,17 @@ void ipa_qmi_service_exit(void)
	qmi_modem_init_fin = false;
	qmi_indication_fin = false;
}

void ipa_qmi_stop_workqueues(void)
{
	IPAWANDBG("Stopping all QMI workqueues\n");

	/* Stopping all workqueues so new work won't be scheduled */
	workqueues_stopped = true;

	/* Making sure that the current scheduled work won't be executed */
	cancel_delayed_work(&work_recv_msg);
	cancel_delayed_work(&work_recv_msg_client);
	cancel_delayed_work(&work_svc_arrive);
	cancel_delayed_work(&work_svc_exit);
}
+3 −2
Original line number Diff line number Diff line
@@ -83,6 +83,8 @@ void wan_ioctl_enable_qmi_messages(void);

void wan_ioctl_deinit(void);

void ipa_qmi_stop_workqueues(void);

extern struct elem_info ipa_init_modem_driver_req_msg_data_v01_ei[];
extern struct elem_info ipa_init_modem_driver_resp_msg_data_v01_ei[];
extern struct elem_info ipa_indication_reg_req_msg_data_v01_ei[];
@@ -108,5 +110,4 @@ struct ipa_rmnet_context {
};

extern struct ipa_rmnet_context ipa_rmnet_ctx;
#endif /* IPA_QMI_SERVICE_H
 */
#endif /* IPA_QMI_SERVICE_H */
+1 −0
Original line number Diff line number Diff line
@@ -2013,6 +2013,7 @@ static int ssr_notifier_cb(struct notifier_block *this,
		if (SUBSYS_BEFORE_SHUTDOWN == code) {
			pr_info("IPA received MPSS BEFORE_SHUTDOWN\n");
			ipa_q6_cleanup();
			ipa_qmi_stop_workqueues();
			wan_ioctl_stop_qmi_messages();
			atomic_set(&is_ssr, 1);
			if (atomic_read(&is_initialized))