Article View: linux.kernel.netdev
Article #17201Re: [PATCH net-next v6 6/7] net: ftgmac100: Add AST2700 upper DMA address support
From: netdev-bot+sashiko
Date: Mon, 16 Nov 2026 13:54
Date: Mon, 16 Nov 2026 13:54
123 lines
12946 bytes
12946 bytes
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] On AST2700 (FTGMAC100_QUIRK_DMA_35BIT), the driver stores DMA
address bits 34:32 only in RXDES2[18:16]/TXDES2[18:16].
- [Low] The new register-map comment in ftgmac100.h says '/* reserved
0xcc - 0x178 */', and the patch defines only…
--
net: ftgmac100: Add AST2700 upper DMA address support
On AST2700, this patch programs the high halves of the RX and TX
descriptor ring bases. It also stores DMA address bits 34:32 in bits
18:16 of rxdes2/txdes2, and rebuilds the full address from the
descriptors before unmapping. A 35-bit DMA mask is set, and all of this
is gated behind a new FTGMAC100_QUIRK_DMA_35BIT match-data quirk.
> diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
> index 5a578a62df673..263594de0e072 100644
> --- a/drivers/net/ethernet/faraday/ftgmac100.c
> +++ b/drivers/net/ethernet/faraday/ftgmac100.c
[ ... ]
> @@ -601,6 +612,9 @@ static bool ftgmac100_rx_packet(struct ftgmac100 *priv, int *processed)
>
> /* Tear down DMA mapping, do necessary cache management */
> map = le32_to_cpu(rxdes->rxdes3);
> + if (priv->quirks & FTGMAC100_QUIRK_DMA_35BIT)
> + map |= (u64)FIELD_GET(FTGMAC100_RXDES2_RXBUF_BADR_HI,
> + le32_to_cpu(rxdes->rxdes2)) << 32;
[Severity: Medium]
Is it safe to rebuild the unmap address from rxdes2 after the MAC has
completed the descriptor?
The driver keeps no CPU-side copy of the mapped dma_addr_t. Bits 34:32
are stored only in RXDES2[18:16], and in TXDES2[18:16] on the TX side.
In ftgmac100.h, struct ftgmac100_rxdes still describes rxdes2 as a field
the hardware writes:
__le32 rxdes2; /* length/type on AST2500 */
and struct ftgmac100_txdes still calls txdes2 reserved:
__le32 txdes2; /* Reserved */
Neither comment is updated. Nothing in the patch or the commit message
says whether AST2700 leaves bits 18:16 alone when it writes the
descriptor back.
If the MAC writes any of those bits on completion, dma_unmap_single()
gets the wrong 35-bit handle, both here and in ftgmac100_free_buffers().
The real mapping or swiotlb slot would leak, and the call could sync or
unmap a different mapping. ftgmac100_free_tx_packet() relies on txdes2 in
the same way.
The drop label in ftgmac100_rx_packet() also rewrites only rxdes0 before
it gives the descriptor back to the MAC:
drop:
/* Clean rxdes0 (which resets own bit) */
rxdes->rxdes0 = cpu_to_le32(status & priv->rxdes0_edorr_mask);
In that case, would the next frame be DMA'd to the same low 32 bits but
in a different 4 GiB window? A remote sender can reach this path with
runt, CRC error, oversize or fragmented frames.
Can the AST2700 writeback behaviour for RXDES2/TXDES2 bits 18:16 be
confirmed? Alternatively, would it be safer to keep the full dma_addr_t
on the CPU side and update the descriptor comments to match? Any later
controller that opts into FTGMAC100_QUIRK_DMA_35BIT would inherit the
same assumption.
[ ... ]
> diff --git a/drivers/net/ethernet/faraday/ftgmac100.h b/drivers/net/ethernet/faraday/ftgmac100.h
> index 8c35c895b1465..0c244b1c0a351 100644
> --- a/drivers/net/ethernet/faraday/ftgmac100.h
> +++ b/drivers/net/ethernet/faraday/ftgmac100.h
> @@ -57,6 +57,9 @@
> #define FTGMAC100_OFFSET_RX_RUNT 0xc0
> #define FTGMAC100_OFFSET_RX_CRCER_FTL 0xc4
> #define FTGMAC100_OFFSET_RX_COL_LOST 0xc8
> +/* reserved 0xcc - 0x178 */
> +#define FTGMAC100_OFFSET_TXR_BADDR_HIGH 0x17c
> +#define FTGMAC100_OFFSET_RXR_BADDR_HIGH 0x18c
[Severity: Low]
Is 0x178 really reserved?
Both HIGH registers sit at +4 within a 16-byte aligned block. That looks
like per-ring {LOW, HIGH} pairs: TX at 0x178/0x17c, possibly high
priority TX at 0x180/0x184, and RX at 0x188/0x18c. The comment also
doesn't cover the 0x180 - 0x188 range.
Related to this, ftgmac100_init_hw() writes the low half to the legacy
register and the high half to the new one:
iowrite32(lower_32_bits(priv->rxdes_dma), priv->base + FTGMAC100_OFFSET_RXR_BADR);
if (priv->quirks & FTGMAC100_QUIRK_DMA_35BIT)
iowrite32(upper_32_bits(priv->rxdes_dma),
priv->base + FTGMAC100_OFFSET_RXR_BADDR_HIGH);
The TX ring is set up the same way, using FTGMAC100_OFFSET_NPTXR_BADR
and FTGMAC100_OFFSET_TXR_BADDR_HIGH.
Does AST2700 combine the legacy 0x24/0x20 registers with 0x18c/0x17c,
rather than using separate LOW registers at 0x188/0x178?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112-support_ast2700-v6-0-238020bf46cf%40aspeedtech.com
Technical Details
Message-ID:
<179483726184.3136.10135612629435756137@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364372-linux-kernel-netdev=dewy.ruReferences:
<20261112-support_ast2700-v6-6-238020bf46cf@aspeedtech.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364372-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v6 6/7] net: ftgmac100: Add AST2700 upper DMA address support Date: Mon, 16 Nov 2026 13:54:21 +0000 Organization: Usenet Network Message-ID: <179483726184.3136.10135612629435756137@kernel.org> References: <20261112-support_ast2700-v6-6-238020bf46cf@aspeedtech.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2077795"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:dWHplRIszNtT/wIwAZn6oZPT3oA= sha256:Oc9QMcssn9sXQckOedWI3QxRrsee6icEDpaWR2QdoAA= sha1:F2aL/YHNq6vMQp8vGSi2hWEX+d4= sha256:E1yWqi26qmP5TjEG/ySsfpeN+f9qtmZLeeLU9+iZ5Fs= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id E73DE114C46; Mon, 16 Nov 2026 16:54:59 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hyT1YOVt2YRX; Mon, 16 Nov 2026 16:54:56 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-364372-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id ED3A6114C42; Mon, 16 Nov 2026 16:54:45 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 47FF42CFB5; Mon, 16 Nov 2026 13:54:38 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794837269; b=YUP/6nYKqIByWO5mIpP5vQvADV5YWMv8NfJoVYyfp7MlbQEseKYe1p31Dd4dSVBGM5zJ 163cDa5tTO2l+3S/ivo3Z6Sf1gyraOdx9AZTzjkWfOyS//nH2+sEMxDQvcp05rJ2V3Cr5 DUY3fSqVaj8hLQ9Ms7Dof3jcuVGhRqXWLXC273zE7GUsTf9lorkCE/9dmZQGmSqGAQGDq aWk416F0k8MSxSCSUMu/OK3y0U876oQpvesyOTXycVriMaAzDiJRzTMZWgc9zrn0F+OMU CuuD4LSXOLKPG3cfeG/tUrJmiuXDTnN6PzRNRxg2+qXpk4ozYE+VYhKsxj3mZ8YQE/w== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794837269; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=8Qmd3zTWqxKS9EXQprMTTNgzTyEpTck3iz7Im4ijSnc=; b=Kz94r7OshOAQQNdKl1dP2qWx05qoy9dV1wfKWIcn/He9hxmgEqeGI03RKM8MOL1v0VTe 2NihlcsYrWV4vW6dkIxsGSGmLyV5JoTEDX0aFG5VkBaCW6yy1qQeqmw5sEQUSV3SIS6gZ Yb5AjJ3ImGan+pjGfLPbmQFg9JfKizZD6lbynWtUSvTx5ZppZiRu+U1E7Jer+4dV++wdQ lnVsVvMoNo+81s3SSK0f/mcBveHMTS2HmR+rN9gjJR/1nLwdMN2NTtWV5KgF45l6pxvDx QobE+XWtQoy9ZAWkpTHcxAoG7OLxYaPB8Lg214rL+TEG03A4B4MNTfcNVBDXv3b4wtQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=aXXZ3Wb2; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 387B4606A33D; Mon, 16 Nov 2026 13:54:29 +0000 (UTC) X-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=aXXZ3Wb2 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794837263; b=3xf996+0EVq+3qVytD6SdmRIIPrQz9YO22noi+J7lMOBMvuQeo+WUd0dwxe7ckpuPxDl c/yRx8qfjQGJCUM9okpmr/JJ1MbfskHZ4d1JlbMcCGkOiTMKWxLZ5snwWPYT1IBPmgJ+v J3AyWxMwLn+CJYJaSym5ZU3hONEk0rPg2G7SVqqBV+4HDG7SLLcL/PwnB0h+mH8/JKs5f ddo7fYgt1oPdt7XDK19sX5dV4S0kul/A5JeuIkgqAV3vw5Gfue0hC13Y+H2w7RZ6AESh+ vmuOOrgL/jt/JN2+m+5wfgcivPeZeHpVzUsDtAe1+IACs3NAayCb0JR6jgEnMqDl4sQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794837263; 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=8Qmd3zTWqxKS9EXQprMTTNgzTyEpTck3iz7Im4ijSnc=; b=uSbTy2GnObbgKBZGRAQ1F8CnKBMYDu+gmk5dvD5fCyr2MSTj+9Fw+R0F7XdzBUpFkHQC crEebxlsNvgHVULWZbOvqSSi0E8Xm+glO1Ijmx2mx31vz3EW6REE9qGP2R4fiA7thMnnf gthFYF/q9/IKUVypIyVSgpoBbN9Gz0r4B7/HiqQo6S51wn/xGdDmo9P8UZsPBJCbiD/nd eWOVujTWik7a0rtp7hv2w9VFIoF9HnBixKxM1/biH0d8hJbrBi1Zz7/KwgR8iq9QvjARI 67KTktaLmvaRJ0VXKWhgcmToaNy7SBcPQpvAYFyO0F+MXbqQTu8Q8VO6kvrXaqq1Xog== X-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=aXXZ3Wb2; arc=none smtp.remote-ip=100.103.45.18 X-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 590DB606A88A; Mon, 16 Nov 2026 13:54:23 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4943E1F00926; Mon, 16 Nov 2026 13:54:22 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794837263; bh=8Qmd3zTWqxKS9EXQprMTTNgzTyEpTck3iz7Im4ijSnc=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=aXXZ3Wb2PNRSc9/G8cAutp7a+2N0wKqh39UAGy2QW/aSh5iOIonPvxTASxV7ZoEzv XXt8CNX7o9ay65yjAitxSzvaD3hAaG5rIix7KLI1vI+GPYgo9BFppZLfuGO1Z1jOve mVB5P0OfN6QyNbEE8YjVMQTt7VMUnVnqQFxlDIESS1qkGuSb7nhctPrzSDLFXteNE8 R1z0WG9EbM6BgH1QN1ckH2XZNfUrnfAr2H/7Eyy3Mh1j4PR76Ef7Thr3Ul8mgrywF5 CgSM4s9AW4Ppg6ab8eAj1WZMiseLUFMfV/laQYz26njL7zCLS8vhN2mCaAgPV6kFlq FID81WU+efegg== X-Cc: andrew+netdev@lunn.ch, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, ratbert@faraday-tech.com, edumazet@kernel.org, hkallweit1@gmail.com, linux@armlinux.org.uk, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, andrew@lunn.ch X-In-Reply-To: <20261112-support_ast2700-v6-6-238020bf46cf@aspeedtech.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list