lkml.org 
[lkml]   [2009]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 8/8] remove map_single and unmap_single in struct dma_mapping_ops
From
On Mon, 5 Jan 2009 19:00:38 +0100
Joerg Roedel <joro@8bytes.org> wrote:

> Is it the right way to implement map_single in terms of map_page? Doing
> this you optimize for the map_page case. But a grep in drivers/ shows:
>
> linux/drivers $ grep -r _map_page *|wc -l
> 126
> linux/drivers $ grep -r _map_single *|wc -l
> 613

The comparison is irrelevant since dma_map_page and dma_map_single
have different purposes.

If passing virtual memory address to an IOMMU is enough (and
convenient), then drivers use dma_map_single.

For some purposes, drivers need to pass a page frame and use
dma_map_page (or dma_map_sg).

We could have two hooks in dma_map_ops struct for dma_map_single and
dma_map_page. Say, we have map_single and map_page hooks. But the
map_page hook can be used to support both dma_map_single and
dma_map_page. Note that the map_single hook can't do that since it use
a virtual address as an argument. That's why I have only the map_page
hook in dma_map_ops struct.

As X86 does now, we could have map_single hook that use a physical
address to handle both dma_map_single and dma_map_page. However, it's
confusing since it means that the arguments of dma_map_single and its
hook (map_single) is inconsistent.


> There are a lot more users of map_single than of map_page. I think its
> better to optimize for the map_single case and implement map_page in
> terms of map_single.

As I wrote above, it doesn't make sense.


\
 
 \ /
  Last update: 2009-01-06 11:25    [W:0.081 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site