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

Commit 0130039e authored by Arun Kumar Khandavalli's avatar Arun Kumar Khandavalli Committed by Madan Koyyalamudi
Browse files

qcacmn: Add the api to set smmu fault state

There is a time involved between the smmu fault initiated
and the eventual system panic. In this time there is a
possibility of the nbuf history being overwritten losing
the information on the nbuf which might has actually caused
the SMMU fault.

Set the ssmu state and dont track the nbuf's when the smmu
fault is detected.

Change-Id: I579da332766618161567764656005ef13667270e
CRs-Fixed: 2960070
parent e61e102d
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -3968,6 +3968,20 @@ static inline void qdf_net_buf_debug_release_frag(qdf_nbuf_t buf,
}
#endif /* NBUF_FRAG_MEMORY_DEBUG */

#ifdef NBUF_MEMORY_DEBUG
/**
 * qdf_set_smmu_fault_state() - Set smmu fault sate
 * @smmu_fault_state: state of the wlan smmy
 *
 * Return: void
 */
void qdf_set_smmu_fault_state(bool smmu_fault_state);
#else
static inline void qdf_set_smmu_fault_state(bool smmu_fault_state)
{
}
#endif

#ifdef MEMORY_DEBUG
/**
 * qdf_nbuf_acquire_track_lock - acquire the nbuf spinlock at the
+22 −0
Original line number Diff line number Diff line
@@ -92,6 +92,14 @@
#define RADIOTAP_CCK_CHANNEL 0x0020
#define RADIOTAP_OFDM_CHANNEL 0x0040


#ifdef NBUF_MEMORY_DEBUG
/* SMMU crash indication*/
static qdf_atomic_t smmu_crashed;
/* Number of nbuf not added to history*/
unsigned long g_histroy_add_drop;
#endif

#ifdef FEATURE_NBUFF_REPLENISH_TIMER
#include <qdf_mc_timer.h>

@@ -699,6 +707,11 @@ qdf_nbuf_history_add(qdf_nbuf_t nbuf, const char *func, uint32_t line,
						   QDF_NBUF_HISTORY_SIZE);
	struct qdf_nbuf_event *event = &qdf_nbuf_history[idx];

	if (qdf_atomic_read(&smmu_crashed)) {
		pr_info("Not adding network buf to the list");
		return;
	}

	event->nbuf = nbuf;
	qdf_str_lcopy(event->func, func, QDF_MEM_FUNC_NAME_SIZE);
	event->line = line;
@@ -709,6 +722,14 @@ qdf_nbuf_history_add(qdf_nbuf_t nbuf, const char *func, uint32_t line,
	else
		event->iova = 0;
}

void qdf_set_smmu_fault_state(bool smmu_fault_state)
{
	qdf_atomic_set(&smmu_crashed, smmu_fault_state);
	if (!smmu_fault_state)
		g_histroy_add_drop = 0;
}
qdf_export_symbol(qdf_set_smmu_fault_state);
#endif /* NBUF_MEMORY_DEBUG */

#ifdef NBUF_MAP_UNMAP_DEBUG
@@ -4971,3 +4992,4 @@ QDF_NBUF_TRACK *qdf_nbuf_get_track_tbl(uint32_t index)
	return gp_qdf_net_buf_track_tbl[index];
}
#endif /* MEMORY_DEBUG */