]> git.baikalelectronics.ru Git - kernel.git/commitdiff
iwlwifi: pcie: dump error on FW reset handshake failures
authorJohannes Berg <johannes.berg@intel.com>
Mon, 2 Aug 2021 14:09:40 +0000 (17:09 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Thu, 26 Aug 2021 20:32:21 +0000 (23:32 +0300)
If the firmware crashes while we're waiting for the reset
handshake then it cannot possibly make progress anymore,
and we will just time out the wait. That's pointless, so
just stop waiting at that point.

Additionally, if it never acknowledges the reset handshake,
something went wrong.

Dump an error in both of these cases, but we need to do it
synchronously here since the device will be turned off.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210802170640.8b6a33544b4b.I55f97f70f8efa64db064a9207177a094c60ac8f1@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/pcie/internal.h
drivers/net/wireless/intel/iwlwifi/pcie/rx.c
drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c

index 10d763fc3d5042b1d325c020818792d2bfd41cd6..6c3b0403b68f0cd169d191a7e8f3f3f720db7aec 100644 (file)
@@ -254,6 +254,13 @@ struct cont_rec {
 };
 #endif
 
+enum iwl_pcie_fw_reset_state {
+       FW_RESET_IDLE,
+       FW_RESET_REQUESTED,
+       FW_RESET_OK,
+       FW_RESET_ERROR,
+};
+
 /**
  * struct iwl_trans_pcie - PCIe transport specific data
  * @rxq: all the RX queue data
@@ -405,7 +412,7 @@ struct iwl_trans_pcie {
        dma_addr_t base_rb_stts_dma;
 
        bool fw_reset_handshake;
-       bool fw_reset_done;
+       enum iwl_pcie_fw_reset_state fw_reset_state;
        wait_queue_head_t fw_reset_waitq;
 
        char rf_name[32];
index 54bfc01ab34cac004cb3047262fad9554afc99bc..8e45eb38304b244989853969071a334231c30110 100644 (file)
@@ -2228,7 +2228,13 @@ irqreturn_t iwl_pcie_irq_msix_handler(int irq, void *dev_id)
                        "Microcode SW error detected. Restarting 0x%X.\n",
                        inta_fh);
                isr_stats->sw++;
-               iwl_pcie_irq_handle_error(trans);
+               /* during FW reset flow report errors from there */
+               if (trans_pcie->fw_reset_state == FW_RESET_REQUESTED) {
+                       trans_pcie->fw_reset_state = FW_RESET_ERROR;
+                       wake_up(&trans_pcie->fw_reset_waitq);
+               } else {
+                       iwl_pcie_irq_handle_error(trans);
+               }
        }
 
        /* After checking FH register check HW register */
@@ -2296,7 +2302,7 @@ irqreturn_t iwl_pcie_irq_msix_handler(int irq, void *dev_id)
 
        if (inta_hw & MSIX_HW_INT_CAUSES_REG_RESET_DONE) {
                IWL_DEBUG_ISR(trans, "Reset flow completed\n");
-               trans_pcie->fw_reset_done = true;
+               trans_pcie->fw_reset_state = FW_RESET_OK;
                wake_up(&trans_pcie->fw_reset_waitq);
        }
 
index a34009357227da43311acc99e0066a684dce7029..a266a35ff92841556459f5218266915e2fc6caf6 100644 (file)
@@ -95,7 +95,7 @@ static void iwl_trans_pcie_fw_reset_handshake(struct iwl_trans *trans)
        struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        int ret;
 
-       trans_pcie->fw_reset_done = false;
+       trans_pcie->fw_reset_state = FW_RESET_REQUESTED;
 
        if (trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_AX210)
                iwl_write_umac_prph(trans, UREG_NIC_SET_NMI_DRIVER,
@@ -106,10 +106,15 @@ static void iwl_trans_pcie_fw_reset_handshake(struct iwl_trans *trans)
 
        /* wait 200ms */
        ret = wait_event_timeout(trans_pcie->fw_reset_waitq,
-                                trans_pcie->fw_reset_done, FW_RESET_TIMEOUT);
-       if (!ret)
+                                trans_pcie->fw_reset_state != FW_RESET_REQUESTED,
+                                FW_RESET_TIMEOUT);
+       if (!ret || trans_pcie->fw_reset_state == FW_RESET_ERROR) {
                IWL_INFO(trans,
                         "firmware didn't ACK the reset - continue anyway\n");
+               iwl_trans_fw_error(trans, true);
+       }
+
+       trans_pcie->fw_reset_state = FW_RESET_IDLE;
 }
 
 void _iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans)