lkml.org 
[lkml]   [2009]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: Does pci_map_single magicly work on > 32 bit address for 32bit capable device?
From
On Fri, Dec 11, 2009 at 6:18 PM, Maxim Levitsky <maximlevitsky@gmail.com> wrote:
>> The kernel should set up an IOMMU (either hardware or software) mapping
>> for that memory so that the device can access it through an address
>> below 4GB. This is assuming it's a 64-bit kernel (on 32-bit, a kernel
>> memory address will always be below 4GB).
>
> What do you mean by software IOMMU?
>
> On my system there is no IOMMU present, so only way to ensure 32 bit
> address is to copy pages.
> pci_map_single could copy the data for write case, and pci_unmap_single
> for read case, but I now strongly doubt they do.

It does. See the swiotlb code. You should see some message on bootup like:

PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
Placing 64MB software IO TLB between ffff880020000000 - ffff880024000000
software IO TLB at phys 0x20000000 - 0x24000000

> I am not sure at all that these functions will fail if too high address
> is specified....
>
> Also, very recently, I found that in
> Documentation/DMA-API.txt, there is a statement that says that
> pci_map_single fails for >32 bit memory address.

Where do you see this?

>
> I guess I just do a memcpy...

This isn't optimal because if there is a hardware IOMMU, the copy can
be avoided.


\
 
 \ /
  Last update: 2009-12-12 01:41    [W:0.126 / U:0.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site