Messages in this thread | | | Subject | Re: [RFC] generic device DMA implementation | Date | Wed, 04 Dec 2002 19:44:17 -0600 | From | James Bottomley <> |
| |
david@gibson.dropbear.id.au said: > Do you have an example of where the second option is useful? Off hand > the only places I can think of where you'd use a consistent_alloc() > rather than map_single() and friends is in cases where the hardware's > behaviour means you absolutely positively have to have consistent > memory.
Well, it comes from parisc drivers. Here you'd really rather have consistent memory because it's more efficient, but on certain platforms it's just not possible.
In the drivers that do this, it leads to this type of awfulness:
consistent = 1; if(!mem = pci_alloc_consistent() { mem = __get_free_pages mem = pci_map_single() consistent = 1; } .... if(!consistent) dma_cache_wback()
etc.
The idea is that this translates to
mem = dma_alloc_consistent(... DMA_CONFORMANCE_NON_CONSISTENT)
...
dma_sync_single(mem..)
Where if you have consistent memory then the sync is a nop.
adam@yggdrasil.com said: > If these routines can allocate non-consistent memory, then how about > renaming them to something less misleading, like dma_{malloc,free}?
Yes, I think the above makes this point. I'll change the names.
James
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |