]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
iwlwifi: pcie: don't access periphery registers when not available
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Tue, 13 Mar 2018 12:12:40 +0000 (14:12 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Thu, 2 Aug 2018 07:50:07 +0000 (10:50 +0300)
The periphery can't be accessed before we set the
INIT_DONE bit which initializes the device.

A previous patch added a reconfiguration of the MSI-X
tables upon resume, but at that point in the flow,
INIT_DONE wasn't set. Since the reconfiguration of the
MSI-X tables require periphery access, it failed.

The difference between WoWLAN and without WoWLAN is that
in WoWLAN, iwl_trans_pcie_d3_suspend clears the INIT_DONE
without clearing the STATUS_DEVICE_ENABLED bit in the
software status. Because of that, the resume code thinks
that the device is enabled, but the INIT_DONE bit has been
cleared.

To fix this, don't reconfigure the MSI-X tables in case
WoWLAN is enabled. It will be done in
iwl_trans_pcie_d3_resume anyway.

Fixes: 52848a79b9d2 ("iwlwifi: pcie: reconfigure MSI-X HW on resume")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/pcie/drv.c
drivers/net/wireless/intel/iwlwifi/pcie/trans.c

index 651975bc159b2629e3c4eeda0ebd94cf3b061c00..51a2e2deea9caaa16d6af88964d5aeaa37f53dc0 100644 (file)
@@ -994,6 +994,10 @@ static int iwl_pci_resume(struct device *device)
        if (!trans->op_mode)
                return 0;
 
+       /* In WOWLAN, let iwl_trans_pcie_d3_resume do the rest of the work */
+       if (test_bit(STATUS_DEVICE_ENABLED, &trans->status))
+               return 0;
+
        /* reconfigure the MSI-X mapping to get the correct IRQ for rfkill */
        iwl_pcie_conf_msix_hw(trans_pcie);
 
index 7928e8089f423c484fd9175bbab3f838b4a95ca8..a54c2bc985ad568d3939d004dbd5cc41ce7d96bd 100644 (file)
@@ -1563,18 +1563,6 @@ static int iwl_trans_pcie_d3_resume(struct iwl_trans *trans,
 
        iwl_pcie_enable_rx_wake(trans, true);
 
-       /*
-        * Reconfigure IVAR table in case of MSIX or reset ict table in
-        * MSI mode since HW reset erased it.
-        * Also enables interrupts - none will happen as
-        * the device doesn't know we're waking it up, only when
-        * the opmode actually tells it after this call.
-        */
-       iwl_pcie_conf_msix_hw(trans_pcie);
-       if (!trans_pcie->msix_enabled)
-               iwl_pcie_reset_ict(trans);
-       iwl_enable_interrupts(trans);
-
        iwl_set_bit(trans, CSR_GP_CNTRL,
                    BIT(trans->cfg->csr->flag_mac_access_req));
        iwl_set_bit(trans, CSR_GP_CNTRL,
@@ -1592,6 +1580,18 @@ static int iwl_trans_pcie_d3_resume(struct iwl_trans *trans,
                return ret;
        }
 
+       /*
+        * Reconfigure IVAR table in case of MSIX or reset ict table in
+        * MSI mode since HW reset erased it.
+        * Also enables interrupts - none will happen as
+        * the device doesn't know we're waking it up, only when
+        * the opmode actually tells it after this call.
+        */
+       iwl_pcie_conf_msix_hw(trans_pcie);
+       if (!trans_pcie->msix_enabled)
+               iwl_pcie_reset_ict(trans);
+       iwl_enable_interrupts(trans);
+
        iwl_pcie_set_pwr(trans, false);
 
        if (!reset) {