linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Laurent Lagrange" <lagrange@fr.oleane.com>
To: <linuxppc-dev@ozlabs.org>
Subject: Linux 2.6.x:  arch powerpc: PCI DMA allocation misunderstandings
Date: Fri, 28 May 2010 16:44:54 +0200	[thread overview]
Message-ID: <001401cafe74$5a8864b0$a501a8c0@GEGE6600V> (raw)
In-Reply-To: <000901caab49$98517d00$a501a8c0@GEGE6600V>


Hello,

I use a 82xx or 85xx host platform with a Linux 2.6.24 or 2.2.31.

On this host, I want to write a PCI driver for a target PMC device
wich only supports 30bits (1GB) DMA addressing.
The PMC device is the master of the DMA transfers from/to the host memory.

In the host driver, I begin to set the two DMA masks with 
 - pci_set_dma_mask(pdev, DMA_BIT_MASK(30)) and
 - pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(30))

Then I allocate DMA buffers in the host memory with
 - pci_alloc_consistent or
 - pci_pool_create and pci_pool_alloc

My problem is that the alloc functions return physical addresses
which are coherent with 32bits but not with the wanted 30bits.

The allocations seem to work like a kmalloc with a GFP_DMA flag.
On powerpc architecture, GFP_DMA preserves the allocations on 32bits
unlike on x86 architecture which restrict the allocations on 24bits.

I don't understand why it is recommended to use the PCI DMA API
with the DMA masks if the final allocator is only able to 
use a GFP_DMA-like restriction and not a real provided mask.

Surely I missed something...
Any idea would be welcome.

Thanks
Laurent

      reply	other threads:[~2010-05-29  4:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-11 18:39 TR: Linux 2.6.x 82xx probe devices with multiple serial drivers Laurent Lagrange
2010-05-28 14:44 ` Laurent Lagrange [this message]

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='001401cafe74$5a8864b0$a501a8c0@GEGE6600V' \
    --to=lagrange@fr.oleane.com \
    --cc=linuxppc-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).