On Wed, Jun 18, 2025 at 7:04 PM Baruch Siach <[email protected]> wrote:
>
> Device bus address might not be valid for direct access when the bus
> address and CPU address are not the same. Use dev_bus_to_phys() to
> translate bus address back to CPU address.
>
> Fixes: 3d98b8c504e15 ("net: designware: Invalidate RX buffer cache before
> freeing the DMA descriptor")
> Signed-off-by: Baruch Siach <[email protected]>
> ---
> drivers/net/designware.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/designware.c b/drivers/net/designware.c
> index 0f93c25e3fed..fce3ef910cb2 100644
> --- a/drivers/net/designware.c
> +++ b/drivers/net/designware.c
> @@ -716,7 +716,7 @@ static int _dw_free_pkt(struct dw_eth_dev *priv)
> ulong desc_start = (ulong)desc_p;
> ulong desc_end = desc_start +
> roundup(sizeof(*desc_p), ARCH_DMA_MINALIGN);
> - ulong data_start = desc_p->dmamac_addr;
> + ulong data_start = dev_bus_to_phys(priv->dev, desc_p->dmamac_addr);
> ulong data_end = data_start + roundup(CFG_ETH_BUFSIZE,
> ARCH_DMA_MINALIGN);
>
> /* Invalidate the descriptor buffer data */
> --
> 2.47.2
>
Reviewed-by: Ramon Fried <[email protected]>