Re: virt_to_page/pci_map_page vs. pci_map_single

From: Jamie Wellnitz
Date: Mon Nov 03 2003 - 07:54:27 EST


On Mon, Nov 03, 2003 at 03:10:46AM -0500, Jes Sorensen wrote:
> >>>>> "Jamie" == Jamie Wellnitz <Jamie.Wellnitz@xxxxxxxxxx> writes:
>
> Jamie> page = virt_to_page(buffer); offset = ((unsigned long)buffer &
> Jamie> ~PAGE_MASK); busaddr = pci_map_page(pci_dev, page, offset, len,
> Jamie> direction);
>
> Jamie> How is this preferable to:
>
> Jamie> pci_map_single( pci_dev, buffer, len, direction);
>
> Jamie> pci_map_single can't handle highmem pages (because they don't
> Jamie> have a kernel virtual address) but doesn't virt_to_page suffer
> Jamie> from the same limitation? Is there some benefit on
> Jamie> architectures that don't have highmem?
>
> virt_to_page() can handle any page in the standard kernel region

What is the "standard kernel region"? ZONE_NORMAL?

> including pages that are physically in 64-bit space if the
> architecture requires it. It doesn't handle vmalloc pages etc. but
> one shouldn't try and dynamically map vmalloc pages at
> random. pci_map_page() can handle all memory in the system though as
> every page that can be mapped has a struct page * entry.
>
> pci_map_page() is the correct API to use, pci_map_single() is
> deprecated.

Are you talking about 2.4 or 2.6 or both?

The Document/DMA-mapping.txt in 2.6.0-test9 says "To map a single
region, you do:" and then shows pci_map_single. Is DMA-mapping.txt in
need of patching?

>
> Cheers,
> Jes

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