* driver memory management
@ 2001-01-06 16:24 Dan Winkler
2001-01-06 20:55 ` Dan Malek
0 siblings, 1 reply; 2+ messages in thread
From: Dan Winkler @ 2001-01-06 16:24 UTC (permalink / raw)
To: 'linuxppc-embedded@lists.linuxppc.org '
I am having some difficulties allocating memory larger than the memory
available in cpm_host_alloc, cpm_host_alloc seems to use part of a
predesignated 4K buffer of memory. I need more memory than this, and am
trying to use the calls
pBuff = kmalloc(TRANSMIT_SIZE, GFP_KERNEL|GFP_DMA);
the only problem with this is when I go to copy data to this location it
fails i.e.
memcpy(__va(pBuff), pSrc, size)
Any Suggestions as to what might be going on. From my undertaning this
should return a contiguous block of memory.
-Dan Winkler
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: driver memory management
2001-01-06 16:24 driver memory management Dan Winkler
@ 2001-01-06 20:55 ` Dan Malek
0 siblings, 0 replies; 2+ messages in thread
From: Dan Malek @ 2001-01-06 20:55 UTC (permalink / raw)
To: Dan Winkler; +Cc: 'linuxppc-embedded@lists.linuxppc.org '
Dan Winkler wrote:
>
> I am having some difficulties allocating memory larger than the memory
> available in cpm_host_alloc, cpm_host_alloc seems to use part of a
> predesignated 4K buffer of memory.
I don't quite understand this collection of words, but I will try
to explain some of this. The cpm_host_alloc() is intended to be
used only by those devices that require small amounts of memory,
significantly less a page size or so. Like the UART FIFOs and
things like that. If you notice other drivers (Ethernet for example)
it allocates its own memory and associates it with the BDs.
> pBuff = kmalloc(TRANSMIT_SIZE, GFP_KERNEL|GFP_DMA);
>
> the only problem with this is when I go to copy data to this location it
> fails i.e.
Yeah, you probably get a big time kernel crash due to a bus fault.
> memcpy(__va(pBuff), pSrc, size)
>
> Any Suggestions as to what might be going on.
Yeah, pBuff is a kernel virtual address from kmalloc. You don't
use the __va() operation on this type of address. I don't know why
you need to copy this, but you should simply use:
memcpy(pBuff, pSrc, size)
and then put __pa(pBuff) in the BD. Of course, the "right" thing
to do is simply track down the physical pages to pSrc and stuff those
into the BDs without allocating or copying any memory (or preallocate
the buffer using kmalloc and tell the data provider to use that).
-- Dan
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-01-06 20:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-01-06 16:24 driver memory management Dan Winkler
2001-01-06 20:55 ` Dan Malek
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).