The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Théo Lebrun" <theo.lebrun@bootlin.com>
To: "Nicolas Ferre" <nicolas.ferre@microchip.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Stanimir Varbanov" <svarbanov@suse.de>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<devicetree@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-rpi-kernel@lists.infradead.org>,
	"Broadcom internal kernel review list"
	<bcm-kernel-feedback-list@broadcom.com>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Florian Fainelli" <florian.fainelli@broadcom.com>,
	"Andrea della Porta" <andrea.porta@suse.com>,
	"Claudiu Beznea" <claudiu.beznea@tuxon.dev>,
	"Phil Elwell" <phil@raspberrypi.com>,
	"Jonathan Bell" <jonathan@raspberrypi.com>,
	"Dave Stevenson" <dave.stevenson@raspberrypi.com>,
	<stable@vger.kernel.org>, "Andrew Lunn" <andrew@lunn.ch>
Subject: Re: [PATCH v2 1/5] net: cadence: macb: Set upper 32bits of DMA ring buffer
Date: Wed, 10 Sep 2025 18:57:23 +0200	[thread overview]
Message-ID: <DCPA2BR78XM8.HWKZZ8WQF3S8@bootlin.com> (raw)
In-Reply-To: <3bccf773-abd6-4ade-a1c5-99f2a773b723@microchip.com>

Hello Nicolas, Jakub, Stanimir,

