[ARM_LINUX] ioremap() allowing to map system memory...

buyitian buyit at live.cn
Mon Mar 4 03:02:58 EST 2013


________________________________
> From: coolsandyforyou at gmail.com 
> Date: Sat, 2 Mar 2013 22:48:34 +0530 
> Subject: Re: [ARM_LINUX] ioremap() allowing to map system memory... 
> To: gprabhunath at gmail.com 
> CC: kernelnewbies at kernelnewbies.org 
> 
> >I passed a physical address 0x63ACD000. As expected it returned 
> 0x00000000. I am running linux version 3.5.1. 
> Mine is ARM, i donno about x86. In my case ioremap is successfule and 
> giving an address in ioremap() range of virtual memory map as 
> in http://www.arm.linux.org.uk/developer/memory.txt. 

please give your detail calling example, it is weired that you did not get
0x0 returned.

maybe your platform overwirte the arch_ioremap_caller? please double check this.
the default implementation for arch_ioremap_caller is as below:
void __iomem * (*arch_ioremap_caller)(unsigned long, size_t,
          unsigned int, void *) = __arm_ioremap_caller;

in \arch\arm\mm\ioremap.c, in function __arm_ioremap_pfn_caller:
 
/*
 * Don't allow RAM to be mapped - this causes problems with ARMv6+
 */
 if (WARN_ON(pfn_valid(pfn)))
   return NULL;

you should get NULL if you are asking convert a valid memory.

> 
> 
> On Sat, Mar 2, 2013 at 4:52 PM, Prabhu nath 
> <gprabhunath at gmail.com<mailto:gprabhunath at gmail.com>> wrote: 
> In principle, ioremap() will return 0x00000000 if the physical address 
> passed is of memory. 
> I just want you to double check the address you have passed to ioremap(). 
> In my experiment on x86 Desktop machine with 2GB RAM. I passed a 
> physical address 0x63ACD000. As expected it returned 0x00000000. I am 
> running linux version 3.5.1. 
> 
> 
> Regards, 
> Prabhunath G 
> Linux Trainer 
> Bangalore 
> 
> 
> On Fri, Mar 1, 2013 at 5:57 PM, sandeep kumar 
> <coolsandyforyou at gmail.com<mailto:coolsandyforyou at gmail.com>> wrote: 
> >Looks like you are trying to pass the address of physical memory to 
> this function as a parameter and it is screwing up. 
> Yes, i intentionally gave some physical address which is part of system 
> memory. 
> My problem infact is, it is not screwing up. It is allowing me to do 
> that. Its not 'panic'ing 
> 
> 
> On Fri, Mar 1, 2013 at 4:58 PM, Prabhu nath 
> <gprabhunath at gmail.com<mailto:gprabhunath at gmail.com>> wrote: 
> 
> 
> On Fri, Mar 1, 2013 at 4:48 PM, sandeep kumar 
> <coolsandyforyou at gmail.com<mailto:coolsandyforyou at gmail.com>> wrote: 
> Hi All 
> I am using ARM based board. 
> In mine, 
> i did the following... 
> 
> void __iomem *tcpm_base = ioremap_nocache(0x03B00000, 10*SZ_3MB); 
> 
> Actually i didnt reserve the 30MB memory @ 0x3B00000. But still the 
> call is succesful and i am able to read the memory. 
> 
> In the logs it is just showing a warning, to fix my driver as i am 
> calling ioremap() on system memory. 
> 
> However if i try to write something on that memory, then only it is 
> calling panic().. 
> 
> Don't you think it should throw panic()while calling the ioremap() 
> itself. Because this sounds like a serious violation... 
> 
> What say? 
> 
> To my knowledge, ioremap is used only to map the device related 
> physical address to kernel virtual address. i.e. this function will 
> only map either device registers or device memory to kernel virtual 
> address. 
> 
> Looks like you are trying to pass the address of physical memory to 
> this function as a parameter and it is screwing up. 
> 
> Please verify. 
> 
> Regards, 
> Prabhu 
> 
> -- 
> With regards, 
> Sandeep Kumar Anantapalli, 
> 
> _______________________________________________ 
> Kernelnewbies mailing list 
> Kernelnewbies at kernelnewbies.org<mailto:Kernelnewbies at kernelnewbies.org> 
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies 
> 
> 
> 
> 
> 
> -- 
> With regards, 
> Sandeep Kumar Anantapalli, 
> 
> 
> 
> 
> -- 
> With regards, 
> Sandeep Kumar Anantapalli, 
> 
> _______________________________________________ Kernelnewbies mailing 
> list Kernelnewbies at kernelnewbies.org 
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies 		 	   		  


More information about the Kernelnewbies mailing list