Skip to contentSkip to conversation

Problem allocating large meory using m8260_cpm_hostalloc

DISCUSSION Prashant Alange 2 participants 4 messages Jul 28, 2005

lore
Share & tools
lore
#0 lore raw

Hi everyone,
I am having problem in allocating large memory using=20 m8260_cpm_hostalloc function in my driver. (Approx 256 Kbytes). I tried increaing the NUM_CPM_HOST_PAGES macro in cpm_8260.h file to 64 but still it fails for 200K of memory request. This macro is used by alloc_bootmem_pages() function. I have read that we should use this function if we intend to have consecutive memory pages allocated.

Could anyone tell what I am missing here?
How can I allocate large memory in my driver using this hostalloc function?

Thanks for your time.

Prashant

#1 lore raw
Quoted 1 line · Prashant Alange

Could anyone tell what I am missing here?

You are not supposed to be using this function for such memory allocations.

Quoted 1 line

How can I allocate large memory in my driver using this hostalloc function?

You don't. If you look at the existing drivers and comments, you'll see it's intended to only allocate small objects that are too inefficient to manage with the usual Linux DMA allocation functions. You must use the standard Linux DMA for large allocations. Read Documentation/DMA-API.txt, and in particular the non-PCI functions.

Thanks.

	-- Dan
#2 lore raw

Could you pls tell me what function I should be using for larger memories. I do not know much about the memory management in linux. It would be heleful if you can throw some light on this in terms of functions I should use. I could not find the file DMA-API.txt file but I did get DMA-mapping.txt. Is this the file you were referring to?

Thanks,
Prashant

Quoted 26 lines · Dan Malek

=20
On Jul 28, 2005, at 12:50 PM, Prashant Alange wrote:
=20

Quoted 1 line

Could anyone tell what I am missing here?

=20
You are not supposed to be using this function for such memory allocations.
=20

Quoted 2 lines

How can I allocate large memory in my driver using this hostalloc function?

=20
You don't. If you look at the existing drivers and comments, you'll see it's
intended to only allocate small objects that are too inefficient to manage
with the usual Linux DMA allocation functions. You must use the standard
Linux DMA for large allocations. Read Documentation/DMA-API.txt, and in particular the non-PCI functions.
=20
Thanks.
=20
=20

       -- Dan

=20

#3 lore raw
Quoted 1 line · Prashant Alange

Could you pls tell me what function I should be using ....

Just look at some of the existing 82xx/CPM2 drivers, like the SCC/FEC/FCC Ethernet.

Quoted 2 lines

..... I could not find the file DMA-API.txt file but
I did get DMA-mapping.txt. Is this the file you were referring to?

Ugh ... a newer kernel would help. The DMA-mapping.txt doesn't apply to the local CPM devices, so just look at some existing drivers.

Thanks.

	-- Dan