iwlwifi: yoyo: send hcmd to fw after dump collection completes.
authorMukesh Sisodiya <mukesh.sisodiya@intel.com>
Thu, 10 Feb 2022 16:22:34 +0000 (18:22 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Fri, 18 Feb 2022 08:40:55 +0000 (10:40 +0200)
Send a command to FW once the driver completes the dump collection
for the timepoint which requires the command to be send.

Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20220210181930.b8c1228a0c0a.I71da6a799253650f3d0b181315de388cb9360e30@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/api/dbg-tlv.h
drivers/net/wireless/intel/iwlwifi/fw/api/debug.h
drivers/net/wireless/intel/iwlwifi/fw/dbg.c
drivers/net/wireless/intel/iwlwifi/fw/dbg.h
drivers/net/wireless/intel/iwlwifi/fw/file.h

index 55edd5a..52bf965 100644 (file)
@@ -475,6 +475,7 @@ enum iwl_fw_ini_time_point {
  * @IWL_FW_INI_APPLY_POLICY_OVERRIDE_CFG: override trigger configuration
  * @IWL_FW_INI_APPLY_POLICY_OVERRIDE_DATA: override trigger data.
  *     Append otherwise
+ * @IWL_FW_INI_APPLY_POLICY_DUMP_COMPLETE_CMD: send cmd once dump collected
  */
 enum iwl_fw_ini_trigger_apply_policy {
        IWL_FW_INI_APPLY_POLICY_MATCH_TIME_POINT        = BIT(0),
@@ -482,6 +483,7 @@ enum iwl_fw_ini_trigger_apply_policy {
        IWL_FW_INI_APPLY_POLICY_OVERRIDE_REGIONS        = BIT(8),
        IWL_FW_INI_APPLY_POLICY_OVERRIDE_CFG            = BIT(9),
        IWL_FW_INI_APPLY_POLICY_OVERRIDE_DATA           = BIT(10),
+       IWL_FW_INI_APPLY_POLICY_DUMP_COMPLETE_CMD       = BIT(16),
 };
 
 /**
index 029ae64..6255257 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
 /*
- * Copyright (C) 2005-2014, 2018-2020 Intel Corporation
+ * Copyright (C) 2005-2014, 2018-2022 Intel Corporation
  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
  * Copyright (C) 2016-2017 Intel Deutschland GmbH
  */
@@ -42,6 +42,12 @@ enum iwl_debug_cmds {
         * &struct iwl_buf_alloc_cmd
         */
        BUFFER_ALLOCATION = 0x8,
+       /**
+        * @FW_DUMP_COMPLETE_CMD:
+        * sends command to fw once dump collection completed
+        * &struct iwl_dbg_dump_complete_cmd
+        */
+       FW_DUMP_COMPLETE_CMD = 0xB,
        /**
         * @MFU_ASSERT_DUMP_NTF:
         * &struct iwl_mfu_assert_dump_notif
@@ -404,4 +410,15 @@ struct iwl_dbg_host_event_cfg_cmd {
        __le32 enabled_severities;
 } __packed; /* DEBUG_HOST_EVENT_CFG_CMD_API_S_VER_1 */
 
+/**
+ * struct iwl_dbg_dump_complete_cmd - dump complete cmd
+ *
+ * @tp: timepoint whose dump has completed
+ * @tp_data: timepoint data
+ */
+struct iwl_dbg_dump_complete_cmd {
+       __le32 tp;
+       __le32 tp_data;
+} __packed; /* FW_DUMP_COMPLETE_CMD_API_S_VER_1 */
+
 #endif /* __iwl_fw_api_debug_h__ */
index 656a5e7..a08f80b 100644 (file)
@@ -2845,6 +2845,28 @@ int iwl_fw_start_dbg_conf(struct iwl_fw_runtime *fwrt, u8 conf_id)
 }
 IWL_EXPORT_SYMBOL(iwl_fw_start_dbg_conf);
 
+void iwl_send_dbg_dump_complete_cmd(struct iwl_fw_runtime *fwrt,
+                                   u32 timepoint,
+                                   u32 timepoint_data)
+{
+       struct iwl_dbg_dump_complete_cmd hcmd_data;
+       struct iwl_host_cmd hcmd = {
+               .id = WIDE_ID(DEBUG_GROUP, FW_DUMP_COMPLETE_CMD),
+               .data[0] = &hcmd_data,
+               .len[0] = sizeof(hcmd_data),
+       };
+
+       if (test_bit(STATUS_FW_ERROR, &fwrt->trans->status))
+               return;
+
+       if (fw_has_capa(&fwrt->fw->ucode_capa,
+                       IWL_UCODE_TLV_CAPA_DUMP_COMPLETE_SUPPORT)) {
+               hcmd_data.tp = cpu_to_le32(timepoint);
+               hcmd_data.tp_data = cpu_to_le32(timepoint_data);
+               iwl_trans_send_cmd(fwrt->trans, &hcmd);
+       }
+}
+
 /* this function assumes dump_start was called beforehand and dump_end will be
  * called afterwards
  */
@@ -2853,7 +2875,8 @@ static void iwl_fw_dbg_collect_sync(struct iwl_fw_runtime *fwrt, u8 wk_idx)
        struct iwl_fw_dbg_params params = {0};
        struct iwl_fwrt_dump_data *dump_data =
                &fwrt->dump.wks[wk_idx].dump_data;
-
+       u32 policy;
+       u32 time_point;
        if (!test_bit(wk_idx, &fwrt->dump.active_wks))
                return;
 
@@ -2879,6 +2902,13 @@ static void iwl_fw_dbg_collect_sync(struct iwl_fw_runtime *fwrt, u8 wk_idx)
 
        iwl_fw_dbg_stop_restart_recording(fwrt, &params, false);
 
+       policy = le32_to_cpu(dump_data->trig->apply_policy);
+       time_point = le32_to_cpu(dump_data->trig->time_point);
+
+       if (policy & IWL_FW_INI_APPLY_POLICY_DUMP_COMPLETE_CMD) {
+               IWL_DEBUG_FW_INFO(fwrt, "WRT: sending dump complete\n");
+               iwl_send_dbg_dump_complete_cmd(fwrt, time_point, 0);
+       }
        if (fwrt->trans->dbg.last_tp_resetfw == IWL_FW_INI_RESET_FW_MODE_STOP_FW_ONLY)
                iwl_force_nmi(fwrt->trans);
 
index 8c3c890..be78064 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
 /*
- * Copyright (C) 2005-2014, 2018-2019, 2021 Intel Corporation
+ * Copyright (C) 2005-2014, 2018-2019, 2021-2022 Intel Corporation
  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
  * Copyright (C) 2015-2017 Intel Deutschland GmbH
  */
@@ -324,4 +324,7 @@ static inline void iwl_fwrt_update_fw_versions(struct iwl_fw_runtime *fwrt,
 }
 
 void iwl_fwrt_dump_error_logs(struct iwl_fw_runtime *fwrt);
+void iwl_send_dbg_dump_complete_cmd(struct iwl_fw_runtime *fwrt,
+                                   u32 timepoint,
+                                   u32 timepoint_data);
 #endif  /* __iwl_fw_dbg_h__ */
index 5b30136..f44aedb 100644 (file)
@@ -369,6 +369,8 @@ typedef unsigned int __bitwise iwl_ucode_tlv_capa_t;
  *     reset flow
  * @IWL_UCODE_TLV_CAPA_PASSIVE_6GHZ_SCAN: Support for passive scan on 6GHz PSC
  *      channels even when these are not enabled.
+ * @IWL_UCODE_TLV_CAPA_DUMP_COMPLETE_SUPPORT: Support for indicating dump collection
+ *     complete to FW.
  *
  * @NUM_IWL_UCODE_TLV_CAPA: number of bits used
  */
@@ -454,6 +456,7 @@ enum iwl_ucode_tlv_capa {
 
        IWL_UCODE_TLV_CAPA_BIGTK_SUPPORT                = (__force iwl_ucode_tlv_capa_t)100,
        IWL_UCODE_TLV_CAPA_DRAM_FRAG_SUPPORT            = (__force iwl_ucode_tlv_capa_t)104,
+       IWL_UCODE_TLV_CAPA_DUMP_COMPLETE_SUPPORT        = (__force iwl_ucode_tlv_capa_t)105,
 
 #ifdef __CHECKER__
        /* sparse says it cannot increment the previous enum member */