All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Halasa <khc@pm.waw.pl>
To: Christophe Aeschlimann <aeschlimann@gmail.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Christophe Aeschlimann <c.aeschlimann@acn-group.ch>
Subject: Re: [PATCH] ixp4xx_eth: set the device dma_coherent_mask
Date: Tue, 19 Mar 2013 23:35:46 +0100	[thread overview]
Message-ID: <m3sj3rdnlp.fsf@intrepid.localdomain> (raw)
In-Reply-To: <1363708765-20778-1-git-send-email-c.aeschlimann@acn-group.ch> (Christophe Aeschlimann's message of "Tue, 19 Mar 2013 16:59:25 +0100")

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

      parent reply	other threads:[~2013-03-19 22:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3sj3rdnlp.fsf@intrepid.localdomain \
    --to=khc@pm.waw.pl \
    --cc=aeschlimann@gmail.com \
    --cc=c.aeschlimann@acn-group.ch \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.