* driver replacements for kmalloc and __pa()
@ 2008-09-09 22:00 Jeff Brower
2008-09-09 22:24 ` Scott Wood
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Brower @ 2008-09-09 22:00 UTC (permalink / raw)
To: linuxppc-embedded
Hello,
We have inherited an older driver that uses kmalloc() and vtophys (which resolves to
the __pa() macro) to create memory accessible by an external PCI device doing bus
master read/writes. The driver works Ok on several x86 machines, but is failing on a
PPC board (MPC7447/8) running Gentoo Linux 2.6.9. After looking at PCI bus analyzer
captures, it seems the physical address the driver is giving to the PCI device is
invalid, so the device ends up reading/writing incorrect memory areas.
What are the up-to-date APIs we should be using for DMA memory allocation and
virtual-to-physical address translation? We have another driver for another device
that's working fine on this board and it uses pci_alloc_consistent(). What about
bus_space_vaddr()? I'm hoping to get a recommendation for what's currently
appropriate and most future-proof for drivers that depend on external PCI DMA.
Any suggestions welcome. Thanks.
-Jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: driver replacements for kmalloc and __pa()
2008-09-09 22:00 driver replacements for kmalloc and __pa() Jeff Brower
@ 2008-09-09 22:24 ` Scott Wood
2008-09-11 0:44 ` Jeff Brower
0 siblings, 1 reply; 3+ messages in thread
From: Scott Wood @ 2008-09-09 22:24 UTC (permalink / raw)
To: Jeff Brower; +Cc: linuxppc-embedded
Jeff Brower wrote:
> What are the up-to-date APIs we should be using for DMA memory allocation and
> virtual-to-physical address translation? We have another driver for another device
> that's working fine on this board and it uses pci_alloc_consistent(). What about
> bus_space_vaddr()? I'm hoping to get a recommendation for what's currently
> appropriate and most future-proof for drivers that depend on external PCI DMA.
Documentation/DMA-API.txt.
-Scott
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: driver replacements for kmalloc and __pa()
2008-09-09 22:24 ` Scott Wood
@ 2008-09-11 0:44 ` Jeff Brower
0 siblings, 0 replies; 3+ messages in thread
From: Jeff Brower @ 2008-09-11 0:44 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-embedded
Scott-
> > What are the up-to-date APIs we should be using for DMA memory allocation and
> > virtual-to-physical address translation? We have another driver for another device
> > that's working fine on this board and it uses pci_alloc_consistent(). What about
> > bus_space_vaddr()? I'm hoping to get a recommendation for what's currently
> > appropriate and most future-proof for drivers that depend on external PCI DMA.
>
> Documentation/DMA-API.txt.
Thanks very much Scott. It appears that dma_alloc_coherent() is the recommended
path. Is there a good reason to use this instead of pci_alloc_consistent()? I can
find comments about using the GFP_KERNEL flag with dma_alloc_coherent(), which is
supposed to help when the system is low on memory. But we wouldn't expect that to
occur in a situation where the driver is loaded/initialized at boot-time.
-Jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-09-11 0:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-09 22:00 driver replacements for kmalloc and __pa() Jeff Brower
2008-09-09 22:24 ` Scott Wood
2008-09-11 0:44 ` Jeff Brower
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).