Re: Allocate consistent memory in the 32-bit address range, with DMA_64BIT_MASK?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Leon Woestenberg wrote:
> Hello Rolf Eike,
> 
> On Fri, May 14, 2010 at 10:34 AM, Rolf Eike Beer <eike-kernel@xxxxxxxxx> 
wrote:
> > Leon Woestenberg wrote:
> >> Hello,
> >> 
> >> my PCIe device supports 64-bit DMA for data, but only 32-bit addresses
> >> for fetching descriptors from host memory.
> >> 
> >> How can I allocate consistent memory in the 32-bit address range, even
> >> though I earlier performed pci_set_dma_mask(..., DMA_64BIT_MASK)?
> > 
> > Create a pci_pool (see pci_pool_*() in include/linux/pci.h) for the
> > descriptors. Create the pool with a restriction to 32 bit.
> 
> Thanks. Creating a pool with a restriction seems impossible:
> 
> struct pci_pool *pci_pool_create(const char *name, struct pci_device *dev,
> size_t size, size_t align, size_t alloc);
> 
> However, subsequent allocation does allow restrictions:
> 
> void *pci_pool_alloc(struct pci_pool *pool, gfp_t gfp_flags,
> dma_addr_t *dma_handle);
> 
> I had missed that in reading DMA-API.txt
> 
> 
> What is the actual restriction flag for limiting to 32-bit?
> 
> I can image this is hard to achieve, say, in a 36-bit physical system
> (Intel PAE, PowerPC e500, ...)

Ah, I confused that, sorry. The trick is like this:

pci_set_dma_mask(pdev, DMA_BIT_MASK(32))
pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))

Eike

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux