mmap() and pci_alloc_consistent()

From: Leif Delgass (ldelgass@retinalburn.net)
Date: Wed Apr 30 2003 - 16:03:45 EST


Is there a correct and portable way to implement mmap() for memory
allocated with pci_alloc_consistent()? In the DRM drivers, PCI DMA memory
(for graphics chips that don't support a pcigart scatter-gather table) is
currently allocated with __get_free_pages(), so virt_to_bus() is used to
get the bus address to pass to the card for DMA. I would like to convert
the drivers to use pci_alloc_consistent() instead. These DMA buffers
(usually about 1-2MB worth) are allocated and held for the life of the X
server.

The current mmap() implementation for these buffers uses virt_to_page() on
the address from __get_free_pages() to reserve the pages and to find pages
in nopage(). However, I have seen references indicating that
virt_to_page() is not a valid operation on the cpu address returned from
pci_alloc_consistent(). Is this the case, and if so, is there a
workaround or alternative?

Please CC: me on any replies since I'm not subscribed.

Thanks.

-- 
Leif Delgass 
http://www.retinalburn.net

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Apr 30 2003 - 22:00:36 EST