From: Evan Lavelle <sa212+lkml@cyconix.com>
To: LKML <linux-kernel@vger.kernel.org>
Subject: Re: Driver: PCIe: 'pci_map_sg' returning invalid bus address?
Date: Wed, 04 Aug 2010 10:26:29 +0100 [thread overview]
Message-ID: <4C593245.5070303@cyconix.com> (raw)
In-Reply-To: <4C5002AD.6070206@cyconix.com>
Made some progress here. The problem is that this is 32-bit PAE kernel,
so 'dma_addr_t' is 64-bit. However, I have a 32-bit PCIe card, so I need
a 32-bit dma_addr_t. How do I do this? In other words, how do I handle
32-bit PCI cards on PAE or 64-bit systems? My code sets the DMA mask to
32 bits but this is *not* sufficient:
pci_set_dma_mask(my_dev, DMA_32BIT_MASK)
Is this a bug, or do I have to do something else? LDD doesn't seem to
have anything to say about this. I had previously assumed that an IOMMU
would translate the (32-bit) dma_addr_t to a 36- or 64-bit value, but I
don't think there's an IOMMU in this system. Do x86 systems have IOMMUs?
This is a server motherboard, so I don't think it even has AGP. However,
even if I had an IOMMU, I would still need a way generate a 32-bit
dma_addr_t to start with.
Second problem: can I use the scatter-gather code ('pci_map_sg') on PAE
or 64-bit systems? I've found one post that says this isn't possible,
and that the DAC routines have to be used instead (second post in
http://www.alteraforum.com/forum/showthread.php?t=4171). These comments
seem to be incorrect, but I'd appreciate some confirmation of this.
The specific question in my first post was why the coherent mapping
worked, and the streaming mapping didn't. The answer was that, for this
system, the dma_addr_t for a coherent buffer in kernel space is in the
low 4GB, but the dma_addr_t for the streaming buffer in user space has
bit 32 set. I hadn't realised that dma_addr_t was 64-bit, and I was just
writing the low 32 bits to the DMA registers on the PCI card. The DMA op
to the coherent buffer worked, but the DMA op to the streaming buffer
didn't, since the PCIe card can't drive bit 32.
Thanks -
Evan
next prev parent reply other threads:[~2010-08-04 9:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-28 10:13 Driver: PCIe: 'pci_map_sg' returning invalid bus address? Evan Lavelle
2010-08-04 9:26 ` Evan Lavelle [this message]
2010-08-04 10:08 ` FUJITA Tomonori
2010-08-04 11:22 ` Evan Lavelle
2010-08-04 12:03 ` FUJITA Tomonori
2010-08-04 14:51 ` Konrad Rzeszutek Wilk
2010-08-13 1:35 ` Yuhong Bao
2010-08-14 15:25 ` Evan Lavelle
2010-08-16 3:31 ` Robert Hancock
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=4C593245.5070303@cyconix.com \
--to=sa212+lkml@cyconix.com \
--cc=linux-kernel@vger.kernel.org \
/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