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

Commit a9840763 authored by Skylar Chang's avatar Skylar Chang Committed by Gerrit - the friendly Code Review server
Browse files

msm: ipa: fix a race condition in teardown pipe



Starting IPA 4.0 a pipe cannot be suspended. Instead the GSI
channel needs to be stopped. This change moves the GSI stop
to the same place where pipe suspend used to be.

Change-Id: I5b7f2301490cf45f6f02c4ede84a75925b381e6e
CRs-Fixed: 2244241
Acked-by: default avatarAdy Abraham <adya@qti.qualcomm.com>
Signed-off-by: default avatarSkylar Chang <chiaweic@codeaurora.org>
parent 90551fd1
Loading
Loading
Loading
Loading
+12 −9
Original line number Diff line number Diff line
@@ -1113,11 +1113,6 @@ int ipa3_teardown_sys_pipe(u32 clnt_hdl)
		IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));

	ipa3_disable_data_path(clnt_hdl);
	if (ep->napi_enabled) {
		do {
			usleep_range(95, 105);
		} while (atomic_read(&ep->sys->curr_polling_state));
	}

	if (IPA_CLIENT_IS_PROD(ep->client)) {
		do {
@@ -1131,9 +1126,6 @@ int ipa3_teardown_sys_pipe(u32 clnt_hdl)
		} while (1);
	}

	if (IPA_CLIENT_IS_CONS(ep->client))
		cancel_delayed_work_sync(&ep->sys->replenish_rx_work);
	flush_workqueue(ep->sys->wq);
	/* channel stop might fail on timeout if IPA is busy */
	for (i = 0; i < IPA_GSI_CHANNEL_STOP_MAX_RETRY; i++) {
		result = ipa3_stop_gsi_channel(clnt_hdl);
@@ -1150,6 +1142,17 @@ int ipa3_teardown_sys_pipe(u32 clnt_hdl)
		ipa_assert();
		return result;
	}

	if (ep->napi_enabled) {
		do {
			usleep_range(95, 105);
		} while (atomic_read(&ep->sys->curr_polling_state));
	}

	if (IPA_CLIENT_IS_CONS(ep->client))
		cancel_delayed_work_sync(&ep->sys->replenish_rx_work);
	flush_workqueue(ep->sys->wq);

	result = ipa3_reset_gsi_channel(clnt_hdl);
	if (result != GSI_STATUS_SUCCESS) {
		IPAERR("Failed to reset chan: %d.\n", result);