public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>,
	Miri Korenblit <miriam.rachel.korenblit@intel.com>,
	Johannes Berg <johannes.berg@intel.com>,
	Sasha Levin <sashal@kernel.org>,
	kvalo@kernel.org, gregory.greenman@intel.com,
	daniel.gabay@intel.com, justinstitt@google.com,
	yedidya.ben.shimol@intel.com, linux-wireless@vger.kernel.org
Subject: [PATCH AUTOSEL 6.10 22/22] wifi: iwlwifi: clear trans->state earlier upon error
Date: Tue,  3 Sep 2024 15:22:09 -0400	[thread overview]
Message-ID: <20240903192243.1107016-22-sashal@kernel.org> (raw)
In-Reply-To: <20240903192243.1107016-1-sashal@kernel.org>

From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

[ Upstream commit 094513f8a2fbddee51b055d8035f995551f98fce ]

When the firmware crashes, we first told the op_mode and only then,
changed the transport's state. This is a problem if the op_mode's
nic_error() handler needs to send a host command: it'll see that the
transport's state still reflects that the firmware is alive.

Today, this has no consequences since we set the STATUS_FW_ERROR bit and
that will prevent sending host commands. iwl_fw_dbg_stop_restart_recording
looks at this bit to know not to send a host command for example.

To fix the hibernation, we needed to reset the firmware without having
an error and checking STATUS_FW_ERROR to see whether the firmware is
alive will no longer hold, so this change is necessary as well.

Change the flow a bit.
Change trans->state before calling the op_mode's nic_error() method and
check trans->state instead of STATUS_FW_ERROR. This will keep the
current behavior of iwl_fw_dbg_stop_restart_recording upon firmware
error, and it'll allow us to call iwl_fw_dbg_stop_restart_recording
safely even if STATUS_FW_ERROR is clear, but yet, the firmware is not
alive.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240825191257.9d7427fbdfd7.Ia056ca57029a382c921d6f7b6a6b28fc480f2f22@changeid
[I missed this was a dependency for the hibernation fix, changed
 the commit message a bit accordingly]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/wireless/intel/iwlwifi/fw/dbg.c    | 2 +-
 drivers/net/wireless/intel/iwlwifi/iwl-trans.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
index 945ffc083d25c..79fffa82cfd92 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
@@ -3352,7 +3352,7 @@ void iwl_fw_dbg_stop_restart_recording(struct iwl_fw_runtime *fwrt,
 {
 	int ret __maybe_unused = 0;
 
-	if (test_bit(STATUS_FW_ERROR, &fwrt->trans->status))
+	if (!iwl_trans_fw_running(fwrt->trans))
 		return;
 
 	if (fw_has_capa(&fwrt->fw->ucode_capa,
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
index b93cef7b23301..4c56dccb18a9b 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-trans.h
@@ -1579,8 +1579,8 @@ static inline void iwl_trans_fw_error(struct iwl_trans *trans, bool sync)
 
 	/* prevent double restarts due to the same erroneous FW */
 	if (!test_and_set_bit(STATUS_FW_ERROR, &trans->status)) {
-		iwl_op_mode_nic_error(trans->op_mode, sync);
 		trans->state = IWL_TRANS_NO_FW;
+		iwl_op_mode_nic_error(trans->op_mode, sync);
 	}
 }
 
-- 
2.43.0


      parent reply	other threads:[~2024-09-03 20:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-03 19:21 [PATCH AUTOSEL 6.10 01/22] ASoC: SOF: mediatek: Add missing board compatible Sasha Levin
2024-09-03 19:21 ` [PATCH AUTOSEL 6.10 02/22] ASoC: mediatek: mt8188: Mark AFE_DAC_CON0 register as volatile Sasha Levin
2024-09-03 19:21 ` [PATCH AUTOSEL 6.10 03/22] ASoC: allow module autoloading for table db1200_pids Sasha Levin
2024-09-03 19:21 ` [PATCH AUTOSEL 6.10 04/22] ASoC: allow module autoloading for table board_ids Sasha Levin
2024-09-03 19:21 ` [PATCH AUTOSEL 6.10 05/22] ALSA: hda/realtek - Fixed ALC256 headphone no sound Sasha Levin
2024-09-03 19:21 ` [PATCH AUTOSEL 6.10 06/22] ALSA: hda/realtek - FIxed ALC285 " Sasha Levin
2024-09-03 19:21 ` [PATCH AUTOSEL 6.10 07/22] scsi: lpfc: Fix overflow build issue Sasha Levin
2024-09-03 19:21 ` [PATCH AUTOSEL 6.10 08/22] pinctrl: at91: make it work with current gpiolib Sasha Levin
2024-09-03 19:21 ` [PATCH AUTOSEL 6.10 09/22] hwmon: (asus-ec-sensors) remove VRM temp X570-E GAMING Sasha Levin
2024-09-03 19:21 ` [PATCH AUTOSEL 6.10 10/22] microblaze: don't treat zero reserved memory regions as error Sasha Levin
2024-09-03 19:21 ` [PATCH AUTOSEL 6.10 11/22] platform/x86: asus-wmi: Fix spurious rfkill on UX8406MA Sasha Levin
2024-09-03 19:21 ` [PATCH AUTOSEL 6.10 12/22] platform/x86: x86-android-tablets: Make Lenovo Yoga Tab 3 X90F DMI match less strict Sasha Levin
2024-09-03 19:22 ` [PATCH AUTOSEL 6.10 13/22] net: ftgmac100: Ensure tx descriptor updates are visible Sasha Levin
2024-09-03 19:22 ` [PATCH AUTOSEL 6.10 14/22] LoongArch: Define ARCH_IRQ_INIT_FLAGS as IRQ_NOPROBE Sasha Levin
2024-09-03 19:22 ` [PATCH AUTOSEL 6.10 15/22] LoongArch: KVM: Invalidate guest steal time address on vCPU reset Sasha Levin
2024-09-03 19:22 ` [PATCH AUTOSEL 6.10 16/22] wifi: iwlwifi: lower message level for FW buffer destination Sasha Levin
2024-09-03 19:22 ` [PATCH AUTOSEL 6.10 17/22] wifi: iwlwifi: mvm: fix iwl_mvm_scan_fits() calculation Sasha Levin
2024-09-03 19:22 ` [PATCH AUTOSEL 6.10 18/22] wifi: iwlwifi: mvm: fix iwl_mvm_max_scan_ie_fw_cmd_room() Sasha Levin
2024-09-03 19:22 ` [PATCH AUTOSEL 6.10 19/22] wifi: iwlwifi: mvm: pause TCM when the firmware is stopped Sasha Levin
2024-09-03 19:22 ` [PATCH AUTOSEL 6.10 20/22] wifi: iwlwifi: mvm: don't wait for tx queues if firmware is dead Sasha Levin
2024-09-03 19:22 ` [PATCH AUTOSEL 6.10 21/22] wifi: mac80211: free skb on error path in ieee80211_beacon_get_ap() Sasha Levin
2024-09-03 19:22 ` Sasha Levin [this message]

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=20240903192243.1107016-22-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=daniel.gabay@intel.com \
    --cc=emmanuel.grumbach@intel.com \
    --cc=gregory.greenman@intel.com \
    --cc=johannes.berg@intel.com \
    --cc=justinstitt@google.com \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=miriam.rachel.korenblit@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=yedidya.ben.shimol@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