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

Commit dfb9b492 authored by Ashok Vuyyuru's avatar Ashok Vuyyuru
Browse files

msm: ipa3: Fix to use client mapping instead of getting pipe index



In race condition scenarios not able to get client mapping from
pipe index because of its corresponding client was mapping was freed.
Added changes to use the client mapping directly.

Change-Id: I6663d15cd58f89f50f1a3bf21f00774067189aa8
Signed-off-by: default avatarAshok Vuyyuru <avuyyuru@codeaurora.org>
parent 72dbdc73
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -644,13 +644,11 @@ int ipa3_smmu_map_peer_buff(u64 iova, u32 size, bool map, struct sg_table *sgt,
	return 0;
}

static enum ipa_client_cb_type ipa_get_client_cb_type(u32 ipa_ep_idx)
static enum ipa_client_cb_type ipa_get_client_cb_type(
					enum ipa_client_type client_type)
{
	enum ipa_client_type client_type;
	enum ipa_client_cb_type client_cb;

	client_type = ipa3_get_client_by_pipe(ipa_ep_idx);

	if (client_type == IPA_CLIENT_USB_PROD ||
			client_type == IPA_CLIENT_USB_CONS) {
		IPADBG("USB Client registered\n");
@@ -670,10 +668,12 @@ void ipa3_register_lock_unlock_callback(int (*client_cb)(bool is_lock),
						u32 ipa_ep_idx)
{
	enum ipa_client_cb_type client;
	enum ipa_client_type client_type;

	IPADBG("entry\n");

	client = ipa_get_client_cb_type(ipa_ep_idx);
	client_type = ipa3_get_client_by_pipe(ipa_ep_idx);
	client = ipa_get_client_cb_type(client_type);
	if (client == IPA_MAX_CLNT)
		return;

@@ -690,10 +690,12 @@ void ipa3_register_lock_unlock_callback(int (*client_cb)(bool is_lock),
void ipa3_deregister_lock_unlock_callback(u32 ipa_ep_idx)
{
	enum ipa_client_cb_type client_cb;
	enum ipa_client_type client_type;

	IPADBG("entry\n");

	client_cb = ipa_get_client_cb_type(ipa_ep_idx);
	client_type = ipa3_get_client_by_pipe(ipa_ep_idx);
	client_cb = ipa_get_client_cb_type(client_type);
	if (client_cb == IPA_MAX_CLNT)
		return;

@@ -706,13 +708,13 @@ void ipa3_deregister_lock_unlock_callback(u32 ipa_ep_idx)
	IPADBG("exit\n");
}

static void client_lock_unlock_cb(u32 ipa_ep_idx, bool is_lock)
static void client_lock_unlock_cb(enum ipa_client_type client, bool is_lock)
{
	enum ipa_client_cb_type client_cb;

	IPADBG("entry\n");

	client_cb = ipa_get_client_cb_type(ipa_ep_idx);
	client_cb = ipa_get_client_cb_type(client);
	if (client_cb == IPA_MAX_CLNT)
		return;

@@ -1380,7 +1382,7 @@ int ipa3_set_reset_client_prod_pipe_delay(bool set_reset,
	ep = &ipa3_ctx->ep[pipe_idx];

	/* Setting delay on USB_PROD with skip_ep_cfg */
	client_lock_unlock_cb(pipe_idx, true);
	client_lock_unlock_cb(client, true);
	if (ep->valid && ep->skip_ep_cfg) {
		ep->ep_delay_set = ep_ctrl.ipa_ep_delay;
		result = ipa3_cfg_ep_ctrl(pipe_idx, &ep_ctrl);
@@ -1390,7 +1392,7 @@ int ipa3_set_reset_client_prod_pipe_delay(bool set_reset,
		else
			IPADBG("client (ep: %d) success\n", pipe_idx);
	}
	client_lock_unlock_cb(pipe_idx, false);
	client_lock_unlock_cb(client, false);
	return result;
}

@@ -1423,7 +1425,7 @@ int ipa3_set_reset_client_cons_pipe_sus_holb(bool set_reset,

	ep = &ipa3_ctx->ep[pipe_idx];
	/* Setting sus/holb on MHI_CONS with skip_ep_cfg */
	client_lock_unlock_cb(pipe_idx, true);
	client_lock_unlock_cb(client, true);
	if (ep->valid && ep->skip_ep_cfg) {
		if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_0)
			ipahal_write_reg_n_fields(
@@ -1442,7 +1444,7 @@ int ipa3_set_reset_client_cons_pipe_sus_holb(bool set_reset,
			IPA_ENDP_INIT_HOL_BLOCK_EN_n,
			pipe_idx, &ep_holb);
	}
	client_lock_unlock_cb(pipe_idx, false);
	client_lock_unlock_cb(client, false);
	return 0;
}