Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: jacky_chou@aspeedtech.com
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
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	[thread overview]
Message-ID: <179483726184.3136.10135612629435756137@kernel.org> (raw)
In-Reply-To: <20261112-support_ast2700-v6-6-238020bf46cf@aspeedtech.com>

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

  reply	other threads:[~2026-11-16 13:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12  8:39 [PATCH net-next v6 0/7] net: ftgmac100: Add AST2700 support Jacky Chou
2026-11-12  8:39 ` [PATCH net-next v6 1/7] dt-bindings: net: ftgmac100: Make Aspeed compatibles standalone Jacky Chou
2026-11-12 18:43   ` Conor Dooley
2026-11-16 13:54   ` netdev-bot+sashiko
2026-11-12  8:39 ` [PATCH net-next v6 2/7] dt-bindings: net: ftgmac100: Add AST2700 compatible Jacky Chou
2026-11-12 18:44   ` Conor Dooley
2026-11-16 13:54   ` netdev-bot+sashiko
2026-11-16 14:10     ` Andrew Lunn
2026-11-12  8:39 ` [PATCH net-next v6 3/7] net: ftgmac100: Add AST2700 compatible support Jacky Chou
2026-11-16 13:54   ` netdev-bot+sashiko
2026-11-12  8:39 ` [PATCH net-next v6 4/7] net: ftgmac100: Enable AST2700 RMII support Jacky Chou
2026-11-16 13:54   ` netdev-bot+sashiko
2026-11-12  8:39 ` [PATCH net-next v6 5/7] net: ftgmac100: Require phy-mode for AST2700 Jacky Chou
2026-11-16 13:54   ` netdev-bot+sashiko
2026-11-12  8:39 ` [PATCH net-next v6 6/7] net: ftgmac100: Add AST2700 upper DMA address support Jacky Chou
2026-11-16 13:54   ` netdev-bot+sashiko [this message]
2026-11-12  8:39 ` [PATCH net-next v6 7/7] net: ftgmac100: Allow building on ARM64 Jacky Chou
2026-11-16 13:54   ` netdev-bot+sashiko

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=179483726184.3136.10135612629435756137@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=jacky_chou@aspeedtech.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ratbert@faraday-tech.com \
    --cc=robh@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox