From: Michel Lanners <mlan@mcp.cpu.lu>
To: lizzi@csti.fr
Cc: linuxppc-dev@lists.linuxppc.org
Subject: Re: PREP memory layout and PCI transactions
Date: Fri, 28 Jan 2000 16:52:20 MET [thread overview]
Message-ID: <200001281552.QAA02394@mcp.cpu.lu> (raw)
In-Reply-To: <200001280947.KAA09960@devl58>; from "Christophe Lizzi" at Jan 28, 100 10:47 am
Hello there,
> The driver requests the device to fill some memory locations in kernel
> space via DMA. This works just fine when such memory locations come
> from pages allocated by get_free_page() or kmalloc().
>
> However, this fails when these locations come from the *static* data
> of the module, or from pages allocated by vmalloc().
This is expected behaviour, since the way the MM code allocates memory is
different between kmalloc()'ed and vmalloc()'ed memory.
kmalloc() returns a memory object consiting of a number of consecutive pages
of RAM, adressed through the existing memory translation from (all RAM) to
(kernel virtual memory). The full physical RAM is mapped starting at 0xc0000000,
and kmalloc will return an address within that range.
However, vmalloc() returns a memory object consisting of pages that are only
consecutive in kernel virtual address space, but which is composed of individual
pages retreived through get_free_pages(). Therefore, these pages are not
necessarily consecutive in physical RAM, and the full object is mapped by
a new translation to virtual addresses _above_ physical RAM. As a result,
the simple offset calculation between kernel virtual address and physical
address doesn't work here.
> Specifically, the pages returned by get_free_page() or kmalloc() are located
> around kernel virtual addresses C1xxxxxx (bus addresses 81xxxxxx), while the
> static data in question and the pages returned by vmalloc() are located
> behind virtual addresses C4xxxxxx (bus addresses 84xxxxxx).
But bus address 0x84xxxxxx doesn't correspond to any existing RAM.
For DMA, you need to use kmalloc(), or assemble your buffer the dirty way
through successive calls to get_free_pages() and other wizardry.
Michel
____________________________________________________________________
.sig home alone
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
prev parent reply other threads:[~2000-01-28 15:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-01-28 9:47 PREP memory layout and PCI transactions Christophe Lizzi
2000-01-28 10:35 ` Gabriel Paubert
2000-01-28 15:52 ` Michel Lanners [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=200001281552.QAA02394@mcp.cpu.lu \
--to=mlan@mcp.cpu.lu \
--cc=linuxppc-dev@lists.linuxppc.org \
--cc=lizzi@csti.fr \
--cc=mlan@cpu.lu \
/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).