All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ixp4xx_eth: set the device dma_coherent_mask
@ 2013-03-19 15:59 Christophe Aeschlimann
  2013-03-19 16:33 ` David Miller
  2013-03-19 22:35 ` Krzysztof Halasa
  0 siblings, 2 replies; 4+ messages in thread
From: Christophe Aeschlimann @ 2013-03-19 15:59 UTC (permalink / raw)
  To: khc; +Cc: netdev, linux-kernel, Christophe Aeschlimann

Without the mask it is impossible to take the network interface up
since it returns the following error:

> net eth1: coherent DMA mask is unset
> ifconfig: SIOCSIFFLAGS: Cannot allocate memory

Tested on an out-of-tree ixp425 based board.

Signed-off-by: Christophe Aeschlimann <c.aeschlimann@acn-group.ch>
---
 drivers/net/ethernet/xscale/ixp4xx_eth.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c
index 6958a5e..ff23c5c 100644
--- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
+++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
@@ -1398,6 +1398,7 @@ static int eth_init_one(struct platform_device *pdev)
 		return -ENOMEM;
 
 	SET_NETDEV_DEV(dev, &pdev->dev);
+	dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
 	port = netdev_priv(dev);
 	port->netdev = dev;
 	port->id = pdev->id;
-- 
1.7.9


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

* Re: [PATCH] ixp4xx_eth: set the device dma_coherent_mask
  2013-03-19 15:59 [PATCH] ixp4xx_eth: set the device dma_coherent_mask Christophe Aeschlimann
@ 2013-03-19 16:33 ` David Miller
  2013-03-19 17:04   ` Mugunthan V N
  2013-03-19 22:35 ` Krzysztof Halasa
  1 sibling, 1 reply; 4+ messages in thread
From: David Miller @ 2013-03-19 16:33 UTC (permalink / raw)
  To: aeschlimann; +Cc: khc, netdev, linux-kernel, c.aeschlimann

From: Christophe Aeschlimann <aeschlimann@gmail.com>
Date: Tue, 19 Mar 2013 16:59:25 +0100

> Without the mask it is impossible to take the network interface up
> since it returns the following error:
> 
>> net eth1: coherent DMA mask is unset
>> ifconfig: SIOCSIFFLAGS: Cannot allocate memory
> 
> Tested on an out-of-tree ixp425 based board.
> 
> Signed-off-by: Christophe Aeschlimann <c.aeschlimann@acn-group.ch>
 ...
> @@ -1398,6 +1398,7 @@ static int eth_init_one(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	SET_NETDEV_DEV(dev, &pdev->dev);
> +	dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);

Hmmm, shouldn't this be the default value, set by the bus layer or
similar?

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

* Re: [PATCH] ixp4xx_eth: set the device dma_coherent_mask
  2013-03-19 16:33 ` David Miller
@ 2013-03-19 17:04   ` Mugunthan V N
  0 siblings, 0 replies; 4+ messages in thread
From: Mugunthan V N @ 2013-03-19 17:04 UTC (permalink / raw)
  To: David Miller; +Cc: aeschlimann, khc, netdev, linux-kernel, c.aeschlimann

On 3/19/2013 10:03 PM, David Miller wrote:
> From: Christophe Aeschlimann<aeschlimann@gmail.com>
> Date: Tue, 19 Mar 2013 16:59:25 +0100
>
>> >Without the mask it is impossible to take the network interface up
>> >since it returns the following error:
>> >
>>> >>net eth1: coherent DMA mask is unset
>>> >>ifconfig: SIOCSIFFLAGS: Cannot allocate memory
>> >
>> >Tested on an out-of-tree ixp425 based board.
>> >
>> >Signed-off-by: Christophe Aeschlimann<c.aeschlimann@acn-group.ch>
>   ...
>> >@@ -1398,6 +1398,7 @@ static int eth_init_one(struct platform_device *pdev)
>> >  		return -ENOMEM;
>> >  
>> >  	SET_NETDEV_DEV(dev, &pdev->dev);
>> >+	dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
> Hmmm, shouldn't this be the default value, set by the bus layer or
> similar?
bus layer or any platform code doesn't init this value. The same issue 
applies
to CPSW driver also. Previously the same was done in board or device 
file. But
this approach is obsolete now, need to think of how it can be resolved in DT
approach

Regards
Mugunthan V N

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

* Re: [PATCH] ixp4xx_eth: set the device dma_coherent_mask
  2013-03-19 15:59 [PATCH] ixp4xx_eth: set the device dma_coherent_mask Christophe Aeschlimann
  2013-03-19 16:33 ` David Miller
@ 2013-03-19 22:35 ` Krzysztof Halasa
  1 sibling, 0 replies; 4+ messages in thread
From: Krzysztof Halasa @ 2013-03-19 22:35 UTC (permalink / raw)
  To: Christophe Aeschlimann; +Cc: netdev, linux-kernel, Christophe Aeschlimann

Christophe Aeschlimann <aeschlimann@gmail.com> writes:

> Without the mask it is impossible to take the network interface up
> since it returns the following error:
>
>> net eth1: coherent DMA mask is unset
>> ifconfig: SIOCSIFFLAGS: Cannot allocate memory
>
> +++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
> @@ -1398,6 +1398,7 @@ static int eth_init_one(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	SET_NETDEV_DEV(dev, &pdev->dev);
> +	dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
>  	port = netdev_priv(dev);
>  	port->netdev = dev;
>  	port->id = pdev->id;

This happens to work but seems to me like a bad "solution". The real
issue is that current ARM coherent_dma_mask (and regular dma_mask)
handling is just broken (at least on platforms with
CONFIG_ARCH_HAS_DMA_SET_COHERENT_MASK). I'm thinking how can it be
fixed.

The problematic parts include the dmabouncer (which takes over DMA
operations and provide services similar to swiotlb), the host DMA and
coherent DMA masks (which are property of the buses) and the device
masks, which should be ANDed with bus masks (but aren't).

What the driver should use is:
	err = dma_set_coherent_mask(xxx);

(but the subsystem have to be fixed first).
Also, according to DMA-API, 32-bit is the default.
-- 
Krzysztof Halasa

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

end of thread, other threads:[~2013-03-19 22:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-19 15:59 [PATCH] ixp4xx_eth: set the device dma_coherent_mask Christophe Aeschlimann
2013-03-19 16:33 ` David Miller
2013-03-19 17:04   ` Mugunthan V N
2013-03-19 22:35 ` Krzysztof Halasa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.