From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 315C0606A323 for ; Sun, 29 Nov 2026 07:39:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=hm2ukag0; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YoGPERP/ DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version: Content-Transfer-Encoding:Content-Type:References:In-Reply-To:Message-ID:Date :Cc:To:From:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=BuTlUPlFekHjvMIFHJ5w36ZZxAzMmSuQ1fXkXyWe/gI=; b=hm2ukag0F9x7UUa3WjfBP4Niqi x9Td1jxkq4iK7phnUMtAbkPeBilPlspVG+7ZmuaFVxWDmOrj3MIQpUrOCzVt8LICN6dl1SEApDqzB NRaBaekUarP6r5hZ8r+zVxrzTxUxriEV09Mbm+TMFNDQV3lh8jMb1+/7+Jc2VKpIGQ8+sgOhRWO4M B1wboLkftZgcYbkFTMCebdCTlubdjG53D4oa59zzQ+Sd2pzqlQHsxe/4qeI9ln9rzKnvYyU5Ck4M5 e5QYr/ueGTCHvY1Y1kVIvCyGqOU9psPDdxt8n7qqC9Fob9JN5V3qw99lZjDxY4yrGx0uRF5N3980c dQSeue3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXZVg-00000001fZN-3pFT; Sun, 29 Nov 2026 07:39:44 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXZVP-00000001fUI-0mMN; Sun, 29 Nov 2026 07:39:27 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 55957609EB; Sun, 29 Nov 2026 07:39:26 +0000 (UTC) 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-Archived-By: MIME-Version: 1.0 X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" X-Spam-Status: No, score=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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