[PATCH] dma: add new dma_mapping_ops API sync_page

Benjamin Herrenschmidt benh at kernel.crashing.org
Fri Oct 10 14:46:02 EST 2008


> > A virtual address will typically be needed to perform the flush; why 
> > pass the bus address?

> Because it is a sync API. You want to make sure that a physical memory
> area is in sync with the caches, not the virtual address. This
> distinction can become important in the event where the page is mapped
> multiple times in the memory and the architecture does not take care of
> synchronizing the multiple mapping, the dma_mapping_ops code should be
> able to synchronize the multiple mapping. In most case it would be easy
> of course to go from virtual address to the page address, but not if the
> page is in high memory ...

Well, not really. IE, you are right that a dma_addr_t or a struct page
is the way to go but for the wrong reasons :-)

All mappings should be coherent. The powerpc architecture is pretty
strict with that. The only known violation is the instruction cache on
44x but that's irrelevant to your problem.

Thus, -any- virtual address will do.

However, you may not have a virtual address. You may get into a
situation where the page isn't in the linear mapping and needs to be
kmap'ed for the sync to happen.

Now, using PCI_DRAM_OFFSET in bus_to_page() is incorrect here with
Becky's new set of changes. You need to get the offset properly using
the accessor she provides (I don't have the name off the top of my
head).

Cheers,
Ben.





More information about the Linuxppc-dev mailing list