Skip to content

Clean up address mapping functions & CONFIG_SYS_SDRAM_BASE

Paul Burton u-boot 1 version New

Get series with b4
b4 am 1864460.dQVYCF6nug@np-p-burton

Versions newest first

  1. v1 Latest0 of 27 patches 0 repliesNew

Patches in v1 No applies recorded yet

None of the 27 patches the cover letter announces are in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [U-Boot] [PATCH 00/27] Clean up address mapping functions & CONFIG_SYS_SDRAM_BASE
Quoted 26 lines · On Sunday, 2 October 2016 22:46:45 BST Masahiro Yamada wrote:

Hi Paul,

2016-10-01 23:19 GMT+09:00 Paul Burton <[email protected]>:

Quoted 14 lines

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.

Quoted 8 lines

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

Quoted 7 lines

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).

Quoted 7 lines

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>