On Tue Aug 26, 2025 at 11:14 AM CEST, Nicolas Ferre wrote:
> On 26/08/2025 at 01:53, Jakub Kicinski wrote:
>> On Fri, 22 Aug 2025 12:34:36 +0300 Stanimir Varbanov wrote:
>>> In case of rx queue reset and 64bit capable hardware, set the upper
>>> 32bits of DMA ring buffer address.
>>>
>>> Cc: stable@vger.kernel.org # v4.6+
>>> Fixes: 9ba723b081a2 ("net: macb: remove BUG_ON() and reset the queue to handle RX errors")
>>> Credits-to: Phil Elwell <phil@raspberrypi.com>
>>> Credits-to: Jonathan Bell <jonathan@raspberrypi.com>
>>> Signed-off-by: Stanimir Varbanov <svarbanov@suse.de>
>>> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
>> 
>>> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
>>> index ce95fad8cedd..36717e7e5811 100644
>>> --- a/drivers/net/ethernet/cadence/macb_main.c
>>> +++ b/drivers/net/ethernet/cadence/macb_main.c
>>> @@ -1634,7 +1634,11 @@ static int macb_rx(struct macb_queue *queue, struct napi_struct *napi,
>>>                macb_writel(bp, NCR, ctrl & ~MACB_BIT(RE));
>>>
>>>                macb_init_rx_ring(queue);
>>> -             queue_writel(queue, RBQP, queue->rx_ring_dma);
>>> +             queue_writel(queue, RBQP, lower_32_bits(queue->rx_ring_dma));
>>> +#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
>>> +             if (bp->hw_dma_cap & HW_DMA_CAP_64B)
>>> +                     macb_writel(bp, RBQPH, upper_32_bits(queue->rx_ring_dma));
>>> +#endif
>>>
>>>                macb_writel(bp, NCR, ctrl | MACB_BIT(RE));
>>>
>> 
>> Looks like a subset of Théo Lebrun's work:
>> https://lore.kernel.org/all/20250820-macb-fixes-v4-0-23c399429164@bootlin.com/
>> let's wait for his patches to get merged instead?
>
> Yes, we can certainly wait. As RBOPH changes by Théo are key, they will 
> probably remove the need for this fix altogether: but I count on you 
> Stanimir to monitor that (as I don't have a 64 bit capable platform at 
> hand).

I when looking for where this patch came from.
Commit in the raspberrypi downstream kernel:
https://github.com/raspberrypi/linux/commit/e45c98decbb16e58a79c7ec6fbe4374320e814f1

It is somewhat unreadable; the only part that seems related is the:

> net: macb: Several patches for RP1
> 64-bit RX fix

 - Is there any MACB hardware (not GEM) that uses 64-bit DMA
   descriptors? What platforms? RPi maybe?

 - Assuming such a platform exists, the next question is why does
   macb_rx() need to reinit RBQPH/0x04D4. It reinits RBQP/0x0018
   because it is the buffer pointer and increments as buffers get used.

   To reinit RBQPH would be for the case of the increment overflowing
   into the upper 32-bits. Sounds like a reasonable fix (for a really
   rare bug) if that hardware actually exists.

   This wouldn't be needed on GEM because RBQPH is shared across queues.
   So of course RBQPH would not increment with the buffer pointer.

If this patch is needed (does HW exist?), then my series doesn't address
it. I can take the patch in a potential V6 if you want. V5 got posted
today [0].

[0]: https://lore.kernel.org/lkml/20250910-macb-fixes-v5-0-f413a3601ce4@bootlin.com/

Thanks,
Have a nice day,

--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


  parent reply	other threads:[~2025-09-10 16:57 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-22  9:34 [PATCH v2 0/5] dd ethernet support for RPi5 Stanimir Varbanov
2025-08-22  9:34 ` [PATCH v2 1/5] net: cadence: macb: Set upper 32bits of DMA ring buffer Stanimir Varbanov
2025-08-22  9:42   ` Nicolas Ferre
2025-08-22 15:16   ` Claudiu Beznea
2025-08-25 23:53   ` Jakub Kicinski
2025-08-26  8:35     ` Stanimir Varbanov
2025-08-26  9:13       ` Nicolas Ferre
2025-08-28  8:29         ` Stanimir Varbanov
2025-08-26  9:14     ` Nicolas Ferre
2025-08-28  8:29       ` Stanimir Varbanov
2025-09-10 16:57       ` Théo Lebrun [this message]
2025-09-11  7:21         ` Théo Lebrun
2025-08-22  9:34 ` [PATCH v2 2/5] dt-bindings: net: cdns,macb: Add compatible for Raspberry Pi RP1 Stanimir Varbanov
2025-08-22 12:15   ` Nicolas Ferre
2025-08-22 15:17   ` Claudiu Beznea
2025-08-22  9:34 ` [PATCH v2 3/5] net: cadence: macb: Add support for Raspberry Pi RP1 ethernet controller Stanimir Varbanov
2025-08-22 12:13   ` Nicolas Ferre
2025-08-22 15:17   ` Claudiu Beznea
2025-09-10 11:32   ` Stanimir Varbanov
2025-09-15 11:27     ` Stanimir Varbanov
2025-09-15 13:34       ` Andrew Lunn
2025-09-15 14:31         ` Stanimir Varbanov
2025-08-22  9:34 ` [PATCH v2 4/5] arm64: dts: rp1: Add ethernet DT node Stanimir Varbanov
2025-09-04 21:06   ` Florian Fainelli
2025-08-22  9:34 ` [PATCH v2 5/5] arm64: dts: broadcom: Enable RP1 ethernet for Raspberry Pi 5 Stanimir Varbanov
2025-09-04 21:06   ` Florian Fainelli
2025-09-04 21:07 ` [PATCH v2 0/5] dd ethernet support for RPi5 Florian Fainelli
2025-09-05  1:47   ` Jakub Kicinski
2025-09-05  1:49     ` Jakub Kicinski
2025-09-05 11:43       ` Stanimir Varbanov
2025-09-05  2:00 ` patchwork-bot+netdevbpf
2025-10-31 11:45 ` Laurent Pinchart
2025-10-31 15:35   ` Stanimir Varbanov
2025-11-02  0:30     ` Laurent Pinchart

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=DCPA2BR78XM8.HWKZZ8WQF3S8@bootlin.com \
    --to=theo.lebrun@bootlin.com \
    --cc=andrea.porta@suse.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=conor+dt@kernel.org \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=jonathan@raspberrypi.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=pabeni@redhat.com \
    --cc=phil@raspberrypi.com \
    --cc=robh@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=svarbanov@suse.de \
    /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