Skip to content

Commit 3b57533

Browse files
committed
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 7fef431 "(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: foss-for-synopsys-dwc-arc-processors#32 Cc: David Hildenbrand <david@redhat.com> Cc: linux-mm@kvack.org Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
1 parent 328d216 commit 3b57533

2 files changed

Lines changed: 16 additions & 18 deletions

File tree

arch/arc/kernel/head.S

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,22 @@
6767
sr r5, [ARC_REG_LPB_CTRL]
6868
1:
6969
#endif /* CONFIG_ARC_LPB_DISABLE */
70-
#endif
70+
71+
/* On HSDK, CCMs need to remapped super early */
72+
#ifdef CONFIG_ARC_SOC_HSDK
73+
mov r6, 0x60000000
74+
lr r5, [ARC_REG_ICCM_BUILD]
75+
breq r5, 0, 1f
76+
sr r6, [ARC_REG_AUX_ICCM]
77+
1:
78+
lr r5, [ARC_REG_DCCM_BUILD]
79+
breq r5, 0, 2f
80+
sr r6, [ARC_REG_AUX_DCCM]
81+
2:
82+
#endif /* CONFIG_ARC_SOC_HSDK */
83+
84+
#endif /* CONFIG_ISA_ARCV2 */
85+
7186
; Config DSP_CTRL properly, so kernel may use integer multiply,
7287
; multiply-accumulate, and divide operations
7388
DSP_EARLY_INIT

arch/arc/plat-hsdk/platform.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,6 @@ int arc_hsdk_axi_dmac_coherent __section(".data") = 0;
1717

1818
#define ARC_CCM_UNUSED_ADDR 0x60000000
1919

20-
static void __init hsdk_init_per_cpu(unsigned int cpu)
21-
{
22-
/*
23-
* By default ICCM is mapped to 0x7z while this area is used for
24-
* kernel virtual mappings, so move it to currently unused area.
25-
*/
26-
if (cpuinfo_arc700[cpu].iccm.sz)
27-
write_aux_reg(ARC_REG_AUX_ICCM, ARC_CCM_UNUSED_ADDR);
28-
29-
/*
30-
* By default DCCM is mapped to 0x8z while this area is used by kernel,
31-
* so move it to currently unused area.
32-
*/
33-
if (cpuinfo_arc700[cpu].dccm.sz)
34-
write_aux_reg(ARC_REG_AUX_DCCM, ARC_CCM_UNUSED_ADDR);
35-
}
3620

3721
#define ARC_PERIPHERAL_BASE 0xf0000000
3822
#define CREG_BASE (ARC_PERIPHERAL_BASE + 0x1000)
@@ -339,5 +323,4 @@ static const char *hsdk_compat[] __initconst = {
339323
MACHINE_START(SIMULATION, "hsdk")
340324
.dt_compat = hsdk_compat,
341325
.init_early = hsdk_init_early,
342-
.init_per_cpu = hsdk_init_per_cpu,
343326
MACHINE_END

0 commit comments

Comments
 (0)