how to allocate 9MB of memory in kernel ?

Misbah khan misbah_khan at engineer.com
Tue Jul 22 23:22:45 EST 2008


Hi All ...

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 ???

3. Now i have allocated 3MB of memory in kernel for simulation purpose in
dma region and writing to 1 MB at a time in the driver and reading it in the
application this works good in the Linux PC where as in the board i could
just read '/0' char always .

4. When i do ioremap to a cpld memory mapped reg (as i am using simul board
which does not have the actual SDRAM mapping ) i could read write to it but
in the application i can read a value of '/0' always 

5. Can i actually do ioremap to 9 MB SDRAM memory and map it to the user
using function remap_pfn_range() ???


I am sorry Stornelli 
--- Since there is a time criticality hence i am not able to look the driver
books and documentation as of now and trying my little knowledge and your
suggessions .... 

------ Misbah <><

Marco Stornelli wrote:
> 
>> 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 :-
>>> i am allocating memory using vmalloc and remaping to the SDRAM area as
>>> :-
>>>
>>> buf_area = vmalloc(sizeof(circularbuffer_S));
>>>         if(!buf_area)
>>>         {
>>>                 printk(KERN_ALERT"vmalloc failed \n");
>>>                 return -1;
>>>         }
>>>
>>>         buf_area = (circularbuffer_S *)ioremap(7700000,900000);
>>>         if(!buf_area)
>>>         {
>>>                 printk(KERN_ALERT"ioremap failed \n");
>>>                 return -1;
>>>         }
> 
> Misbah I suggest you, before to write in a Linux mailing list, to read 
> Understanding the Linux kernel, Linux device drivers, Understanding the 
> Linux virtual memory manager and so on, to study them very well, to 
> think well about your problem and then ask for help in a mailing list.
> 
> Regards,
> 
> -- 
> Marco Stornelli
> Embedded Software Engineer
> CoRiTeL - Consorzio di Ricerca sulle Telecomunicazioni
> http://www.coritel.it
> 
> marco.stornelli at coritel.it
> +39 06 72582838
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded at ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
> 
> 

-- 
View this message in context: http://www.nabble.com/how-to-allocate-9MB-of-memory-in-kernel---tp18503022p18587466.html
Sent from the linuxppc-embedded mailing list archive at Nabble.com.



More information about the Linuxppc-embedded mailing list