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

Commit a6c8f057 authored by Yeshwanth Sriram Guntuka's avatar Yeshwanth Sriram Guntuka Committed by Gerrit - the friendly Code Review server
Browse files

qcacmn: Do RTPM put during cleanup when HTT ver resp is not received

For HTT h2t message which has a response from FW, runtime
get is done in HTC layer and the corresponding runtime_put
is done as part of the HTT response processing. In a scenario
where the HTT response is not received from FW or not processed
by host, runtime_put is not done as part of cleanup and panic
is triggered due to get/put imbalance.

Fix is to do RTPM put as part of htc cleanup when the HTT
response from FW is not received or processed.

Change-Id: I17ccb7c3e2293c95f5f233d36c6ef38a75733cce
CRs-Fixed: 2779113
parent 309ff81b
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -744,7 +744,7 @@ static int htt_h2t_ver_req_msg(struct htt_soc *soc)
	SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt,
		dp_htt_h2t_send_complete_free_netbuf, qdf_nbuf_data(msg),
		qdf_nbuf_len(msg), soc->htc_endpoint,
		1); /* tag - not relevant here */
		HTC_TX_PACKET_TAG_RTPM_PUT_RC);

	SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
	status = DP_HTT_SEND_HTC_PKT(soc, pkt, HTT_H2T_MSG_TYPE_VERSION_REQ,
@@ -3969,6 +3969,14 @@ static void dp_htt_t2h_msg_handler(void *context, HTC_PACKET *pkt)

	case HTT_T2H_MSG_TYPE_VERSION_CONF:
		{
			/*
			 * HTC maintains runtime pm count for H2T messages that
			 * have a response msg from FW. This count ensures that
			 * in the case FW does not sent out the response or host
			 * did not process this indication runtime_put happens
			 * properly in the cleanup path.
			 */
			if (htc_dec_return_runtime_cnt(soc->htc_soc) >= 0)
				htc_pm_runtime_put(soc->htc_soc);
			soc->tgt_ver.major = HTT_VER_CONF_MAJOR_GET(*msg_word);
			soc->tgt_ver.minor = HTT_VER_CONF_MINOR_GET(*msg_word);
+27 −0
Original line number Diff line number Diff line
@@ -154,6 +154,9 @@ static void htc_cleanup(HTC_TARGET *target)
	HTC_PACKET_QUEUE *pkt_queue;
	qdf_nbuf_t netbuf;

	while (htc_dec_return_runtime_cnt((void *)target) >= 0)
		hif_pm_runtime_put(target->hif_dev, RTPM_ID_HTC);

	if (target->hif_dev) {
		hif_detach_htc(target->hif_dev);
		hif_mask_interrupt_call(target->hif_dev);
@@ -271,9 +274,32 @@ static void htc_runtime_pm_deinit(HTC_TARGET *target)
	qdf_destroy_work(0, &target->queue_kicker);
}

int32_t htc_dec_return_runtime_cnt(HTC_HANDLE htc)
{
	HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(htc);

	return qdf_atomic_dec_return(&target->htc_runtime_cnt);
}

/**
 * htc_init_runtime_cnt: Initialize htc runtime count
 * @htc: HTC handle
 *
 * Return: None
 */
static inline
void htc_init_runtime_cnt(HTC_TARGET *target)
{
	qdf_atomic_init(&target->htc_runtime_cnt);
}
#else
static inline void htc_runtime_pm_init(HTC_TARGET *target) { }
static inline void htc_runtime_pm_deinit(HTC_TARGET *target) { }

static inline
void htc_init_runtime_cnt(HTC_TARGET *target)
{
}
#endif

#if defined(DEBUG_HL_LOGGING) && defined(CONFIG_HL_SUPPORT)
@@ -378,6 +404,7 @@ HTC_HANDLE htc_create(void *ol_sc, struct htc_init_info *pInfo,
	} while (false);

	htc_recv_init(target);
	htc_init_runtime_cnt(target);

	HTC_TRACE("-htc_create: (0x%pK)", target);

+14 −0
Original line number Diff line number Diff line
@@ -781,9 +781,23 @@ void htc_clear_bundle_stats(HTC_HANDLE HTCHandle);
#ifdef FEATURE_RUNTIME_PM
int htc_pm_runtime_get(HTC_HANDLE htc_handle);
int htc_pm_runtime_put(HTC_HANDLE htc_handle);

/**
 * htc_dec_return_runtime_cnt: Decrement htc runtime count
 * @htc: HTC handle
 *
 * Return: value of runtime count after decrement
 */
int32_t htc_dec_return_runtime_cnt(HTC_HANDLE htc);
#else
static inline int htc_pm_runtime_get(HTC_HANDLE htc_handle) { return 0; }
static inline int htc_pm_runtime_put(HTC_HANDLE htc_handle) { return 0; }

static inline
int32_t htc_dec_return_runtime_cnt(HTC_HANDLE htc)
{
	return -1;
}
#endif

/**
+5 −0
Original line number Diff line number Diff line
@@ -248,6 +248,11 @@ typedef struct _HTC_TARGET {
	uint8_t wmi_ep_count;
	/* Flag to indicate whether htc header length check is required */
	bool htc_hdr_length_check;

#ifdef FEATURE_RUNTIME_PM
	/* Runtime count for H2T msg with response */
	qdf_atomic_t htc_runtime_cnt;
#endif
} HTC_TARGET;


+3 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2014, 2016-2017, 2019 The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2014, 2016-2017, 2019-2020 The Linux Foundation. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for
 * any purpose with or without fee is hereby granted, provided that the
@@ -76,6 +76,8 @@ struct htc_tx_packet_info {
/* Tag packet for runtime put after sending */
#define HTC_TX_PACKET_TAG_RUNTIME_PUT  (HTC_TX_PACKET_TAG_USER_DEFINED + 3)

/*Tag packet for runtime put in response or cleanup */
#define HTC_TX_PACKET_TAG_RTPM_PUT_RC  (HTC_TX_PACKET_TAG_USER_DEFINED + 4)

#define HTC_TX_PACKET_FLAG_FIXUP_NETBUF (1 << 0)
#define HTC_TX_PACKET_FLAG_HTC_HEADER_IN_NETBUF_DATA (1 << 1)
Loading