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
This commit is contained in:
Arun Kumar Khandavalli
2021-06-02 14:35:42 +05:30
committed by Madan Koyyalamudi
parent aab3676557
commit 4d8b3bb683
2 changed files with 34 additions and 0 deletions

View File

@@ -4098,6 +4098,20 @@ static inline qdf_ktime_t qdf_nbuf_net_timedelta(qdf_ktime_t t)
} }
#endif /* ENHANCED_OS_ABSTRACTION */ #endif /* ENHANCED_OS_ABSTRACTION */
#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 CONFIG_NBUF_AP_PLATFORM #ifdef CONFIG_NBUF_AP_PLATFORM
#include <i_qdf_nbuf_api_w.h> #include <i_qdf_nbuf_api_w.h>
#else #else

View File

@@ -106,6 +106,13 @@ static struct qdf_track_timer alloc_track_timer;
#define QDF_NBUF_ALLOC_EXPIRE_CNT_THRESHOLD 50 #define QDF_NBUF_ALLOC_EXPIRE_CNT_THRESHOLD 50
#endif #endif
#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
/* Packet Counter */ /* Packet Counter */
static uint32_t nbuf_tx_mgmt[QDF_NBUF_TX_PKT_STATE_MAX]; static uint32_t nbuf_tx_mgmt[QDF_NBUF_TX_PKT_STATE_MAX];
static uint32_t nbuf_tx_data[QDF_NBUF_TX_PKT_STATE_MAX]; static uint32_t nbuf_tx_data[QDF_NBUF_TX_PKT_STATE_MAX];
@@ -765,6 +772,11 @@ qdf_nbuf_history_add(qdf_nbuf_t nbuf, const char *func, uint32_t line,
QDF_NBUF_HISTORY_SIZE); QDF_NBUF_HISTORY_SIZE);
struct qdf_nbuf_event *event = &qdf_nbuf_history[idx]; struct qdf_nbuf_event *event = &qdf_nbuf_history[idx];
if (qdf_atomic_read(&smmu_crashed)) {
g_histroy_add_drop++;
return;
}
event->nbuf = nbuf; event->nbuf = nbuf;
qdf_str_lcopy(event->func, func, QDF_MEM_FUNC_NAME_SIZE); qdf_str_lcopy(event->func, func, QDF_MEM_FUNC_NAME_SIZE);
event->line = line; event->line = line;
@@ -775,6 +787,14 @@ qdf_nbuf_history_add(qdf_nbuf_t nbuf, const char *func, uint32_t line,
else else
event->iova = 0; 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 */ #endif /* NBUF_MEMORY_DEBUG */
#ifdef NBUF_MAP_UNMAP_DEBUG #ifdef NBUF_MAP_UNMAP_DEBUG