Linux wireless drivers development
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: kvalo@codeaurora.org
Cc: linux-wireless@vger.kernel.org,
	Shahar S Matityahu <shahar.s.matityahu@intel.com>,
	Luca Coelho <luciano.coelho@intel.com>
Subject: [PATCH 17/20] iwlwifi: dbg_ini: fix debug monitor stop and restart in ini mode
Date: Fri, 28 Jun 2019 12:20:05 +0300	[thread overview]
Message-ID: <20190628092008.11049-18-luca@coelho.fi> (raw)
In-Reply-To: <20190628092008.11049-1-luca@coelho.fi>

From: Shahar S Matityahu <shahar.s.matityahu@intel.com>

In ini debug mode the recording does not restart unless legacy monitor
configuration is also given.

Add dbg_ini_dest field to trans to indicate the debug monitor
destination to solve this.

Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/fw/dbg.c   | 19 +++++++++++++-----
 drivers/net/wireless/intel/iwlwifi/fw/dbg.h   | 20 ++++++++++++++++++-
 .../net/wireless/intel/iwlwifi/iwl-trans.h    |  2 ++
 3 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
index 8dc56f14a5cb..38c30fd905ed 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
@@ -2381,11 +2381,7 @@ static void iwl_fw_dbg_collect_sync(struct iwl_fw_runtime *fwrt, u8 wk_idx)
 		iwl_fw_error_dump(fwrt);
 	IWL_DEBUG_FW_INFO(fwrt, "WRT: data collection done\n");
 
-	/* start recording again if the firmware is not crashed */
-	if (!test_bit(STATUS_FW_ERROR, &fwrt->trans->status) &&
-	    fwrt->fw->dbg.dest_tlv) {
-		iwl_fw_dbg_restart_recording(fwrt, &params);
-	}
+	iwl_fw_dbg_restart_recording(fwrt, &params);
 
 out:
 	clear_bit(wk_idx, &fwrt->dump.active_wks);
