aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-11-13 18:26:27 +0000
committerFelix Fietkau <nbd@openwrt.org>2014-11-13 18:26:27 +0000
commit5957dfadb77bf1ec11c926c08cbc088e4d1a4c1d (patch)
tree8342d722185e299ad9611dc9c3f90f0e5fcd2153
parent9f4414f7895491176ae7f82b88f01cbb4cbf1b7a (diff)
downloadupstream-5957dfadb77bf1ec11c926c08cbc088e4d1a4c1d.tar.gz
upstream-5957dfadb77bf1ec11c926c08cbc088e4d1a4c1d.tar.bz2
upstream-5957dfadb77bf1ec11c926c08cbc088e4d1a4c1d.zip
ath9k: fix crashes when using shared IRQs
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Backport of r43239 git-svn-id: svn://svn.openwrt.org/openwrt/branches/barrier_breaker@43240 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--package/kernel/mac80211/patches/300-pending_work.patch134
-rw-r--r--package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch2
-rw-r--r--package/kernel/mac80211/patches/501-ath9k-eeprom_endianess.patch2
-rw-r--r--package/kernel/mac80211/patches/502-ath9k_ahb_init.patch2
-rw-r--r--package/kernel/mac80211/patches/521-ath9k_cur_txpower.patch2
-rw-r--r--package/kernel/mac80211/patches/523-ath9k_use_configured_antenna_gain.patch2
-rw-r--r--package/kernel/mac80211/patches/530-ath9k_extra_leds.patch2
-rw-r--r--package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch2
-rw-r--r--package/kernel/mac80211/patches/543-ath9k-allow-to-disable-bands-via-platform-data.patch2
-rw-r--r--package/kernel/mac80211/patches/550-ath9k_entropy_from_adc.patch6
-rw-r--r--package/kernel/mac80211/patches/563-ath9k_rxorn_intr_fix.patch2
11 files changed, 140 insertions, 18 deletions
diff --git a/package/kernel/mac80211/patches/300-pending_work.patch b/package/kernel/mac80211/patches/300-pending_work.patch
index 796b34c97d..95d37af11d 100644
--- a/package/kernel/mac80211/patches/300-pending_work.patch
+++ b/package/kernel/mac80211/patches/300-pending_work.patch
@@ -1,3 +1,38 @@
+commit 24028dc203af73088ab969c2b4236bf9bee99d85
+Author: Felix Fietkau <nbd@openwrt.org>
+Date: Thu Nov 13 18:29:26 2014 +0100
+
+ ath9k: do not access hardware on IRQs during reset
+
+ Instead of killing interrupts during reset when the first one happens,
+ kill them before issuing the reset.
+ This fixes an easy to reproduce crash with multiple cards sharing the
+ same IRQ.
+
+ Cc: stable@vger.kernel.org
+ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+
+commit 8115a0d774754a1a01feb25fb436832d4f3be41b
+Author: Felix Fietkau <nbd@openwrt.org>
+Date: Thu Nov 13 18:29:00 2014 +0100
+
+ ath9k: set ATH_OP_INVALID before disabling hardware
+
+ Closes another small IRQ handler race
+
+ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+
+commit d10478d3983574c2bae11146ef6b01d0103a777d
+Author: Felix Fietkau <nbd@openwrt.org>
+Date: Thu Nov 13 18:27:47 2014 +0100
+
+ ath9k: prevent early IRQs from accessing hardware
+
+ IRQs are suppressed if ah == NULL and ATH_OP_INVALID being set in
+ common->op_flags. Close a short time window between those two.
+
+ Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+
commit 77980bee5f1f743b46f8749185aca28b8ec69741
Author: Johannes Berg <johannes.berg@intel.com>
Date: Mon Nov 3 14:29:09 2014 +0100
@@ -1688,7 +1723,66 @@ Date: Mon May 19 21:20:49 2014 +0200
ENTRY_DATA_IO_FAILED,
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -1757,7 +1757,6 @@ out:
+@@ -582,16 +582,13 @@ irqreturn_t ath_isr(int irq, void *dev)
+ if (test_bit(ATH_OP_INVALID, &common->op_flags))
+ return IRQ_NONE;
+
+- /* shared irq, not for us */
++ if (test_bit(ATH_OP_HW_RESET, &common->op_flags))
++ return IRQ_NONE;
+
++ /* shared irq, not for us */
+ if (!ath9k_hw_intrpend(ah))
+ return IRQ_NONE;
+
+- if (test_bit(ATH_OP_HW_RESET, &common->op_flags)) {
+- ath9k_hw_kill_interrupts(ah);
+- return IRQ_HANDLED;
+- }
+-
+ /*
+ * Figure out the reason(s) for the interrupt. Note
+ * that the hal returns a pseudo-ISR that may include
+@@ -677,8 +674,12 @@ chip_reset:
+
+ int ath_reset(struct ath_softc *sc)
+ {
++ struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+ int r;
+
++ ath9k_hw_kill_interrupts(sc->sc_ah);
++ set_bit(ATH_OP_HW_RESET, &common->op_flags);
++
+ ath9k_ps_wakeup(sc);
+ r = ath_reset_internal(sc, NULL);
+ ath9k_ps_restore(sc);
+@@ -692,6 +693,7 @@ void ath9k_queue_reset(struct ath_softc
+ #ifdef CPTCFG_ATH9K_DEBUGFS
+ RESET_STAT_INC(sc, type);
+ #endif
++ ath9k_hw_kill_interrupts(sc->sc_ah);
+ set_bit(ATH_OP_HW_RESET, &common->op_flags);
+ ieee80211_queue_work(sc->hw, &sc->hw_reset_work);
+ }
+@@ -937,6 +939,9 @@ static void ath9k_stop(struct ieee80211_
+ ah->curchan = ath9k_cmn_get_channel(hw, ah, &hw->conf.chandef);
+
+ ath9k_hw_reset(ah, ah->curchan, ah->caldata, false);
++
++ set_bit(ATH_OP_INVALID, &common->op_flags);
++
+ ath9k_hw_phy_disable(ah);
+
+ ath9k_hw_configpcipowersave(ah, true);
+@@ -945,7 +950,6 @@ static void ath9k_stop(struct ieee80211_
+
+ ath9k_ps_restore(sc);
+
+- set_bit(ATH_OP_INVALID, &common->op_flags);
+ sc->ps_idle = prev_idle;
+
+ mutex_unlock(&sc->mutex);
+@@ -1757,7 +1761,6 @@ out:
void ath9k_update_p2p_ps(struct ath_softc *sc, struct ieee80211_vif *vif)
{
struct ath_vif *avp = (void *)vif->drv_priv;
@@ -1696,7 +1790,7 @@ Date: Mon May 19 21:20:49 2014 +0200
u32 tsf;
if (!sc->p2p_ps_timer)
-@@ -1767,14 +1766,9 @@ void ath9k_update_p2p_ps(struct ath_soft
+@@ -1767,14 +1770,9 @@ void ath9k_update_p2p_ps(struct ath_soft
return;
sc->p2p_ps_vif = avp;
@@ -1714,7 +1808,7 @@ Date: Mon May 19 21:20:49 2014 +0200
}
static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
-@@ -1791,6 +1785,7 @@ static void ath9k_bss_info_changed(struc
+@@ -1791,6 +1789,7 @@ static void ath9k_bss_info_changed(struc
struct ath_hw *ah = sc->sc_ah;
struct ath_common *common = ath9k_hw_common(ah);
struct ath_vif *avp = (void *)vif->drv_priv;
@@ -1722,7 +1816,7 @@ Date: Mon May 19 21:20:49 2014 +0200
int slottime;
ath9k_ps_wakeup(sc);
-@@ -1853,7 +1848,10 @@ static void ath9k_bss_info_changed(struc
+@@ -1853,7 +1852,10 @@ static void ath9k_bss_info_changed(struc
if (changed & BSS_CHANGED_P2P_PS) {
spin_lock_bh(&sc->sc_pcu_lock);
@@ -1734,7 +1828,7 @@ Date: Mon May 19 21:20:49 2014 +0200
spin_unlock_bh(&sc->sc_pcu_lock);
}
-@@ -2232,14 +2230,6 @@ static void ath9k_sw_scan_complete(struc
+@@ -2232,14 +2234,6 @@ static void ath9k_sw_scan_complete(struc
clear_bit(ATH_OP_SCANNING, &common->op_flags);
}
@@ -1749,7 +1843,7 @@ Date: Mon May 19 21:20:49 2014 +0200
struct ieee80211_ops ath9k_ops = {
.tx = ath9k_tx,
.start = ath9k_start,
-@@ -2287,5 +2277,4 @@ struct ieee80211_ops ath9k_ops = {
+@@ -2287,5 +2281,4 @@ struct ieee80211_ops ath9k_ops = {
#endif
.sw_scan_start = ath9k_sw_scan_start,
.sw_scan_complete = ath9k_sw_scan_complete,
@@ -3495,3 +3589,31 @@ Date: Mon May 19 21:20:49 2014 +0200
}
void b43_phy_mask(struct b43_wldev *dev, u16 offset, u16 mask)
+--- a/drivers/net/wireless/ath/ath9k/init.c
++++ b/drivers/net/wireless/ath/ath9k/init.c
+@@ -500,10 +500,14 @@ static int ath9k_init_softc(u16 devid, s
+ ah->reg_ops.read = ath9k_ioread32;
+ ah->reg_ops.write = ath9k_iowrite32;
+ ah->reg_ops.rmw = ath9k_reg_rmw;
+- sc->sc_ah = ah;
+ pCap = &ah->caps;
+
+ common = ath9k_hw_common(ah);
++
++ /* Will be cleared in ath9k_start() */
++ set_bit(ATH_OP_INVALID, &common->op_flags);
++
++ sc->sc_ah = ah;
+ sc->dfs_detector = dfs_pattern_detector_init(common, NL80211_DFS_UNSET);
+ sc->tx99_power = MAX_RATE_POWER + 1;
+ init_waitqueue_head(&sc->tx_wait);
+@@ -787,9 +791,6 @@ int ath9k_init_device(u16 devid, struct
+ common = ath9k_hw_common(ah);
+ ath9k_set_hw_capab(sc, hw);
+
+- /* Will be cleared in ath9k_start() */
+- set_bit(ATH_OP_INVALID, &common->op_flags);
+-
+ /* Initialize regulatory */
+ error = ath_regd_init(&common->regulatory, sc->hw->wiphy,
+ ath9k_reg_notifier);
diff --git a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
index ce752f147a..7821f6b5a0 100644
--- a/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
+++ b/package/kernel/mac80211/patches/410-ath9k_allow_adhoc_and_ap.patch
@@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -655,6 +655,7 @@ static const struct ieee80211_iface_limi
+@@ -659,6 +659,7 @@ static const struct ieee80211_iface_limi
BIT(NL80211_IFTYPE_AP) },
{ .max = 1, .types = BIT(NL80211_IFTYPE_P2P_CLIENT) |
BIT(NL80211_IFTYPE_P2P_GO) },
diff --git a/package/kernel/mac80211/patches/501-ath9k-eeprom_endianess.patch b/package/kernel/mac80211/patches/501-ath9k-eeprom_endianess.patch
index 169eb9ae0c..b2cfe5f919 100644
--- a/package/kernel/mac80211/patches/501-ath9k-eeprom_endianess.patch
+++ b/package/kernel/mac80211/patches/501-ath9k-eeprom_endianess.patch
@@ -81,7 +81,7 @@
struct ath_ops reg_ops;
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -518,6 +518,8 @@ static int ath9k_init_softc(u16 devid, s
+@@ -522,6 +522,8 @@ static int ath9k_init_softc(u16 devid, s
ah->is_clk_25mhz = pdata->is_clk_25mhz;
ah->get_mac_revision = pdata->get_mac_revision;
ah->external_reset = pdata->external_reset;
diff --git a/package/kernel/mac80211/patches/502-ath9k_ahb_init.patch b/package/kernel/mac80211/patches/502-ath9k_ahb_init.patch
index 0c8e813a37..734674574a 100644
--- a/package/kernel/mac80211/patches/502-ath9k_ahb_init.patch
+++ b/package/kernel/mac80211/patches/502-ath9k_ahb_init.patch
@@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -904,23 +904,23 @@ static int __init ath9k_init(void)
+@@ -905,23 +905,23 @@ static int __init ath9k_init(void)
{
int error;
diff --git a/package/kernel/mac80211/patches/521-ath9k_cur_txpower.patch b/package/kernel/mac80211/patches/521-ath9k_cur_txpower.patch
index 83ff465b97..85ad64ceab 100644
--- a/package/kernel/mac80211/patches/521-ath9k_cur_txpower.patch
+++ b/package/kernel/mac80211/patches/521-ath9k_cur_txpower.patch
@@ -14,7 +14,7 @@
out:
spin_unlock_bh(&sc->sc_pcu_lock);
-@@ -1405,6 +1409,7 @@ static int ath9k_config(struct ieee80211
+@@ -1409,6 +1413,7 @@ static int ath9k_config(struct ieee80211
sc->config.txpowlimit = 2 * conf->power_level;
ath9k_cmn_update_txpow(ah, sc->curtxpow,
sc->config.txpowlimit, &sc->curtxpow);
diff --git a/package/kernel/mac80211/patches/523-ath9k_use_configured_antenna_gain.patch b/package/kernel/mac80211/patches/523-ath9k_use_configured_antenna_gain.patch
index 9b51c4c23d..3a711f7c5b 100644
--- a/package/kernel/mac80211/patches/523-ath9k_use_configured_antenna_gain.patch
+++ b/package/kernel/mac80211/patches/523-ath9k_use_configured_antenna_gain.patch
@@ -21,7 +21,7 @@
if (ant_gain > max_gain)
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -1405,7 +1405,10 @@ static int ath9k_config(struct ieee80211
+@@ -1409,7 +1409,10 @@ static int ath9k_config(struct ieee80211
}
if (changed & IEEE80211_CONF_CHANGE_POWER) {
diff --git a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
index 29efdf5947..ed606a90b2 100644
--- a/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
+++ b/package/kernel/mac80211/patches/530-ath9k_extra_leds.patch
@@ -162,7 +162,7 @@
void ath_fill_led_pin(struct ath_softc *sc)
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -815,7 +815,7 @@ int ath9k_init_device(u16 devid, struct
+@@ -816,7 +816,7 @@ int ath9k_init_device(u16 devid, struct
#ifdef CPTCFG_MAC80211_LEDS
/* must be initialized before ieee80211_register_hw */
diff --git a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
index f36a0e6e22..309c1c6908 100644
--- a/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
+++ b/package/kernel/mac80211/patches/542-ath9k_debugfs_diag.patch
@@ -125,7 +125,7 @@
REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV, AR_BTCOEX_WL_LNADIV_FORCE_ON);
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -606,6 +606,11 @@ irqreturn_t ath_isr(int irq, void *dev)
+@@ -603,6 +603,11 @@ irqreturn_t ath_isr(int irq, void *dev)
ath9k_debug_sync_cause(sc, sync_cause);
status &= ah->imask; /* discard unasked-for bits */
diff --git a/package/kernel/mac80211/patches/543-ath9k-allow-to-disable-bands-via-platform-data.patch b/package/kernel/mac80211/patches/543-ath9k-allow-to-disable-bands-via-platform-data.patch
index 2483744179..e4c01be096 100644
--- a/package/kernel/mac80211/patches/543-ath9k-allow-to-disable-bands-via-platform-data.patch
+++ b/package/kernel/mac80211/patches/543-ath9k-allow-to-disable-bands-via-platform-data.patch
@@ -58,7 +58,7 @@
};
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -518,6 +518,8 @@ static int ath9k_init_softc(u16 devid, s
+@@ -522,6 +522,8 @@ static int ath9k_init_softc(u16 devid, s
ah->is_clk_25mhz = pdata->is_clk_25mhz;
ah->get_mac_revision = pdata->get_mac_revision;
ah->external_reset = pdata->external_reset;
diff --git a/package/kernel/mac80211/patches/550-ath9k_entropy_from_adc.patch b/package/kernel/mac80211/patches/550-ath9k_entropy_from_adc.patch
index f16f6b0317..22b9e2e0de 100644
--- a/package/kernel/mac80211/patches/550-ath9k_entropy_from_adc.patch
+++ b/package/kernel/mac80211/patches/550-ath9k_entropy_from_adc.patch
@@ -55,7 +55,7 @@
ops->spectral_scan_config = ar9003_hw_spectral_scan_config;
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
-@@ -646,7 +646,8 @@ static void ath9k_init_txpower_limits(st
+@@ -650,7 +650,8 @@ static void ath9k_init_txpower_limits(st
if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ);
@@ -65,7 +65,7 @@
}
static const struct ieee80211_iface_limit if_limits[] = {
-@@ -774,6 +775,18 @@ static void ath9k_set_hw_capab(struct at
+@@ -778,6 +779,18 @@ static void ath9k_set_hw_capab(struct at
SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
}
@@ -84,7 +84,7 @@
int ath9k_init_device(u16 devid, struct ath_softc *sc,
const struct ath_bus_ops *bus_ops)
{
-@@ -822,6 +835,8 @@ int ath9k_init_device(u16 devid, struct
+@@ -823,6 +836,8 @@ int ath9k_init_device(u16 devid, struct
ARRAY_SIZE(ath9k_tpt_blink));
#endif
diff --git a/package/kernel/mac80211/patches/563-ath9k_rxorn_intr_fix.patch b/package/kernel/mac80211/patches/563-ath9k_rxorn_intr_fix.patch
index 47a7d82904..6d901c2524 100644
--- a/package/kernel/mac80211/patches/563-ath9k_rxorn_intr_fix.patch
+++ b/package/kernel/mac80211/patches/563-ath9k_rxorn_intr_fix.patch
@@ -1,6 +1,6 @@
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
-@@ -628,8 +628,7 @@ irqreturn_t ath_isr(int irq, void *dev)
+@@ -625,8 +625,7 @@ irqreturn_t ath_isr(int irq, void *dev)
* If a FATAL or RXORN interrupt is received, we have to reset the
* chip immediately.
*/