netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ethernet: ixp4xx: Set the DMA masks explicitly
@ 2021-04-18 18:28 Linus Walleij
  2021-04-19 22:50 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2021-04-18 18:28 UTC (permalink / raw)
  To: netdev, David S . Miller, Jakub Kicinski; +Cc: Linus Walleij

The former fix only papered over the actual problem: the
ethernet core expects the netdev .dev member to have the
proper DMA masks set, or there will be BUG_ON() triggered
in kernel/dma/mapping.c.

Fix this by simply copying dma_mask and dma_mask_coherent
from the parent device.

Fixes: e45d0fad4a5f ("net: ethernet: ixp4xx: Use parent dev for DMA pool")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/net/ethernet/xscale/ixp4xx_eth.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c
index c5b80359124d..956f2b1ee0e4 100644
--- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
+++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
@@ -1084,7 +1084,7 @@ static int init_queues(struct port *port)
 	int i;
 
 	if (!ports_open) {
-		dma_pool = dma_pool_create(DRV_NAME, port->netdev->dev.parent,
+		dma_pool = dma_pool_create(DRV_NAME, &port->netdev->dev,
 					   POOL_ALLOC_SIZE, 32, 0);
 		if (!dma_pool)
 			return -ENOMEM;
@@ -1488,6 +1488,9 @@ static int ixp4xx_eth_probe(struct platform_device *pdev)
 	ndev->netdev_ops = &ixp4xx_netdev_ops;
 	ndev->ethtool_ops = &ixp4xx_ethtool_ops;
 	ndev->tx_queue_len = 100;
+	/* Inherit the DMA masks from the platform device */
+	ndev->dev.dma_mask = dev->dma_mask;
+	ndev->dev.coherent_dma_mask = dev->coherent_dma_mask;
 
 	netif_napi_add(ndev, &port->napi, eth_poll, NAPI_WEIGHT);
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: ethernet: ixp4xx: Set the DMA masks explicitly
  2021-04-18 18:28 [PATCH] net: ethernet: ixp4xx: Set the DMA masks explicitly Linus Walleij
@ 2021-04-19 22:50 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-04-19 22:50 UTC (permalink / raw)
  To: Linus Walleij; +Cc: netdev, davem, kuba

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Sun, 18 Apr 2021 20:28:53 +0200 you wrote:
> The former fix only papered over the actual problem: the
> ethernet core expects the netdev .dev member to have the
> proper DMA masks set, or there will be BUG_ON() triggered
> in kernel/dma/mapping.c.
> 
> Fix this by simply copying dma_mask and dma_mask_coherent
> from the parent device.
> 
> [...]

Here is the summary with links:
  - net: ethernet: ixp4xx: Set the DMA masks explicitly
    https://git.kernel.org/netdev/net/c/8d892d60941b

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-19 22:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-18 18:28 [PATCH] net: ethernet: ixp4xx: Set the DMA masks explicitly Linus Walleij
2021-04-19 22:50 ` patchwork-bot+netdevbpf

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).