Subject: Re: how to allocate 9MB of memory in kernel ?

From: Arnd Bergmann <[email-masked]>
Date: Tue, 22 Jul 2008 17:12:51 +0200

On Tuesday 22 July 2008, Misbah khan wrote:
> First of all let me thank you for your valuable suggessions ...
> 
> 1. I wanted to allocate 9MB in kernel and wanted that memory to be mapped to
> the physically continews SDRAM memory. but till now i could not found a way
> to do so ???
> 
> 2. So i thought to use ioremap to map SDRAM and make it accessible to user
> using mmap technique but there is only one doubt and that is will it be
> secure and stable and whether it is a right way of doing ???

As I have told you a few times now, you *either* allocate the memory *or*
ioremap it, NOT BOTH!!!

If you SDRAM is you main memory, you need vmalloc and remap_vmalloc_range.
If the SDRAM is not your main memory but some I/O attached buffer, you need
ioremap/of_iomap and remap_pfn_range.

	Arnd <><