linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iwlagn: only enable rfkill interrupt when device is down
@ 2010-12-22 13:01 Stanislaw Gruszka
  2010-12-22 17:08 ` Guy, Wey-Yi
  2010-12-22 17:27 ` Johannes Berg
  0 siblings, 2 replies; 4+ messages in thread
From: Stanislaw Gruszka @ 2010-12-22 13:01 UTC (permalink / raw)
  To: Wey-Yi Guy, Intel Linux Wireless
  Cc: Helmut Schaa, linux-wireless, stable, Stanislaw Gruszka

Since commit 6cd0b1cb872b3bf9fc5de4536404206ab74bafdd "iwlagn: fix
hw-rfkill while the interface is down", we enable interrupts when
device is not ready to receive them. However hardware, when it is in
some inconsistent state, can generate other than rfkill interrupts
and crash the system. I can reproduce crash with "kernel BUG at
drivers/net/wireless/iwlwifi/iwl-agn.c:1010!" message, when forcing
firmware restarts.

To fix only enable rfkill interrupt when down device and after probe.
I checked patch on laptop with 5100 device, rfkill change is still
passed to user space when device is down.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: stable@kernel.org
---
 drivers/net/wireless/iwlwifi/iwl-agn.c     |    9 +++++----
 drivers/net/wireless/iwlwifi/iwl-helpers.h |    6 ++++++
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index d407547..f5bd584 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3280,9 +3280,10 @@ void iwlagn_mac_stop(struct ieee80211_hw *hw)
 
 	flush_workqueue(priv->workqueue);
 
-	/* enable interrupts again in order to receive rfkill changes */
+	/* User space software may expect getting rfkill changes
+	 * even if interface is down */
 	iwl_write32(priv, CSR_INT, 0xFFFFFFFF);
-	iwl_enable_interrupts(priv);
+	iwl_enable_rfkill_int(priv);
 
 	IWL_DEBUG_MAC80211(priv, "leave\n");
 }
@@ -4190,14 +4191,14 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	 * 8. Enable interrupts and read RFKILL state
 	 *********************************************/
 
-	/* enable interrupts if needed: hw bug w/a */
+	/* enable rfkill interrupt: hw bug w/a */
 	pci_read_config_word(priv->pci_dev, PCI_COMMAND, &pci_cmd);
 	if (pci_cmd & PCI_COMMAND_INTX_DISABLE) {
 		pci_cmd &= ~PCI_COMMAND_INTX_DISABLE;
 		pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd);
 	}
 
-	iwl_enable_interrupts(priv);
+	iwl_enable_rfkill_int(priv);
 
 	/* If platform's RF_KILL switch is NOT set to KILL */
 	if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h
index 3f5bedd..8821f08 100644
--- a/drivers/net/wireless/iwlwifi/iwl-helpers.h
+++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h
@@ -148,6 +148,12 @@ static inline void iwl_disable_interrupts(struct iwl_priv *priv)
 	IWL_DEBUG_ISR(priv, "Disabled interrupts\n");
 }
 
+static inline void iwl_enable_rfkill_int(struct iwl_priv *priv)
+{
+	IWL_DEBUG_ISR(priv, "Enabling rfkill interrupt\n");
+	iwl_write32(priv, CSR_INT_MASK, CSR_INT_BIT_RF_KILL);
+}
+
 static inline void iwl_enable_interrupts(struct iwl_priv *priv)
 {
 	IWL_DEBUG_ISR(priv, "Enabling interrupts\n");
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] iwlagn: only enable rfkill interrupt when device is down
  2010-12-22 13:01 [PATCH] iwlagn: only enable rfkill interrupt when device is down Stanislaw Gruszka
@ 2010-12-22 17:08 ` Guy, Wey-Yi
  2010-12-22 17:27 ` Johannes Berg
  1 sibling, 0 replies; 4+ messages in thread
From: Guy, Wey-Yi @ 2010-12-22 17:08 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: Intel Linux Wireless, Helmut Schaa,
	linux-wireless@vger.kernel.org, stable@kernel.org

On Wed, 2010-12-22 at 05:01 -0800, Stanislaw Gruszka wrote:
> Since commit 6cd0b1cb872b3bf9fc5de4536404206ab74bafdd "iwlagn: fix
> hw-rfkill while the interface is down", we enable interrupts when
> device is not ready to receive them. However hardware, when it is in
> some inconsistent state, can generate other than rfkill interrupts
> and crash the system. I can reproduce crash with "kernel BUG at
> drivers/net/wireless/iwlwifi/iwl-agn.c:1010!" message, when forcing
> firmware restarts.
> 
> To fix only enable rfkill interrupt when down device and after probe.
> I checked patch on laptop with 5100 device, rfkill change is still
> passed to user space when device is down.
> 
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> Cc: stable@kernel.org
Acked-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] iwlagn: only enable rfkill interrupt when device is down
  2010-12-22 13:01 [PATCH] iwlagn: only enable rfkill interrupt when device is down Stanislaw Gruszka
  2010-12-22 17:08 ` Guy, Wey-Yi
@ 2010-12-22 17:27 ` Johannes Berg
  2010-12-23 11:38   ` [PATCH v2] iwlagn: enable only " Stanislaw Gruszka
  1 sibling, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2010-12-22 17:27 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: Wey-Yi Guy, Intel Linux Wireless, Helmut Schaa, linux-wireless,
	stable

On Wed, 2010-12-22 at 14:01 +0100, Stanislaw Gruszka wrote:
> Since commit 6cd0b1cb872b3bf9fc5de4536404206ab74bafdd "iwlagn: fix
> hw-rfkill while the interface is down", we enable interrupts when
> device is not ready to receive them. However hardware, when it is in
> some inconsistent state, can generate other than rfkill interrupts
> and crash the system. I can reproduce crash with "kernel BUG at
> drivers/net/wireless/iwlwifi/iwl-agn.c:1010!" message, when forcing
> firmware restarts.
> 
> To fix only enable rfkill interrupt when down device and after probe.
> I checked patch on laptop with 5100 device, rfkill change is still
> passed to user space when device is down.

Should the subject say "enable only rfkill interrupt when device is
down" instead? As it is, to me it reads like rfkill interrupt would be
disabled while up, which can't be right?

johannes


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] iwlagn: enable only rfkill interrupt when device is down
  2010-12-22 17:27 ` Johannes Berg
@ 2010-12-23 11:38   ` Stanislaw Gruszka
  0 siblings, 0 replies; 4+ messages in thread
From: Stanislaw Gruszka @ 2010-12-23 11:38 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Wey-Yi Guy, Intel Linux Wireless, Helmut Schaa, linux-wireless,
	stable

Since commit 6cd0b1cb872b3bf9fc5de4536404206ab74bafdd "iwlagn: fix
hw-rfkill while the interface is down", we enable interrupts when
device is not ready to receive them. However hardware, when it is in
some inconsistent state, can generate other than rfkill interrupts
and crash the system. I can reproduce crash with "kernel BUG at
drivers/net/wireless/iwlwifi/iwl-agn.c:1010!" message, when forcing
firmware restarts.

To fix only enable rfkill interrupt when down device and after probe.
I checked patch on laptop with 5100 device, rfkill change is still
passed to user space when device is down.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: stable@kernel.org
Acked-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
---
v1 -> v2: fix topic (thanks to Johannes for correct my English :)
 
 drivers/net/wireless/iwlwifi/iwl-agn.c     |    9 +++++----
 drivers/net/wireless/iwlwifi/iwl-helpers.h |    6 ++++++
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index d407547..f5bd584 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3280,9 +3280,10 @@ void iwlagn_mac_stop(struct ieee80211_hw *hw)
 
 	flush_workqueue(priv->workqueue);
 
-	/* enable interrupts again in order to receive rfkill changes */
+	/* User space software may expect getting rfkill changes
+	 * even if interface is down */
 	iwl_write32(priv, CSR_INT, 0xFFFFFFFF);
-	iwl_enable_interrupts(priv);
+	iwl_enable_rfkill_int(priv);
 
 	IWL_DEBUG_MAC80211(priv, "leave\n");
 }
@@ -4190,14 +4191,14 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	 * 8. Enable interrupts and read RFKILL state
 	 *********************************************/
 
-	/* enable interrupts if needed: hw bug w/a */
+	/* enable rfkill interrupt: hw bug w/a */
 	pci_read_config_word(priv->pci_dev, PCI_COMMAND, &pci_cmd);
 	if (pci_cmd & PCI_COMMAND_INTX_DISABLE) {
 		pci_cmd &= ~PCI_COMMAND_INTX_DISABLE;
 		pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd);
 	}
 
-	iwl_enable_interrupts(priv);
+	iwl_enable_rfkill_int(priv);
 
 	/* If platform's RF_KILL switch is NOT set to KILL */
 	if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h
index 3f5bedd..8821f08 100644
--- a/drivers/net/wireless/iwlwifi/iwl-helpers.h
+++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h
@@ -148,6 +148,12 @@ static inline void iwl_disable_interrupts(struct iwl_priv *priv)
 	IWL_DEBUG_ISR(priv, "Disabled interrupts\n");
 }
 
+static inline void iwl_enable_rfkill_int(struct iwl_priv *priv)
+{
+	IWL_DEBUG_ISR(priv, "Enabling rfkill interrupt\n");
+	iwl_write32(priv, CSR_INT_MASK, CSR_INT_BIT_RF_KILL);
+}
+
 static inline void iwl_enable_interrupts(struct iwl_priv *priv)
 {
 	IWL_DEBUG_ISR(priv, "Enabling interrupts\n");
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-12-23 11:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-22 13:01 [PATCH] iwlagn: only enable rfkill interrupt when device is down Stanislaw Gruszka
2010-12-22 17:08 ` Guy, Wey-Yi
2010-12-22 17:27 ` Johannes Berg
2010-12-23 11:38   ` [PATCH v2] iwlagn: enable only " Stanislaw Gruszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).