From: Dan Malek <dan@mvista.com>
To: Dan Winkler <dwinkler@virtual-ink.com>
Cc: "'linuxppc-embedded@lists.linuxppc.org '"
<linuxppc-embedded@lists.linuxppc.org>
Subject: Re: driver memory management
Date: Sat, 06 Jan 2001 15:55:13 -0500 [thread overview]
Message-ID: <3A578631.5335A560@mvista.com> (raw)
In-Reply-To: 64AFC0D37B2ED411BAB300508B6D90A019AB09@mail.virtual-ink.com
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/
prev parent reply other threads:[~2001-01-06 20:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-01-06 16:24 driver memory management Dan Winkler
2001-01-06 20:55 ` Dan Malek [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3A578631.5335A560@mvista.com \
--to=dan@mvista.com \
--cc=dwinkler@virtual-ink.com \
--cc=linuxppc-embedded@lists.linuxppc.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).