From: Arnd Bergmann <arnd@arndb.de>
To: linuxppc-embedded@ozlabs.org
Cc: Misbah khan <misbah_khan@engineer.com>
Subject: Re: how to allocate 9MB of memory in kernel ?
Date: Tue, 22 Jul 2008 11:31:32 +0200 [thread overview]
Message-ID: <200807221131.32556.arnd@arndb.de> (raw)
In-Reply-To: <18582612.post@talk.nabble.com>
On Tuesday 22 July 2008, Misbah khan wrote:
> I am getting kernel panic while trying these as suggested by you ,the
> following points will elaborate my concern :-
Please post the entire driver, when you only post fragments that
don't compile, we can't really help you.
> i am allocating memory using vmalloc and remaping to the SDRAM area as :-
>=20
> buf_area =3D vmalloc(sizeof(circularbuffer_S));
> =A0=A0=A0=A0=A0=A0=A0=A0if(!buf_area)
> =A0=A0=A0=A0=A0=A0=A0=A0{
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0printk(KERN_ALERT"vmalloc=
failed \n");
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0return -1;
> =A0=A0=A0=A0=A0=A0=A0=A0}
>=20
> =A0=A0=A0=A0=A0=A0=A0=A0buf_area =3D (circularbuffer_S *)ioremap(7700000,=
900000);
> =A0=A0=A0=A0=A0=A0=A0=A0if(!buf_area)
> =A0=A0=A0=A0=A0=A0=A0=A0{
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0printk(KERN_ALERT"ioremap=
failed \n");
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0return -1;
> =A0=A0=A0=A0=A0=A0=A0=A0}
You really need to decide whether you want to allocate memory or
want to remap an I/O range. ioremap is *only* for I/O ranges
on SoC or similar devices, and when you have that, you don't allocate
memory. Besides, the addresses you pass are really strange,
e.g. 900,000 bytes are not 9MB. Normally, you would get the
I/O address from the device tree, using of_iomap(), and then
use of_translate_address/remap_pfn_range to map it to user
space.
Arnd <><
next prev parent reply other threads:[~2008-07-22 9:31 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-17 7:26 how to allocate 9MB of memory in kernel ? Misbah khan
2008-07-17 7:51 ` Marco Stornelli
2008-07-17 8:34 ` Misbah khan
2008-07-17 9:04 ` Marco Stornelli
2008-07-17 7:56 ` Arnd Bergmann
2008-07-17 8:19 ` Misbah khan
2008-07-17 8:24 ` Arnd Bergmann
2008-07-18 4:44 ` Misbah khan
2008-07-18 6:50 ` Marco Stornelli
2008-07-18 8:48 ` Misbah khan
2008-07-18 14:57 ` Timur Tabi
2008-07-18 15:39 ` Arnd Bergmann
2008-07-22 5:23 ` Misbah khan
2008-07-22 6:43 ` Marco Stornelli
2008-07-22 9:31 ` Arnd Bergmann [this message]
2008-07-22 9:47 ` Marco Stornelli
2008-07-22 13:22 ` Misbah khan
2008-07-22 15:12 ` Arnd Bergmann
2008-07-23 7:30 ` Misbah khan
2008-07-23 12:47 ` Alessandro Rubini
2008-07-24 8:33 ` Misbah khan
2008-07-24 9:31 ` Arnd Bergmann
2008-07-25 8:43 ` Misbah khan
2008-07-25 8:50 ` Arnd Bergmann
2008-08-02 19:13 ` harihanv
2008-07-17 8:02 ` Sylvain Joyeau
2008-07-17 8:41 ` Misbah khan
[not found] <mailman.2280.1216290829.2883.linuxppc-embedded@ozlabs.org>
2008-07-17 20:15 ` Siva Prasad
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=200807221131.32556.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=linuxppc-embedded@ozlabs.org \
--cc=misbah_khan@engineer.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.