From: Oded Gabbay <oded.gabbay@gmail.com>
Date: Wed, 28 Dec 2016 11:38:35 +0000 (+0200)
Subject: armv8: release slave cores from CPU_RELEASE_ADDR
X-Git-Tag: v2025.01-rc5-pxa1908~7716
X-Git-Url: http://git.dujemihanovic.xyz/html/static/%7B%7B%20.Permalink%20%7D%7D?a=commitdiff_plain;h=8c36e99f2111;p=u-boot.git

armv8: release slave cores from CPU_RELEASE_ADDR

When using ARMv8 with ARMV8_SPIN_TABLE=y, we want the slave cores to
wait on spin_table_cpu_release_addr, until the Linux kernel will "wake" them
by writing to that location. The address of spin_table_cpu_release_addr is
transferred to the kernel using the device tree that is updated by
spin_table_update_dt().

However, if we also use SPL, then the slave cores are stuck at
CPU_RELEASE_ADDR instead and as a result, never wake up.

This patch releases the slave cores by writing spl_image->entry_point to
CPU_RELEASE_ADDR location before the end of the SPL code
(at jump_to_image_no_args()).

That way, the slave cores will start to execute the u-boot and will get to
the spin-table code and wait on the correct address
(spin_table_cpu_release_addr).

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

diff --git a/common/spl/spl.c b/common/spl/spl.c
index d3a4ff62e5..8fb8da4525 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -167,6 +167,14 @@ __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
 		(image_entry_noargs_t)spl_image->entry_point;
 
 	debug("image entry point: 0x%lX\n", spl_image->entry_point);
+#if defined(CONFIG_ARMV8_SPIN_TABLE) && defined(CONFIG_ARMV8_MULTIENTRY)
+	/*
+	 * Release all slave cores from CPU_RELEASE_ADDR so they could
+	 * arrive to the spin-table code in start.S of the u-boot
+	 */
+	*(ulong *)CPU_RELEASE_ADDR = (ulong)spl_image->entry_point;
+#endif
+
 	image_entry();
 }