From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Felix Fietkau <nbd@nbd.name>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH mt76-next 07/19] wifi: mt76: mt7996: stop WED before the DMA reset of a full reset
Date: Wed, 18 Nov 2026 09:38:05 +0100 [thread overview]
Message-ID: <av1j7Xh9lQBNKorF@lore-qca> (raw)
In-Reply-To: <20261117180134.2940930-7-nbd@nbd.name>
[-- Attachment #1: Type: text/plain, Size: 4954 bytes --]
> Unlike the L1 SER path, mt7996_mac_restart() resets the WFSYS while the
> attached WEDs still access it over PCIe. Their reads during the reset
> get no completion, and MT7988 reports uncorrectable PCIe completion
> timeouts on both root ports.
>
> Stop both WEDs at the start of the restart, and disable the WED
> interrupt agent and wait for it to go idle before the WFSYS reset. The
> other agents stay enabled, since TX through WED stops after the restart
> otherwise.
>
> Fixes: 83eafc9251d6 ("wifi: mt76: mt7996: add wed tx support")
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
> .../net/wireless/mediatek/mt76/mt7996/dma.c | 25 ++++++++++++++++++-
> .../net/wireless/mediatek/mt76/mt7996/mac.c | 19 +++++++++-----
> .../net/wireless/mediatek/mt76/mt7996/regs.h | 5 ++++
> 3 files changed, 42 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/dma.c b/drivers/net/wireless/mediatek/mt76/mt7996/dma.c
> index 3d9353811a02..4450d35e9439 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/dma.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/dma.c
> @@ -3,6 +3,7 @@
> * Copyright (C) 2022 MediaTek Inc.
> */
>
> +#include <linux/iopoll.h>
> #include "mt7996.h"
> #include "../dma.h"
> #include "mac.h"
> @@ -957,6 +958,25 @@ int mt7996_dma_init(struct mt7996_dev *dev)
> return 0;
> }
>
> +static void
> +mt7996_wed_int_agent_disable(struct mt7996_dev *dev,
> + struct mtk_wed_device *wed)
> +{
> + u32 val;
> +
> + if (!mtk_wed_device_active(wed))
> + return;
> +
> + val = mtk_wed_device_reg_read(wed, MT_WED_CTRL);
> + mtk_wed_device_reg_write(wed, MT_WED_CTRL,
> + val & ~MT_WED_CTRL_WPDMA_INT_AGENT_EN);
> +
> + if (read_poll_timeout(mtk_wed_device_reg_read, val,
> + !(val & MT_WED_CTRL_WPDMA_INT_AGENT_BUSY),
> + 100, 20000, false, wed, MT_WED_CTRL))
> + dev_warn(dev->mt76.dev, "WED interrupt agent still busy\n");
> +}
> +
> void mt7996_dma_reset(struct mt7996_dev *dev, bool force)
> {
> struct mt76_phy *phy2 = dev->mt76.phys[MT_BAND1];
> @@ -996,8 +1016,11 @@ void mt7996_dma_reset(struct mt7996_dev *dev, bool force)
> mt7996_rro_msdu_page_map_free(dev);
>
> /* reset wfsys */
> - if (force)
> + if (force) {
> + mt7996_wed_int_agent_disable(dev, &dev->mt76.mmio.wed_hif2);
> + mt7996_wed_int_agent_disable(dev, &dev->mt76.mmio.wed);
> mt7996_wfsys_reset(dev);
> + }
>
> if (dev->hif2 && mtk_wed_device_active(&dev->mt76.mmio.wed_hif2))
> mtk_wed_device_dma_reset(&dev->mt76.mmio.wed_hif2);
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
> index 03670293a78f..2e1d98bf823a 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mac.c
> @@ -2291,6 +2291,16 @@ void mt7996_tx_token_put(struct mt7996_dev *dev)
> }
> }
>
> +static void
> +mt7996_wed_stop(struct mt7996_dev *dev)
> +{
> + if (mtk_wed_device_active(&dev->mt76.mmio.wed_hif2))
> + mtk_wed_device_stop(&dev->mt76.mmio.wed_hif2);
> +
> + if (mtk_wed_device_active(&dev->mt76.mmio.wed))
> + mtk_wed_device_stop(&dev->mt76.mmio.wed);
> +}
> +
> static int
> mt7996_mac_restart(struct mt7996_dev *dev)
> {
> @@ -2298,6 +2308,8 @@ mt7996_mac_restart(struct mt7996_dev *dev)
> struct mt7996_phy *phy;
> int i, ret;
>
> + mt7996_wed_stop(dev);
> +
> if (dev->hif2) {
> mt76_wr(dev, MT_INT1_MASK_CSR, 0x0);
> mt76_wr(dev, MT_INT1_SOURCE_CSR, ~0);
> @@ -2573,12 +2585,7 @@ void mt7996_mac_reset_work(struct work_struct *work)
> dev_info(dev->mt76.dev,"\n%s L1 SER recovery start.",
> wiphy_name(hw->wiphy));
>
> - if (mtk_wed_device_active(&dev->mt76.mmio.wed_hif2))
> - mtk_wed_device_stop(&dev->mt76.mmio.wed_hif2);
> -
> - if (mtk_wed_device_active(&dev->mt76.mmio.wed))
> - mtk_wed_device_stop(&dev->mt76.mmio.wed);
> -
> + mt7996_wed_stop(dev);
> mt7996_npu_hw_stop(dev);
> ieee80211_stop_queues(mt76_hw(dev));
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/regs.h b/drivers/net/wireless/mediatek/mt76/mt7996/regs.h
> index 6df6e4c3d45d..e82a281a773a 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/regs.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/regs.h
> @@ -782,6 +782,11 @@ enum offs_rev {
> #define MT_WF_SUBSYS_RST_BYPASS_WFDMA2_SLP_PROT BIT(16)
> #define MT_WF_SUBSYS_RST_WHOLE_PATH_RST_REVERT_CYCLE GENMASK(15, 8)
>
> +/* WED registers, offsets for mtk_wed_device_reg_read() */
> +#define MT_WED_CTRL 0x00c
> +#define MT_WED_CTRL_WPDMA_INT_AGENT_EN BIT(0)
> +#define MT_WED_CTRL_WPDMA_INT_AGENT_BUSY BIT(1)
> +
> /* PCIE MAC */
> #define MT_PCIE_MAC_BASE 0x74030000
> #define MT_PCIE_MAC(ofs) (MT_PCIE_MAC_BASE + (ofs))
> --
> 2.47.3
>
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2026-11-18 8:38 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 18:01 [PATCH mt76-next 01/19] wifi: mt76: don't pin undrainable PS stations in the tx scheduler Felix Fietkau
2026-11-17 18:01 ` [PATCH mt76-next 02/19] wifi: mt76: mt7996: return a negative error for a firmware status Felix Fietkau
2026-11-17 18:01 ` [PATCH mt76-next 03/19] wifi: mt76: mt7996: use the default timeout for STA_REC and BSS_INFO Felix Fietkau
2026-11-18 8:22 ` Lorenzo Bianconi
2026-11-17 18:01 ` [PATCH mt76-next 04/19] wifi: mt76: mt7915: " Felix Fietkau
2026-11-18 8:23 ` Lorenzo Bianconi
2026-11-17 18:01 ` [PATCH mt76-next 05/19] wifi: mt76: delete only the RX NAPIs that were added Felix Fietkau
2026-11-18 8:32 ` Lorenzo Bianconi
2026-11-17 18:01 ` [PATCH mt76-next 06/19] wifi: mt76: mt7996: report radar on the channel context of its band Felix Fietkau
2026-11-17 18:01 ` [PATCH mt76-next 07/19] wifi: mt76: mt7996: stop WED before the DMA reset of a full reset Felix Fietkau
2026-11-18 8:38 ` Lorenzo Bianconi [this message]
2026-11-17 18:01 ` [PATCH mt76-next 08/19] wifi: mt76: skip the radiotap TLVs in mt76_skb_get_hdr() Felix Fietkau
2026-11-17 18:01 ` [PATCH mt76-next 09/19] wifi: mt76: find the first A-MSDU subframe behind the radiotap data Felix Fietkau
2026-11-18 8:43 ` Lorenzo Bianconi
2026-11-17 18:01 ` [PATCH mt76-next 10/19] wifi: mt76: mark all but the last subframe of an A-MSDU chain Felix Fietkau
2026-11-18 8:47 ` Lorenzo Bianconi
2026-11-17 18:01 ` [PATCH mt76-next 11/19] wifi: mt76: mt7996: set qos_ctl of a frame that hardware reordered Felix Fietkau
2026-11-18 8:50 ` Lorenzo Bianconi
2026-11-17 18:01 ` [PATCH mt76-next 12/19] wifi: mt76: check the PN of a BA session frame at its release Felix Fietkau
2026-11-18 8:55 ` Lorenzo Bianconi
2026-11-17 18:01 ` [PATCH mt76-next 13/19] wifi: mt76: check the RX PN of CCMP-256, GCMP and GCMP-256 keys Felix Fietkau
2026-11-17 18:01 ` [PATCH mt76-next 14/19] wifi: mt76: connac: return a negative error for a firmware status Felix Fietkau
2026-11-17 18:01 ` [PATCH mt76-next 15/19] wifi: mt76: guard the tx_list of every phy with one lock Felix Fietkau
2026-11-18 8:52 ` Lorenzo Bianconi
2026-11-17 18:01 ` [PATCH mt76-next 16/19] wifi: mt76: keep an unpublished wcid off the TX and poll lists Felix Fietkau
2026-11-17 18:01 ` [PATCH mt76-next 17/19] wifi: mt76: mt7925: do not take iflist_mtx under the mutex Felix Fietkau
2026-11-17 18:01 ` [PATCH mt76-next 18/19] wifi: mt76: mt7925: take each polled link under sta_poll_lock Felix Fietkau
2026-11-18 8:58 ` Lorenzo Bianconi
2026-11-17 18:01 ` [PATCH mt76-next 19/19] wifi: mt76: mt7615: take each polled station " Felix Fietkau
2026-11-18 8:57 ` Lorenzo Bianconi
2026-11-18 8:20 ` [PATCH mt76-next 01/19] wifi: mt76: don't pin undrainable PS stations in the tx scheduler Lorenzo Bianconi
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=av1j7Xh9lQBNKorF@lore-qca \
--to=lorenzo@kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=nbd@nbd.name \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.