[openib-general] [PATCH 5/6] [RFC] iser handling of memory for RDMA

Christoph Hellwig hch at lst.de
Fri Feb 24 13:20:29 PST 2006


On Thu, Feb 23, 2006 at 11:52:05AM +0200, Or Gerlitz wrote:
> Can you educate me here a little... basically what i was thinking about 
> dma mapping is that it maps from kernel virtual address to the bus 
> address related to the device and SG sent down to a LLD from the 
> midlayer can be supplied to dma_map_sg.
> 
> Since that was my thought i assumed using page_address(sg->page) is fine
> 
> So what you say here is that there are cases (eg highmem) where 
> dma_map_sg does not assume such mapping currently exist? nor the LLD can 
>  assume this.

dma_map_page/dma_map_sg map from page frames to bus addresses.  There
is no need for the pages to mapped into kernel virtual memory at all.
E.g. the simple non-iommu implementation of dma_map_page on i386 does
the following:

static inline dma_addr_t
dma_map_page(struct device *dev, struct page *page, unsigned long offset,
		size_t size, enum dma_data_direction direction)
{
	BUG_ON(direction == DMA_NONE);
	return page_to_phys(page) + offset;
}

it doesn't involve kernel virtual addresses at all, just a struct page
and it's physical address.  For more complex schemes the physical
address needs to be translated to a bus address, but there's not
requirement for the page to be mapped into kva.  For example direct I/O
on filesystems or block devices will send down pages not mapped into KVA
to the scsi subsystem.



More information about the general mailing list