dma_ops->map_page == NULL

Becky Bruce beckyb at
Wed Jul 8 01:49:15 EST 2009

On Jul 7, 2009, at 9:37 AM, Kumar Gala wrote:

> On Jul 7, 2009, at 6:08 AM, Benjamin Herrenschmidt wrote:
>> On Tue, 2009-07-07 at 10:15 +1000, Mark Nelson wrote:
>>> When the 32 and 64bit DMA code was merged in .28 , map_/ 
>>> unmap_page() was
>>> added in favour of map_/unmap_single() (which was later removed  
>>> in .29)
>>> so you'll have to replace your calls to dma_map_single() with
>>> dma_map_page(). Just pass it the page and offset rather than the  
>>> address.
>> Wait a minute ... dma_map_single() should still work, it will just  
>> call
>> dma_map_page() underneath. All dma_ops should have a ->map page
>> callback.

>> Do you have any dma_ops set for your device at all ? I wonder how we
>> set the dma_ops for platform devices nowadays ... We use to have this
>> fallback to direct ops when the dma_ops are NULL but that is gone and
>> I see no suitable replacement to set them on platform devices for
>> embedded archs ... oops...

There is a platform/of bus notifier that sets the dma_ops to a default  
value in arch/powerpc/kernel/setup-common.c.

>> Kumar, Becky, what's the situation there ?
>> Cheers,
>> Ben.
> Is it possible the dev pointer is not valid?  I can't remember if  
> that was a .29 or .30 change that requires us to start passing a  
> valid dev pointer to get the proper dma_ops.

I'm pretty sure that went into .29.  And invalid dev pointer is the  
most likely culprit.  IIRC, the usual cause of this is that you're  
passing in the *wrong* dev pointer.  There are often struct  
hierarchies with, confusingly, multiple struct device pointers.  You  
need the one which has archdata dma_ops setup properly.  For an of  
device, you want the dev pointer that is part of the of_device struct.

If this isn't your problem, then please post some code so we can look  
at this further, and post a log of what's happening.


More information about the Linuxppc-dev mailing list