From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795937966; b=1Neix4O+cEC5CXokfXfshn592L5uShJHe+bKjSN7wOBHZbk6r9kJGyFJMKVUP+qd017X MoW7jeujeoQbaUKMlRVamRxrDryPtDuoyO30mKeFYcUM+1lHPFV9zx2aLJEuhg7OOkYlO f/nzYrbm0vufxotDioCqcZKj42lIRvIN3NSVOmWj5y65IKfcPbGtnES9r4DNWeKqcfs3X UNeJF6Dq0dgZkBsC5HhNWN1j9rJpFnU/0BHjc0rGxc+WVAwSOQoV9aLRMQ6JoyewBgbfB Gk6hA+uC+HimqWMuMv8xscqg32l7/AAUyOMO/2DDETKludzODtDJI5Q8Ts7hqPVFohQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795937966; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=BuTlUPlFekHjvMIFHJ5w36ZZxAzMmSuQ1fXkXyWe/gI=; b=NziOEuxNGqMyeKiL9p4KLL++rk2MIiUpDefnTUIw3756pQca6/aYYb8CL8wRqBNhUWax mfCrRAA0/OZScYdRf3SoYpFJtvvdETo4KdRbaSl0NFBLIbcd3BsPdi7Fj1Y6u620YdPJH Ufcz8Hv3wCC2yMR3poHnpSdje42m4u0jPSwbxvWIj3jyBbJt80z+MNoEPzFs9dvkDIHwm 48sXqMCApgVDTVfjgTtXtSUiR2jc0At6OXYc23yqU00BVOUZ0Xbtm9wqaKGsQYAP5M7WM T6adU8sJrwtim/WYObrUftlSxvKhFGrqCyTF0p9J9g5LERaCImxOndI71z7eq89wW8A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="YoGPERP/"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 617CA606A339; Sun, 29 Nov 2026 07:39:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YoGPERP/ Received: by smtp.kernel.org (Postfix) with ESMTPSA id C08E21F000C1; Sun, 29 Nov 2026 07:39:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795937966; bh=BuTlUPlFekHjvMIFHJ5w36ZZxAzMmSuQ1fXkXyWe/gI=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=YoGPERP/36eImCBN2GJGFNimqPaMVPCp3KpbELfxspSTReNFXVBuQK1NyfVB7nLus eVCbWsv/Wy1C6svkYljo0BppP8UPRUA3Ju7BK9qND1aC4mLb2oEE+fy2u8ee/o77zZ t1B38dY9uM1G3u1PpFJhRZBDFtYdhaF+ol/+n87/4fE+5M9CwOMSbRJeWB56OOng32 fXiVmwMsXHoZ2GqgvzOfu2+g02RGXANN459nUaGW5BXTe4dBOCqAXEBKBn3Q+NWLTy 6Dc/u7DAH4cBdzHwruCQyF8hUj4BgOM3FkxfQqICURMU35G6qWT6Cyrho7J/8MPp4n El0MQKxmccrjw== Subject: Re: [PATCH net-next v13 3/6] net: wwan: t9xx: Add control DMA interface From: netdev-bot+sashiko@kernel.org To: jackbb_wu@compal.com Cc: loic.poulain@oss.qualcomm.com, ryazanov.s.a@gmail.com, johannes@sipsolutions.net, andrew+netdev@lunn.ch, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, wen-zhi.huang@mediatek.com, shi-wei.yeh@mediatek.com, Minano.tseng@mediatek.com, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, horms@kernel.org, corbet@lwn.net, skhan@linuxfoundation.org, robert_yu@compal.com, Jeff_Chang@compal.com, edumazet@kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-doc@vger.kernel.org Date: Sun, 29 Nov 2026 07:39:24 +0000 Message-ID: <179593796434.3146.14992460300155341559@kernel.org> In-Reply-To: <20261125-t9xx_driver_v1-v13-3-92d9be5fb51e@compal.com> References: <20261125-t9xx_driver_v1-v13-3-92d9be5fb51e@compal.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 1 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] The CLDMA queue code reads and writes registers in a power domain that, per the driver's own comments (mtk_cldma_hw_recovery()… - [Low] The commit message leaves out two hardware-facing decisions made in this patch. -- net: wwan: t9xx: Add control DMA interface This commit adds the CLDMA control-plane DMA driver. It covers the GPD rings for TX and RX, queue start/stop/reset handling and a TRB service thread. It also adds mtk_pci_dev_init()/mtk_pci_dev_exit() hooks in probe and remove so the transport context is attached to the control plane. > diff --git a/drivers/net/wwan/t9xx/pcie/mtk_cldma.c b/drivers/net/wwan/t9xx/pcie/mtk_cldma.c > new file mode 100644 > index 0000000000000..d1472b6759746 > --- /dev/null > +++ b/drivers/net/wwan/t9xx/pcie/mtk_cldma.c [ ... ] > +/* A TX start address reads zero after the device has switched the block's > + * power domain off. That clears the configuration and the start addresses > + * of all its TX queues together and stops them, so every queue is re-armed, > + * as after a reset. > + */ > +static int mtk_cldma_hw_recovery(struct cldma_drv_info *drv_info, u32 qno) > +{ > + u64 val; > + > + dev_err(drv_info->mdev->dev, > + "CLDMA%d lost its queue state, re-initializing\n", > + drv_info->hw_id); > + > + mtk_cldma_rearm_queues(drv_info); > + > + val = mtk_cldma_get_tx_start_addr(drv_info, qno); > + if (!val || val == U64_MAX) > + return -EIO; > + > + return 0; > +} > + > +static int mtk_cldma_start_xfer(struct cldma_drv_info *drv_info, u32 qno) > +{ > + struct txq *txq; > + int ret = 0; > + u64 val; > + > + txq = drv_info->txq[qno]; > + > + /* a reset in another queue's teardown must not land between the > + * address check and the kick > + */ > + mutex_lock(&drv_info->rearm_lock); > + val = mtk_cldma_get_tx_start_addr(drv_info, qno); > + if (unlikely(val == U64_MAX)) { > + ret = -EIO; > + goto out; > + } > + > + if (unlikely(!val)) { > + ret = mtk_cldma_hw_recovery(drv_info, qno); > + if (ret) > + goto out; > + } > + > + /* Hold ring_lock across programming and kicking the queue so the > + * start address given to the device is the one free_idx still > + * names; tx_done_work advances free_idx under the same lock. > + */ > + spin_lock(&txq->ring_lock); > + if (unlikely(!READ_ONCE(txq->tx_started))) { > + mtk_cldma_setup_start_addr(drv_info, DIR_TX, qno, > + txq->req_pool[mtk_cldma_tx_start_idx(txq)].gpd_dma_addr); > + mtk_cldma_start_queue(drv_info, DIR_TX, qno); > + WRITE_ONCE(txq->tx_started, true); > + } else { > + mtk_cldma_resume_queue(drv_info, DIR_TX, qno); > + } > + spin_unlock(&txq->ring_lock); [Severity: Medium] The comments in mtk_cldma_hw_recovery() and mtk_cldma_drv_init() say the device can switch the CLDMA block's power domain off by itself. Is anything holding the domain on for this sequence? mtk_cldma_start_xfer() mtk_cldma_get_tx_start_addr() <- reads a non-zero address [device gates the power domain here] mtk_cldma_resume_queue() / mtk_cldma_start_queue() <- write lost rearm_lock and ring_lock only serialize the host side. As far as I can tell, nothing stops the device from gating the domain between the address check and the doorbell write. If the write is lost, the descriptor stays at HWO=1, no XFER_DONE comes in and tx_done_work never runs. The queue then seems to stay stuck until a later TX submission reads the zero start address and recovers. In a request/response control exchange that is waiting for the reply to the stuck message, that later submission may never happen. The same applies if the domain is still off when mtk_cldma_hw_recovery() runs. The register rewrites in mtk_cldma_rearm_queues() would be lost and the read-back would be zero. The TX then fails with -EIO and gets flushed, and the device is never woken. I couldn't find a device sleep lock, a wake handshake or any pm_runtime use in the t9xx tree, including in the later patches of the series. For comparison, the t7xx CLDMA send path calls t7xx_pci_disable_sleep() and waits for t7xx_pci_sleep_disable_complete() before it touches CLDMA registers. Does this driver need a similar handshake? > +out: > + mutex_unlock(&drv_info->rearm_lock); > + return ret; > +} [ ... ] > diff --git a/drivers/net/wwan/t9xx/pcie/mtk_cldma_drv.c b/drivers/net/wwan/t9xx/pcie/mtk_cldma_drv.c > new file mode 100644 > index 0000000000000..6693528dd2300 > --- /dev/null > +++ b/drivers/net/wwan/t9xx/pcie/mtk_cldma_drv.c [ ... ] > + /* enable interrupt to PCIe */ > + mtk_pci_write32(mdev, base + hw_regs->reg_cldma_int_mask, 0); > + > + /* Bit 0 is ILLEGAL_MEMORY_CHECK_DISABLE. The check only flags a zero > + * GPD/BD/data pointer, through an L3 interrupt this driver does not > + * service; a stale non-zero address is not covered. It is off because > + * the TX start addresses read zero after the device has switched the > + * block's power domain off, and a TX submission that reads one > + * re-initializes instead. > + */ > + mtk_pci_write32(mdev, base + hw_regs->reg_cldma_ul_dummy_0, 1); > + mtk_pci_write32(mdev, base + hw_regs->reg_cldma_so_dummy_0, 1); > +} [Severity: Low] This isn't a bug, but the commit message doesn't mention that these writes turn ILLEGAL_MEMORY_CHECK off for both TX and RX. With the check off, the engine no longer flags a zero GPD/BD/data pointer. The commit message also doesn't mention that any TX kick can re-initialize the whole instance: mtk_cldma_start_xfer() if (unlikely(!val)) mtk_cldma_hw_recovery() mtk_cldma_rearm_queues() mtk_cldma_drv_init() reprograms every published TX queue sets need_restart on every RX queue The only reset behaviour the changelog describes is the escalation when a queue stop times out: A queue that does not stop within the poll escalates to a reset of its CLDMA instance, which also cuts the instance's other queues. Could both of these changes be described in the commit message? None of the later patches in the series describe them either. -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125-t9xx_driver_v1-v13-0-92d9be5fb51e%40compal.com