[U-Boot] [PATCH 00/27] Clean up address mapping functions & CONFIG_SYS_SDRAM_BASE

Paul Burton paul.burton at imgtec.com
Mon Oct 3 12:41:59 CEST 2016


On Sunday, 2 October 2016 22:46:45 BST Masahiro Yamada wrote:
> Hi Paul,
> 
> 2016-10-01 23:19 GMT+09:00 Paul Burton <paul.burton at imgtec.com>:
> > README states that CONFIG_SYS_SDRAM_BASE should be the physical address
> > of the base of SDRAM memory. This is expected by some code such as the
> > PCI layer, which uses CONFIG_SYS_SDRAM_BASE to set up a region for
> > system memory. Other code such as the image loading code used by bootm
> > or the generic board_f.c expect CONFIG_SYS_SDRAM_BASE to be directly
> > accessible by the CPU, which necessitates that it be a virtual address.
> > 
> > Where virtual & physical addresses aren't identity mapped, as is the
> > case for MIPS, we cannot possibly satisfy both. Until now MIPS has used
> > a virtual CONFIG_SYS_SDRAM_BASE. This series fixes up the mess by doing
> > 
> > a few things:
> >   - Ensuring that we provide virt_to_phys() on all architectures.
> >   
> >   - Fixing code that expects to use CONFIG_SYS_SDRAM_BASE as a virtual
> >   
> >     address to instead convert it to a physical address using
> >     virt_to_phys().
> >   
> >   - Converts MIPS code & all MIPS boards to provide a physical
> >   
> >     CONFIG_SYS_SDRAM_BASE, which typically is zero.
> 
> Thanks for working on this.
> 
> As you may notice, include/linux/io.h defines
> the generic implementation of ioremap().
> 
> (It is guarded by #ifndef CONFIG_HAVE_ARCH_IOREMAP
> so that MIPS can work-around it.)

Hi Masahiro,

I hadn't actually noticed the generic ioremap - I suspect few do since you don't get it by 
including asm/io.h as you would in Linux. It'll also be wrong for other architectures that 
don't do a simple 1:1 physical:virtual translation but don't select 
CONFIG_HAVE_ARCH_IOREMAP (nios2, sandbox).

> If you go with asm-generic/io.h,
> perhaps should we be consistent, that is,
> move the generic ioremap() to asm-generic/io.h?
> 
> We do not have to do it in this series,
> but it would be appreciated
> if you volunteer to make it in a better way.

Yeah I'd be fine with cleaning that up, preferrably after this series is merged so I don't have 
more out of tree patches to juggle. I'd propose that we implement the generic ioremap 
atop map_physmem, which we ought to be able to do for every arch if we clean up MIPS a 
little.

Thanks,
    Paul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161003/76f77660/attachment.sig>


More information about the U-Boot mailing list