@@ -2516,6 +2512,17 @@ static void iwl_fw_dbg_buffer_apply(struct iwl_fw_runtime *fwrt,
 	int block_idx = trans->dbg.num_blocks;
 	u32 buf_location = le32_to_cpu(alloc->tlv.buffer_location);
 
+	if (fwrt->trans->dbg.ini_dest == IWL_FW_INI_LOCATION_INVALID)
+		fwrt->trans->dbg.ini_dest = buf_location;
+
+	if (buf_location != fwrt->trans->dbg.ini_dest) {
+		WARN(fwrt,
+		     "WRT: attempt to override buffer location on apply point %d\n",
+		     pnt);
+
+		return;
+	}
+
 	if (buf_location == IWL_FW_INI_LOCATION_SRAM_PATH) {
 		IWL_DEBUG_FW(trans, "WRT: applying SMEM buffer destination\n");
 		/* set sram monitor by enabling bit 7 */
@@ -2832,6 +2839,8 @@ static void iwl_fw_dbg_ini_reset_cfg(struct iwl_fw_runtime *fwrt)
 	       sizeof(fwrt->dump.internal_dbg_cfg_name));
 	memset(fwrt->dump.external_dbg_cfg_name, 0,
 	       sizeof(fwrt->dump.external_dbg_cfg_name));
+
+	fwrt->trans->dbg.ini_dest = IWL_FW_INI_LOCATION_INVALID;
 }
 
 void iwl_fw_dbg_apply_point(struct iwl_fw_runtime *fwrt,
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.h b/drivers/net/wireless/intel/iwlwifi/fw/dbg.h
index 06cdf272e38d..c2d91f645b0f 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.h
@@ -309,6 +309,14 @@ static inline void
 iwl_fw_dbg_stop_recording(struct iwl_fw_runtime *fwrt,
 			  struct iwl_fw_dbg_params *params)
 {
+	/* if the FW crashed or not debug monitor cfg was given, there is
+	 * no point in stopping
+	 */
+	if (test_bit(STATUS_FW_ERROR, &fwrt->trans->status) ||
+	    (!fwrt->trans->dbg.dest_tlv &&
+	     fwrt->trans->dbg.ini_dest == IWL_FW_INI_LOCATION_INVALID))
+		return;
+
 	if (fwrt->trans->cfg->device_family < IWL_DEVICE_FAMILY_22560)
 		_iwl_fw_dbg_stop_recording(fwrt->trans, params);
 	else
@@ -335,7 +343,9 @@ _iwl_fw_dbg_restart_recording(struct iwl_trans *trans,
 #ifdef CONFIG_IWLWIFI_DEBUGFS
 static inline void iwl_fw_set_dbg_rec_on(struct iwl_fw_runtime *fwrt)
 {
-	if (fwrt->fw->dbg.dest_tlv && fwrt->cur_fw_img == IWL_UCODE_REGULAR)
+	if (fwrt->cur_fw_img == IWL_UCODE_REGULAR &&
+	    (fwrt->fw->dbg.dest_tlv ||
+	     fwrt->trans->dbg.ini_dest != IWL_FW_INI_LOCATION_INVALID))
 		fwrt->trans->dbg.rec_on = true;
 }
 #endif
@@ -344,6 +354,14 @@ static inline void
 iwl_fw_dbg_restart_recording(struct iwl_fw_runtime *fwrt,
 			     struct iwl_fw_dbg_params *params)
 {
+	/* if the FW crashed or not debug monitor cfg was given, there is
+	 * no point in restarting
+	 */
+	if (test_bit(STATUS_FW_ERROR, &fwrt->trans->status) ||
+	    (!fwrt->trans->dbg.dest_tlv &&
+	     fwrt->trans->dbg.ini_dest == IWL_FW_INI_LOCATION_INVALID))
+		return;
+
 	if (fwrt->trans->cfg->device_family < IWL_DEVICE_FAMILY_22560)
 		_iwl_fw_dbg_restart_recording(fwrt->trans, params);
 	else
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
index 90707c576ce4..0f8aeb111b0e 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
@@ -738,6 +738,7 @@ struct iwl_self_init_dram {
  * @num_blocks: number of blocks in fw_mon
  * @fw_mon: address of the buffers for firmware monitor
  * @hw_error: equals true if hw error interrupt was received from the FW
+ * @ini_dest: debug monitor destination uses &enum iwl_fw_ini_buffer_location
  */
 struct iwl_trans_debug {
 	u8 n_dest_reg;
@@ -761,6 +762,7 @@ struct iwl_trans_debug {
 	struct iwl_dram_data fw_mon[IWL_FW_INI_APPLY_NUM];
 
 	bool hw_error;
+	enum iwl_fw_ini_buffer_location ini_dest;
 };
 
 /**
-- 
2.20.1


  parent reply	other threads:[~2019-06-28  9:21 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28  9:19 [PATCH 00/20] iwlwifi: updates intended for v5.3 2019-06-28 Luca Coelho
2019-06-28  9:19 ` [PATCH 01/20] iwlwifi: lib: Use struct_size() helper Luca Coelho
2019-06-28  9:19 ` [PATCH 02/20] iwlwifi: d3: " Luca Coelho
2019-06-28  9:19 ` [PATCH 03/20] iwlwifi: remove some unnecessary NULL checks Luca Coelho
2019-06-28  9:19 ` [PATCH 04/20] iwlwifi: mvm: correctly fill the ac array in the iwl_mac_ctx_cmd Luca Coelho
2019-06-28  9:19 ` [PATCH 05/20] iwlwifi: mvm: convert to FW AC when configuring MU EDCA Luca Coelho
2019-06-28  9:19 ` [PATCH 06/20] iwlwifi: fix module init error paths Luca Coelho
2019-06-28  9:19 ` [PATCH 07/20] iwlwifi: Add support for SAR South Korea limitation Luca Coelho
2019-06-28  9:19 ` [PATCH 08/20] iwlwifi: mvm: Add log information about SAR status Luca Coelho
2019-09-30 12:06   ` Matteo Croce
2019-09-30 12:12     ` Luca Coelho
2019-06-28  9:19 ` [PATCH 09/20] iwlwifi: mvm: Drop large non sta frames Luca Coelho
2019-06-28  9:19 ` [PATCH 10/20] iwlwifi: pcie: increase the size of PCI dumps Luca Coelho
2019-06-28  9:19 ` [PATCH 11/20] iwlwifi: dbg: fix debug monitor stop and restart delays Luca Coelho
2019-06-28  9:20 ` [PATCH 12/20] iwlwifi: dbg_ini: enforce apply point early on buffer allocation tlv Luca Coelho
2019-06-28  9:20 ` [PATCH 13/20] iwlwifi: dbg_ini: remove redundant checking of ini mode Luca Coelho
2019-06-28  9:20 ` [PATCH 14/20] iwlwifi: dbg: move trans debug fields to a separate struct Luca Coelho
2019-06-28  9:20 ` [PATCH 15/20] iwlwifi: support FSEQ TLV even when FMAC is not compiled Luca Coelho
2019-06-28  9:20 ` [PATCH 16/20] iwlwifi: mvm: make the usage of TWT configurable Luca Coelho
2019-06-28  9:20 ` Luca Coelho [this message]
2019-06-28  9:20 ` [PATCH 18/20] iwlwifi: dbg: don't stop dbg recording before entering D3 from 9000 devices Luca Coelho
2019-06-28  9:20 ` [PATCH 19/20] iwlwifi: dbg: debug recording stop and restart command remove Luca Coelho
2019-06-28  9:20 ` [PATCH 20/20] iwlwifi: mvm: remove MAC_FILTER_IN_11AX for AP mode Luca Coelho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190628092008.11049-18-luca@coelho.fi \
    --to=luca@coelho.fi \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luciano.coelho@intel.com \
    --cc=shahar.s.matityahu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox