Subject: Re: [PATCH net] net: mtk: wed: add dma mask limitation and GFP_DMA32 for device with more than 4GB DRAM

From: Simon Horman <[email-masked]>
Date: Wed, 8 Oct 2025 13:37:31 +0100

On Wed, Oct 08, 2025 at 12:48:05PM +0200, Lorenzo Bianconi wrote:
> From: Rex Lu <[email-masked]>
> 
> 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 <[email-masked]>
> Tested-by: Matteo Croce <[email-masked]>
> Signed-off-by: Rex Lu <[email-masked]>
> Co-developed-by: Lorenzo Bianconi <[email-masked]>
> Signed-off-by: Lorenzo Bianconi <[email-masked]>

...

> @@ -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