Re: Does kmalloc always return address below 4GB?

From: David S. Miller (davem@redhat.com)
Date: Wed Mar 06 2002 - 02:22:44 EST


   From: Gerd Knorr <kraxel@bytesex.org>
   Date: 5 Mar 2002 17:00:55 GMT
   
> computer with >4GB of RAM (CONFIG_HIGHEM) talking to a PCI card
> that only does 32-bit addressing:
>
> pci_set_dma_mask(pcidev, 0xffffffff);
> addr = vmalloc(nbytes);
> /* On an x86 with >4GB of RAM, addr will be <4GB, but
> __pa(addr) might be >4GB, and the system lacks
> PCI address mapping harware. */
   
   use vmalloc_32(), this one returns lowmem.

You can't use vmalloc() pointers as arguments to pci_map_single.
That is the point of what he's mentioning.
   
> dma_addr = pci_map_single(pcidev, addr, nbytes, direction);
   
   This is illegal because addr is a kernel _virtual_ address. You have to
   get the page using vmalloc_to_page() and feed this to pci_map_page()
   then.

There is no such requirement that pci_map_page() only be used.
If you know you haven't got a HIGHMEM page, it is legal to
pass this to pci_map_single().
-
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 : Thu Mar 07 2002 - 21:00:53 EST