On Mon, Jul 09, 2007 at 09:31:16AM +0100, Keir Fraser wrote:
> Nope. To get contiguous pages on Xen you need to use pci_alloc_consistent,
> or pci_map_single, or similar. Most drivers are okay with this, because you
> are not supposed to program DMA without having got a dma_addr_t from Linux's
> DMA API, and we hook into the DMA API to serve up contiguous regions (via
> the swiotlb [ie. bounce buffers], if necessary).
According to IB developers, it uses alloc_pages and then pci_map_sg which they
state that is DMA API. So, is it correct approach?
I did debug like this - so it prints physical and virtual addresses and they
seems to be perfectly contiguous. Are the physical addresses real physical
addresses or virtualized by Xen hypervisor?
static int mthca_alloc_icm_pages(struct mthca_dev *pdev, struct device *dev,
struct scatterlist *mem, int order, gfp_t gfp_mask)
{
int o;
void *page;
mem->page = alloc_pages(gfp_mask, order);
if (!mem->page)
return -ENOMEM;
mthca_err(pdev, "Alloc pages starts\n");
page = page_address(mem->page);
o = PAGE_SIZE << order;
while(o > 0) {
mthca_err(pdev, "Page phys. addr %p, virt %p\n",
virt_to_phys(page), page);
o -= PAGE_SIZE;
page += PAGE_SIZE;
}
mem->length = PAGE_SIZE << order;
mem->offset = 0;
return 0;
}
--
Lukáš Hejtmánek
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|