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.
My SDRAM is the main memory of which 9MB i have to allocate in the driver. If i allocate 9BM using vmalloc and remap to user space how should it address to the 9MB SDRAM contigues address which i need to map for user access ? Arnd Bergmann wrote: > > 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 <>< > _______________________________________________ > Linuxppc-embedded mailing list > Linuxppc-embedded@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---tp18503022p18605418.html Sent from the linuxppc-embedded mailing list archive at Nabble.com. _______________________________________________ Linuxppc-embedded mailing list Linuxppc-embedded@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-embedded