mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robert Hancock <hancockrwd@gmail.com>
To: Maxim Levitsky <maximlevitsky@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Does pci_map_single magicly work on > 32 bit address for 32bit  capable device?
Date: Fri, 11 Dec 2009 18:38:09 -0600	[thread overview]
Message-ID: <51f3faa70912111638h5940612em5e6a14c166e108b1@mail.gmail.com> (raw)
In-Reply-To: <1260577137.8536.20.camel@maxim-laptop>

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.

  reply	other threads:[~2009-12-12  0:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-11 21:39 Maxim Levitsky
2009-12-12  0:07 ` Robert Hancock
2009-12-12  0:18   ` Maxim Levitsky
2009-12-12  0:38     ` Robert Hancock [this message]
2009-12-21 19:48       ` Maxim Levitsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51f3faa70912111638h5940612em5e6a14c166e108b1@mail.gmail.com \
    --to=hancockrwd@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maximlevitsky@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®