Linux 2.6.x: arch powerpc: PCI DMA allocation misunderstandings
Laurent Lagrange
lagrange at fr.oleane.com
Sat May 29 00:44:54 EST 2010
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
More information about the Linuxppc-dev
mailing list