Re:Re: [PATCH net-next 13/14] net: renesas: rswitch: Remove obsolete 32-bit DMA mask fallback

From: 周睿哲 <hidden>
Date: 2026-09-03 12:52:37
Also in: linux-renesas-soc, lkml


Hi Geert,
Thanks for the fast feedback!
My last reply got glitched up by the mail client so I resend this instead. 
Hope this won't cause too much trouble. If you did receive my last reply
and everything looks fine please igore this.

From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2026-09-03 17:43:03
To:  Ruizhe Zhou <redacted>
Cc:  Andrew Lunn <andrew+netdev@lunn.ch>,"David S. Miller" <davem@davemloft.net>,Eric Dumazet <edumazet@google.com>,Jakub Kicinski <kuba@kernel.org>,Paolo Abeni <pabeni@redhat.com>,netdev@vger.kernel.org,linux-kernel@vger.kernel.org,Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH net-next 13/14] net: renesas: rswitch: Remove obsolete 32-bit DMA mask fallback>Hi Ruizhe,
Thanks for your patch!

On Thu, 3 Sept 2026 at 11:27, Ruizhe Zhou [off-list ref] wrote:
quoted
The DMA API guarantees support for masks of 32 bits or wider and
Really?
quoted
explicitly identifies retrying a 32-bit mask after a wider request as
incorrect:
https://docs.kernel.org/core-api/dma-api-howto.html#dma-addressing-capabilities
AFAIUI, that is only true iff the wider request is DMA_BIT_MASK(64).
At that specific link I will quote this: " dma_set_mask_and_coherent() will never return failure when bigger than 32."
So yes, I believe this applies for all masks > 32.
quoted
quoted
Remove the obsolete fallback while retaining the error check so that a
genuine DMA setup failure still aborts initialization.
Have you tested this on actual hardware, with/without IOMMU support?

No I haven't as I stated in the cover letter. But I also believe what is important
here is this change is trying to point out that a failed >32bit
mask dma call is fundamentally not correctable by trying a smaller mask.
The mask passed to the DMA API describes the highest address a device can
reach. It asks the DMA layer to keep mappings within that limit; it is not
a probe asking the platform which addressing mode the device should use.
A wider mask includes every address permitted by a 32-bit mask, including
addresses from a platform that only produces 32-bit DMA addresses. The links
I provided in the cover letter explain that.
quoted
Signed-off-by: Ruizhe Zhou <redacted>
---
 drivers/net/ethernet/renesas/rswitch_main.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/renesas/rswitch_main.c b/drivers/net/ethernet/renesas/rswitch_main.c
index 755232994fcc..64b821ca02f8 100644
--- a/drivers/net/ethernet/renesas/rswitch_main.c
+++ b/drivers/net/ethernet/renesas/rswitch_main.c
@@ -2162,11 +2162,8 @@ static int renesas_eth_sw_probe(struct platform_device *pdev)
                return -ENOMEM;

        ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(40));
-       if (ret < 0) {
-               ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
-               if (ret < 0)
-                       return ret;
-       }
+       if (ret)
+               return ret;

        priv->gwca.index = AGENT_INDEX_GWCA;
        priv->gwca.num_queues = min(RSWITCH_NUM_PORTS * NUM_QUEUES_PER_NDEV,
Gr{oetje,eeting}s,

                       Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                               -- Linus Torvalds
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help