ARC: [plat-hsdk] Remap CCMs super early in asm boot trampoline
authorVineet Gupta <vgupta@synopsys.com>
Fri, 30 Oct 2020 02:18:34 +0000 (19:18 -0700)
committerVineet Gupta <vgupta@synopsys.com>
Mon, 2 Nov 2020 19:45:09 +0000 (11:45 -0800)
commit3b57533b460c8dc22a432684b7e8d22571f34d2e
tree8c5930bea87d55b727f1ad906b2bbb9e54925d23
parent328d2168ca524d501fc4b133d6be076142bd305c
ARC: [plat-hsdk] Remap CCMs super early in asm boot trampoline

ARC HSDK platform stopped booting on released v5.10-rc1, getting stuck
in startup of non master SMP cores.

This was bisected to upstream commit 7fef431be9c9ac25
"(mm/page_alloc: place pages to tail in __free_pages_core())"
That commit itself is harmless, it just exposed a subtle assumption in
our platform code (hence CC'ing linux-mm just as FYI in case some other
arches / platforms trip on it).

The upstream commit is semantically disruptive as it reverses the order
of page allocations (actually it can be good test for hardware
verification to exercise different memory patterns altogether).
For ARC HSDK platform that meant a remapped memory region (pertaining to
unused Closely Coupled Memory) started getting used early for dynamice
allocations, while not effectively remapped on all the cores, triggering
memory error exception on those cores.

The fix is to move the CCM remapping from early platform code to to early core
boot code. And while it is undesirable to riddle common boot code with
platform quirks, there is no other way to do this since the faltering code
involves setting up stack itself so even function calls are not allowed at
that point.

If anyone is interested, all the gory details can be found at Link below.

Link: https://github.com/foss-for-synopsys-dwc-arc-processors/linux/issues/32
Cc: David Hildenbrand <david@redhat.com>
Cc: linux-mm@kvack.org
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
arch/arc/kernel/head.S
arch/arc/plat-hsdk/platform.c