[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] dma_map_single returns 0 on ARM

On 25/10/14 15:11, Stefano Stabellini wrote:
On Fri, 24 Oct 2014, Zoltan Kiss wrote:

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.


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.