lkml.org 
[lkml]   [2011]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] ARM DMA mapping TODO, v1
On Thu, Apr 28, 2011 at 12:01:29PM +0100, Russell King - ARM Linux wrote:

> dma_addr_t dma_map_page(struct device *dev, struct page *page, size_t offset,
> size_t size, enum dma_data_direction dir)
> {
> struct dma_map_ops *ops = get_dma_ops(dev);
> dma_addr_t addr;
>
> BUG_ON(!valid_dma_direction(dir));
> if (ops->flags & DMA_MANAGE_CACHE || !dev->dma_cache_coherent)
> __dma_page_cpu_to_dev(page, offset, size, dir);
> addr = ops->map_page(dev, page, offset, size, dir, NULL);
> debug_dma_map_page(dev, page, offset, size, dir, addr, false);
>
> return addr;
> }
>
> Things like swiotlb and dmabounce would not set DMA_MANAGE_CACHE in
> ops->flags, but real iommus and the standard no-iommu implementations
> would be required to set it to ensure that data is visible in memory
> for CPUs which have DMA incoherent caches.

Do we need flags for that? A flag is necessary if the cache-management
differs between IOMMU implementations on the same platform. If
cache-management is only specific to the platform (or architecture) then
it does make more sense to just call the function without flag checking
and every platform with coherent DMA just implements these as static
inline noops.

Regards,

Joerg



\
 
 \ /
  Last update: 2011-04-28 14:27    [W:0.077 / U:0.352 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site