* [PATCH net] net: mtk: wed: add dma mask limitation and GFP_DMA32 for device with more than 4GB DRAM
@ 2025-10-08 10:48 Lorenzo Bianconi
2025-10-08 12:37 ` Simon Horman
0 siblings, 1 reply; 3+ messages in thread
From: Lorenzo Bianconi @ 2025-10-08 10:48 UTC (permalink / raw)
To: Felix Fietkau, Sean Wang, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: netdev, linux-arm-kernel, linux-mediatek, Rex Lu, Daniel Pawlik,
Matteo Croce, Lorenzo Bianconi
From: Rex Lu <rex.lu@mediatek.com>
Limit tx/rx buffer address to 32-bit address space for board with more
than 4GB DRAM.
Tested-by: Daniel Pawlik <pawlik.dan@gmail.com>
Tested-by: Matteo Croce <teknoraver@meta.com>
Signed-off-by: Rex Lu <rex.lu@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
drivers/net/ethernet/mediatek/mtk_wed.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
index 3dbb113b792cf00fb4f89ab20f7e7fa72ecac260..cc3f3380a9980a6525921205dc7adaf321a099ae 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
@@ -677,7 +677,7 @@ mtk_wed_tx_buffer_alloc(struct mtk_wed_device *dev)
void *buf;
int s;
- page = __dev_alloc_page(GFP_KERNEL);
+ page = __dev_alloc_page(GFP_KERNEL | GFP_DMA32);
if (!page)
return -ENOMEM;
@@ -800,7 +800,7 @@ mtk_wed_hwrro_buffer_alloc(struct mtk_wed_device *dev)
struct page *page;
int s;
- page = __dev_alloc_page(GFP_KERNEL);
+ page = __dev_alloc_page(GFP_KERNEL | GFP_DMA32);
if (!page)
return -ENOMEM;
@@ -2426,6 +2426,10 @@ mtk_wed_attach(struct mtk_wed_device *dev)
dev->version = hw->version;
dev->hw->pcie_base = mtk_wed_get_pcie_base(dev);
+ ret = dma_set_mask_and_coherent(hw->dev, DMA_BIT_MASK(32));
+ if (ret)
+ return ret;
+
if (hw->eth->dma_dev == hw->eth->dev &&
of_dma_is_coherent(hw->eth->dev->of_node))
mtk_eth_set_dma_device(hw->eth, hw->dev);
---
base-commit: 07fdad3a93756b872da7b53647715c48d0f4a2d0
change-id: 20250930-wed-4g-ram-limitation-6490e7ed9d39
Best regards,
--
Lorenzo Bianconi <lorenzo@kernel.org>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: mtk: wed: add dma mask limitation and GFP_DMA32 for device with more than 4GB DRAM
2025-10-08 10:48 [PATCH net] net: mtk: wed: add dma mask limitation and GFP_DMA32 for device with more than 4GB DRAM Lorenzo Bianconi
@ 2025-10-08 12:37 ` Simon Horman
2025-10-08 13:19 ` Lorenzo Bianconi
0 siblings, 1 reply; 3+ messages in thread
From: Simon Horman @ 2025-10-08 12:37 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: Felix Fietkau, Sean Wang, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Matthias Brugger,
AngeloGioacchino Del Regno, netdev, linux-arm-kernel,
linux-mediatek, Rex Lu, Daniel Pawlik, Matteo Croce
On Wed, Oct 08, 2025 at 12:48:05PM +0200, Lorenzo Bianconi wrote:
> From: Rex Lu <rex.lu@mediatek.com>
>
> Limit tx/rx buffer address to 32-bit address space for board with more
> than 4GB DRAM.
>
Hi Lorenzo, Rex, all,
As a fix for net a Fixes tag should probably go here.
> Tested-by: Daniel Pawlik <pawlik.dan@gmail.com>
> Tested-by: Matteo Croce <teknoraver@meta.com>
> Signed-off-by: Rex Lu <rex.lu@mediatek.com>
> Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
...
> @@ -2426,6 +2426,10 @@ mtk_wed_attach(struct mtk_wed_device *dev)
> dev->version = hw->version;
> dev->hw->pcie_base = mtk_wed_get_pcie_base(dev);
>
> + ret = dma_set_mask_and_coherent(hw->dev, DMA_BIT_MASK(32));
> + if (ret)
> + return ret;
I think 'goto out' is needed here to avoid leaking hw_lock.
> +
> if (hw->eth->dma_dev == hw->eth->dev &&
> of_dma_is_coherent(hw->eth->dev->of_node))
> mtk_eth_set_dma_device(hw->eth, hw->dev);
>
--
pw-bot: changes-requested
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: mtk: wed: add dma mask limitation and GFP_DMA32 for device with more than 4GB DRAM
2025-10-08 12:37 ` Simon Horman
@ 2025-10-08 13:19 ` Lorenzo Bianconi
0 siblings, 0 replies; 3+ messages in thread
From: Lorenzo Bianconi @ 2025-10-08 13:19 UTC (permalink / raw)
To: Simon Horman
Cc: Felix Fietkau, Sean Wang, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Matthias Brugger,
AngeloGioacchino Del Regno, netdev, linux-arm-kernel,
linux-mediatek, Rex Lu, Daniel Pawlik, Matteo Croce
[-- Attachment #1: Type: text/plain, Size: 1209 bytes --]
> On Wed, Oct 08, 2025 at 12:48:05PM +0200, Lorenzo Bianconi wrote:
> > From: Rex Lu <rex.lu@mediatek.com>
> >
> > Limit tx/rx buffer address to 32-bit address space for board with more
> > than 4GB DRAM.
> >
>
> Hi Lorenzo, Rex, all,
Hi Simon,
>
> As a fix for net a Fixes tag should probably go here.
> > Tested-by: Daniel Pawlik <pawlik.dan@gmail.com>
> > Tested-by: Matteo Croce <teknoraver@meta.com>
> > Signed-off-by: Rex Lu <rex.lu@mediatek.com>
> > Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
>
> ...
>
> > @@ -2426,6 +2426,10 @@ mtk_wed_attach(struct mtk_wed_device *dev)
> > dev->version = hw->version;
> > dev->hw->pcie_base = mtk_wed_get_pcie_base(dev);
> >
> > + ret = dma_set_mask_and_coherent(hw->dev, DMA_BIT_MASK(32));
> > + if (ret)
> > + return ret;
>
> I think 'goto out' is needed here to avoid leaking hw_lock.
right, I will fix it in v2.
Regards,
Lorenzo
>
> > +
> > if (hw->eth->dma_dev == hw->eth->dev &&
> > of_dma_is_coherent(hw->eth->dev->of_node))
> > mtk_eth_set_dma_device(hw->eth, hw->dev);
> >
>
> --
> pw-bot: changes-requested
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-08 13:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-08 10:48 [PATCH net] net: mtk: wed: add dma mask limitation and GFP_DMA32 for device with more than 4GB DRAM Lorenzo Bianconi
2025-10-08 12:37 ` Simon Horman
2025-10-08 13:19 ` Lorenzo Bianconi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).