[RFC] sh: Take into account the base of physical memory in virt_to_phys()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, all.

I forgot to have sent the following patches to solve the same problem.
  http://www.spinics.net/lists/linux-sh/msg05954.html

I was going to add the mode which worked to proc/cpuinfo.
Because the user did not know whether a kernel was 29bit or 32bit from
the user space.

Paul, do you think so?

Best regards,
  Nobuhiro

2011/9/17 Simon Horman <horms at verge.net.au>:
> On Fri, Sep 16, 2011 at 07:59:21PM +0900, Magnus Damm wrote:
>> On Thu, Sep 15, 2011 at 8:12 PM, Simon Horman <horms at verge.net.au> wrote:
>> > Previously virt_to_phys() assumed that physical memory always started
>> > at address 0. This is not always the case.
>>
>> I think most boards have NOR Flash or ROM mapped at physical address 0.
>>
>> For more information please have a look at: arch/sh/boards/mach-ecovec24/setup.c
>>
>> > --- a/kexec/arch/sh/kexec-sh.c
>> > +++ b/kexec/arch/sh/kexec-sh.c
>> > @@ -188,10 +188,18 @@ void kexec_sh_setup_zero_page(char *zero_page_buf, size_t zero_page_size,
>> > ?unsigned long virt_to_phys(unsigned long addr)
>> > ?{
>> > ? ? ? ?unsigned long seg = addr & 0xe0000000;
>> > + ? ? ? unsigned long long start, end;
>> > + ? ? ? int ret;
>> > +
>> > + ? ? ? /* Assume there is only one "System RAM" region */
>> > + ? ? ? ret = parse_iomem_single("System RAM\n", &start, &end);
>> > + ? ? ? if (ret)
>> > + ? ? ? ? ? ? ? die("Could not parse System RAM region in /proc/iomem\n");
>> > +
>> > ? ? ? ?if (seg != 0x80000000 && seg != 0xc0000000)
>> > ? ? ? ? ? ? ? ?die("Virtual address %p is not in P1 or P2\n", (void *)addr);
>> >
>> > - ? ? ? return addr - seg;
>> > + ? ? ? return addr - seg + start;
>> > ?}
>>
>> This will most likely also change how 29-bit platforms translate their
>> addresses, not sure if that's what you want to do.
>
> I am also unsure about the 29bit case. Do you have any thoughts on
> what a good approach might look like?
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>



-- 
Nobuhiro Iwamatsu
?? iwamatsu at {nigauri.org / debian.org}
?? GPG ID: 40AD1FA6



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux