u-boot-brain/arch
Stephen Warren 5e0404ff85 board_f: fix noncached reservation calculation
The current code in reserve_noncached() has two issues:

1) The first update of gd->start_addr_sp always rounds down to a section
start. However, the equivalent calculation in cache.c:noncached_init()
always first rounds up to a section start, then subtracts a section size.
These two calculations differ if the initial value is already rounded to
section alignment.

2) The second update of gd->start_addr_sp subtracts exactly
CONFIG_SYS_NONCACHED_MEMORY, whereas the equivalent calculation in
cache.c:noncached_init() rounds the noncached size up to section
alignment before subtracting it. The two calculations differ if the
noncached region size is not a multiple of the MMU section size.

In practice, one/both of those issues causes a practical problem on
Jetson TX1; U-Boot triggers a synchronous abort during initialization,
likely due to overlapping use of some memory region.

This change fixes both these issues by duplicating the exact calculations
from noncached_init() into reserve_noncached().

However, this fix assumes that gd->start_addr_sp on entry to
reserve_noncached() exactly matches mem_malloc_start on entry to
noncached_init(). I haven't traced the code to see whether it absolutely
guarantees this in all (or indeed any!) cases. Consequently, I added some
comments in the hope that this condition will continue to be true.

Fixes: 5f7adb5b1c ("board_f: reserve noncached space below malloc area")
Cc: Vikas Manocha <vikas.manocha@st.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
2019-08-30 14:17:11 -04:00
..
arc CONFIG_SPL_SYS_[DI]CACHE_OFF: add 2019-05-18 08:15:35 -04:00
arm board_f: fix noncached reservation calculation 2019-08-30 14:17:11 -04:00
m68k env: Drop environment.h header file where not needed 2019-08-11 16:43:41 -04:00
microblaze env: Move env_get() to env.h 2019-08-11 16:43:41 -04:00
mips env: Move env_init() to env.h 2019-08-11 16:43:41 -04:00
nds32 env: Drop environment.h header file where not needed 2019-08-11 16:43:41 -04:00
nios2
powerpc MPC8548: dts: Added PCIe DT node 2019-08-28 13:47:47 +05:30
riscv riscv: add a generic FIT generator script 2019-08-26 16:07:42 +08:00
sandbox sysreset: switch to using SYSRESET_POWER_OFF for poweroff 2019-08-19 12:43:26 +08:00
sh sh: r0p7734: Remove the board 2019-06-14 12:42:06 +02:00
x86 x86: Remove x86 specific GD flags as they are not referenced at all 2019-08-18 21:54:10 +08:00
xtensa env: Move env_get() to env.h 2019-08-11 16:43:41 -04:00
.gitignore
Kconfig riscv: add SPL support 2019-08-26 16:07:42 +08:00