Why not kmalloc() ??

11 messages, 7 authors, 2004-07-16 · open the first message on its own page

Why not kmalloc() ??

From: Rupesh S <hidden>
Date: 2004-07-16 09:25:34

Hi,

I just figured out that I need to use m8xx_cpm_hostalloc() to allocate memory for "buffer" that needs to be attached to the "Buffer Descriptor" of an  MPC8xx CPM peripheral (like IIC, SPI, SCC etc). Instead, if I try to use kmalloc() or a static memory allocation, my driver isn't working.

1) Can somebody throw some light on what exactly is the difference between m8xx_cpm_hostalloc() and kmalloc().
2) Why is the difference important in ppc linux ?




Thanks
--
Rupesh S


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

kernel 2.4.26 doesn't seem to work with a MPC859T

From: Pedro Aguilar <hidden>
Date: 2004-07-16 10:25:21

Hi,

I have a custom board with a MPC859T. When I do the 'gmake xconfig' in the
 processor type option, the MPC859T does not appear. I have tried the 860L
and FADS but the kernel does not boot, it doesn't print any message.

Wich processor type could be compatible with the 859T?
Are there other options that are affecting this behaviour?

I download a vanilla kernel 2.4.26 and I'm using ELDK 3.0.

Thanks in advance.

Pedro Aguilar

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

Re: Why not kmalloc() ??

From: Magnus Damm <hidden>
Date: 2004-07-16 11:34:42

On Fri, 2004-07-16 at 11:25, Rupesh S wrote:
Hi,

I just figured out that I need to use m8xx_cpm_hostalloc() to allocate memory for "buffer" that needs to be attached to the "Buffer Descriptor" of an  MPC8xx CPM peripheral (like IIC, SPI, SCC etc). Instead, if I try to use kmalloc() or a static memory allocation, my driver isn't working.

1) Can somebody throw some light on what exactly is the difference between m8xx_cpm_hostalloc() and kmalloc().
kmalloc allocates from the kernel memory pool, ie your sdram.
you usually have several megabytes of sdram.
hostalloc allocates memory from the internal dpram area in the mpc8xx
processor. a mpc8xx-processor usually has around 4-8 kilobyte dpram.
2) Why is the difference important in ppc linux ?
the dpram (dual port ram) is used to communicate with the cpm devices
such as scc:s and smc.s found inside processors from the mpc8xx family.
the powerpc core has access to one side, the cpm has access to the other
side of the dual port memory. sort of anyway.

consult your friendly mpc8xx manual for further info.

/magnus


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

Re: Why not kmalloc() ??

From: sanjeev ramachandran <hidden>
Date: 2004-07-16 12:06:59

Hi,

Bingo , But there is another function called dpalloc which does the same
job of allocating from the dual port ram. The host alloc function
allocates from the host page address that is passed when the cpm is
resetted. How are the dpalloc and hostalloc different.


San


On Fri, 2004-07-16 at 17:04, Magnus Damm wrote:
On Fri, 2004-07-16 at 11:25, Rupesh S wrote:
quoted
Hi,

I just figured out that I need to use m8xx_cpm_hostalloc() to allocate memory for "buffer" that needs to be attached to the "Buffer Descriptor" of an  MPC8xx CPM peripheral (like IIC, SPI, SCC etc). Instead, if I try to use kmalloc() or a static memory allocation, my driver isn't working.

1) Can somebody throw some light on what exactly is the difference between m8xx_cpm_hostalloc() and kmalloc().
kmalloc allocates from the kernel memory pool, ie your sdram.
you usually have several megabytes of sdram.
hostalloc allocates memory from the internal dpram area in the mpc8xx
processor. a mpc8xx-processor usually has around 4-8 kilobyte dpram.
quoted
2) Why is the difference important in ppc linux ?
the dpram (dual port ram) is used to communicate with the cpm devices
such as scc:s and smc.s found inside processors from the mpc8xx family.
the powerpc core has access to one side, the cpm has access to the other
side of the dual port memory. sort of anyway.

consult your friendly mpc8xx manual for further info.

