Patch "ARC: [plat-hsdk] Remap CCMs super early in asm boot trampoline" has been added to the 5.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ARC: [plat-hsdk] Remap CCMs super early in asm boot trampoline

to the 5.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     arc-plat-hsdk-remap-ccms-super-early-in-asm-boot-tra.patch
and it can be found in the queue-5.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 84c9a77a0a14a1ddd37840b25f9a8c51ee7f9a0c
Author: Vineet Gupta <vgupta@xxxxxxxxxxxx>
Date:   Thu Oct 29 19:18:34 2020 -0700

    ARC: [plat-hsdk] Remap CCMs super early in asm boot trampoline
    
    [ Upstream commit 3b57533b460c8dc22a432684b7e8d22571f34d2e ]
    
    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@xxxxxxxxxx>
    Cc: linux-mm@xxxxxxxxx
    Signed-off-by: Vineet Gupta <vgupta@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S
index 17fd1ed700cca..9152782444b55 100644
--- a/arch/arc/kernel/head.S
+++ b/arch/arc/kernel/head.S
@@ -67,7 +67,22 @@
 	sr	r5, [ARC_REG_LPB_CTRL]
 1:
 #endif /* CONFIG_ARC_LPB_DISABLE */
-#endif
+
+	/* On HSDK, CCMs need to remapped super early */
+#ifdef CONFIG_ARC_SOC_HSDK
+	mov	r6, 0x60000000
+	lr	r5, [ARC_REG_ICCM_BUILD]
+	breq	r5, 0, 1f
+	sr	r6, [ARC_REG_AUX_ICCM]
+1:
+	lr	r5, [ARC_REG_DCCM_BUILD]
+	breq	r5, 0, 2f
+	sr	r6, [ARC_REG_AUX_DCCM]
+2:
+#endif	/* CONFIG_ARC_SOC_HSDK */
+
+#endif	/* CONFIG_ISA_ARCV2 */
+
 	; Config DSP_CTRL properly, so kernel may use integer multiply,
 	; multiply-accumulate, and divide operations
 	DSP_EARLY_INIT
diff --git a/arch/arc/plat-hsdk/platform.c b/arch/arc/plat-hsdk/platform.c
index 0b961a2a10b8e..22c9e2c9c0283 100644
--- a/arch/arc/plat-hsdk/platform.c
+++ b/arch/arc/plat-hsdk/platform.c
@@ -17,22 +17,6 @@ int arc_hsdk_axi_dmac_coherent __section(.data) = 0;
 
 #define ARC_CCM_UNUSED_ADDR	0x60000000
 
-static void __init hsdk_init_per_cpu(unsigned int cpu)
-{
-	/*
-	 * By default ICCM is mapped to 0x7z while this area is used for
-	 * kernel virtual mappings, so move it to currently unused area.
-	 */
-	if (cpuinfo_arc700[cpu].iccm.sz)
-		write_aux_reg(ARC_REG_AUX_ICCM, ARC_CCM_UNUSED_ADDR);
-
-	/*
-	 * By default DCCM is mapped to 0x8z while this area is used by kernel,
-	 * so move it to currently unused area.
-	 */
-	if (cpuinfo_arc700[cpu].dccm.sz)
-		write_aux_reg(ARC_REG_AUX_DCCM, ARC_CCM_UNUSED_ADDR);
-}
 
 #define ARC_PERIPHERAL_BASE	0xf0000000
 #define CREG_BASE		(ARC_PERIPHERAL_BASE + 0x1000)
@@ -339,5 +323,4 @@ static const char *hsdk_compat[] __initconst = {
 MACHINE_START(SIMULATION, "hsdk")
 	.dt_compat	= hsdk_compat,
 	.init_early     = hsdk_init_early,
-	.init_per_cpu	= hsdk_init_per_cpu,
 MACHINE_END



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux