All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zoltan Kiss <zoltan.kiss@linaro.org>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: xen-devel@lists.xenproject.org
Subject: Re: dma_map_single returns 0 on ARM
Date: Mon, 27 Oct 2014 15:58:47 +0000	[thread overview]
Message-ID: <544E6BB7.9080504@linaro.org> (raw)
In-Reply-To: <alpine.DEB.2.02.1410271542520.22875@kaball.uk.xensource.com>



On 27/10/14 15:44, Stefano Stabellini wrote:
> On Mon, 27 Oct 2014, Zoltan Kiss wrote:
>> On 25/10/14 15:11, Stefano Stabellini wrote:
>>> On Fri, 24 Oct 2014, Zoltan Kiss wrote:
>>>> Hi,
>>>>
>>>> I'm trying to fire up the Ethernet port of a Hisilicon D01 board, and it
>>>> fails
>>>> when it wants to map the buffers to the device:
>>>>
>>>> 		phys = dma_map_single(&ndev->dev, priv->rx_buf[i],
>>>> 				RX_BUF_SIZE, DMA_FROM_DEVICE);
>>>>
>>>> This returns 0, while running on bare metal it works. Does anyone has an
>>>> advice where should I look?
>>>
>>> dma_map_single should just be a wrapper around dma_ops->map_page that in
>>> dom0 is implemented by xen_swiotlb_map_page.
>>>   From looking at the code the issue appears to be that dma_capable
>>> returns false for your device.
>>>
>>> In any case even if dma_map_single returned a valid address, keep in
>>> mind that at the moment if the device is not dma coherent Linux needs
>>> to be compiled with CONFIG_ARM_LPAE to be able to cache flush the
>>> buffers correctly. But the failure in that case is a memory corruption
>>> after the dma request is completed.
>>>
>>
>> Thanks for the advices. I've managed to figure out that dma_map_single fails
>> because dev->dma_mask was a NULL pointer. I've set it during probe with this:
>>
>> dma_coerce_mask_and_coherent(&ndev->dev, DMA_BIT_MASK(32));
>>
>> And the mappings seems to be set up properly (a bit below 512M), but the
>> returned buffers are filled up with 0xAA, which I guess is probably some
>> default value. Turning on and off CONFIG_ARM_LPAE did not helped.
>> I'll keep looking why is that, if you have an idea let me know.
>
> Are you trying to do regular DMA in dom0 or are you running other guests?
> If you are just doing DMA in dom0, then I don't have any suggestions:
> that should work.
I have only Dom0 running. And one important thing I forgot to mention: 
due to other restrictions I'm using a 3.14 kernel right now!

Zoli

      reply	other threads:[~2014-10-27 15:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-24 16:40 dma_map_single returns 0 on ARM Zoltan Kiss
2014-10-25 14:11 ` Stefano Stabellini
2014-10-26 20:39   ` Julien Grall
2014-10-27  4:42     ` manish jaggi
2014-10-27 15:45       ` Stefano Stabellini
2014-10-27 15:30   ` Zoltan Kiss
2014-10-27 15:44     ` Stefano Stabellini
2014-10-27 15:58       ` Zoltan Kiss [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=544E6BB7.9080504@linaro.org \
    --to=zoltan.kiss@linaro.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.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.