/magnus

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

Re: Why not kmalloc() ??

From: Dan Malek <hidden>
Date: 2004-07-16 13:32:08

On Jul 16, 2004, at 8:06 AM, sanjeev ramachandran wrote:
Bingo , But there is another function called dpalloc which does the
same
job of allocating from the dual port ram.
It is the only function that allocates from dpram.  hostalloc does not.
Use the dpram only for those functions as necessary.  Use hostalloc
only for those functions necesary (small serial fifos and such).

Use dma_alloc_consistent() for large memory buffers that you need
to attach to BDs, for example Ethernet buffers.  There is very little
memory available from either dpalloc or hostalloc, and they must
be used only when necessary.


	-- Dan


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

Re: Why not kmalloc() ??

From: Mark Chambers <hidden>
Date: 2004-07-16 14:06:12

Use hostalloc
only for those functions necesary (small serial fifos and such).

Use dma_alloc_consistent() for large memory buffers that you need
to attach to BDs, for example Ethernet buffers.  There is very little
memory available from either dpalloc or hostalloc, and they must
be used only when necessary.
Is there any reason to use m8xx_cpm_hostalloc() over dma_alloc_consistent()
for a loadable driver (that is, one loaded after VM initialized)?

Mark Chambers


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

Re: Why not kmalloc() ??

From: Rune Torgersen <hidden>
Date: 2004-07-16 15:42:15

On Fri, 2004-07-16 at 09:06, Mark Chambers wrote:
Is there any reason to use m8xx_cpm_hostalloc() over dma_alloc_consistent()
for a loadable driver (that is, one loaded after VM initialized)?
Yous should even be able to use kmalloc(x, GFP_KERNEL | GFP_DMA)

This works on 82xx CPU's (and is actually used as a replacement for hostalloc
on the rewritten cpm memory allocation stuff that is yet to be released)

Might not work on 8xx though...


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

Re: Why not kmalloc() ??

From: Dan Malek <hidden>
Date: 2004-07-16 19:03:30

On Jul 16, 2004, at 11:42 AM, Rune Torgersen wrote:
Yous should even be able to use kmalloc(x, GFP_KERNEL | GFP_DMA)
No.  This will not work properly on 8xx.
This works on 82xx CPU's (and is actually used as a replacement for
hostalloc
on the rewritten cpm memory allocation stuff that is yet to be
released)
That's because 82xx is cache coherent.  The 8xx is not.


	-- Dan


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

Re: Why not kmalloc() ??

From: Dan Malek <hidden>
Date: 2004-07-16 19:02:01

On Jul 16, 2004, at 10:06 AM, Mark Chambers wrote:
Is there any reason to use m8xx_cpm_hostalloc() over
dma_alloc_consistent()
for a loadable driver (that is, one loaded after VM initialized)?
You should always use dma_alloc_conistent().  The hostalloc space
is basically a small pre-allocated non-caches space that early
initialization
functions need.

Thanks.

	-- Dan


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

Re: Why not kmalloc() ??

From: Dan Malek <hidden>
Date: 2004-07-16 13:29:36

On Jul 16, 2004, at 7:34 AM, Magnus Damm wrote:
kmalloc allocates from the kernel memory pool, ie your sdram.
you usually have several megabytes of sdram.
hostalloc allocates memory from the internal dpram area in the mpc8xx
No, it does not.  hostalloc allocates from the processor sdram, it
is not cached.

	-- Dan


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

Re: Why not kmalloc() ??

From: Dan Malek <hidden>
Date: 2004-07-16 11:46:15

On Jul 16, 2004, at 5:25 AM, Rupesh S wrote:
1) Can somebody throw some light on what exactly is the difference
between m8xx_cpm_hostalloc() and kmalloc().
1) Cache coherency, and 2) need to allocate memory to CPM before the
kernel memory allocator has been initialized.
2) Why is the difference important in ppc linux ?
It's unique to the 8xx/82xx/85xx CPM peripherals that are used early
in the kernel start up process, not to the PowerPC Linux in general.

	-- Dan


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help