[openib-general] [PATCH v2 1/7] IB/core - Add DMA mapping functions to allow device drivers to interpose

Ralph Campbell ralphc at pathscale.com
Tue Dec 5 15:10:56 PST 2006


On Tue, 2006-12-05 at 14:59 -0800, Ralph Campbell wrote:

> The ib_dma_mapping_ops functions as implemented by ib_ipath,
> are redefining dma_addr_t as a kernel virtual address.
> When ib_dma_map_single() is called, this is a NOP.
> When ib_dma_map_sg() is called, the dma_map_sg() replacement needs
> to convert a struct page pointer into a kernel virtual address.
> When CONFIG_HIGHMEM is defined, some pages may not be mapped
> into the kernel virtual address space so the driver needs to
> call kmap().  Since the driver can't use the struct scattergather
> to store the kmap() result, a separate table needs to be used
> so the value can be returned by ib_sg_dma_address().
> 
> Doing kmap_atomic() at the point where the kernel virtual
> address is used is not practical since the driver is not
> mapping dma_addr_t to struct page * although it is
> possible to write it that way.  It would mean that
> ib_map_single() would then be more complex in that a
> kernel virtual address would need to be converted to a
> struct page *.

I forgot this last part.

Making dma_addr_t a kernel virtual address does allow
the result to be offset (at least within a page)
but making dma_addr_t a struct page pointer doesn't.





More information about the general mailing list