linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Doug Anderson <dianders@chromium.org>
To: Kukjin Kim <kgene.kim@samsung.com>,
	Nicolas Pitre <nicolas.pitre@linaro.org>
Cc: Abhilash Kesavan <a.kesavan@samsung.com>,
	Andrew Bresticker <abrestic@chromium.org>,
	Inderpal Singh <inderpal.s@samsung.com>,
	Thomas Abraham <thomas.ab@samsung.com>,
	olof@lixom.net, Tushar Behera <trblinux@gmail.com>,
	Kevin Hilman <khilman@linaro.org>,
	Javier Martinez Canillas <javier.martinez@collabora.co.uk>,
	linux-samsung-soc@vger.kernel.org,
	Doug Anderson <dianders@chromium.org>,
	linux@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] ARM: EXYNOS: mcpm: Don't rely on firmware's secondary_cpu_start
Date: Fri,  6 Jun 2014 14:43:05 -0700	[thread overview]
Message-ID: <1402090985-8061-1-git-send-email-dianders@chromium.org> (raw)

On exynos mcpm systems the firmware is hardcoded to jump to an address
in SRAM (0x02073000) when secondary CPUs come up.  By default the
firmware puts a bunch of code at that location.  That code expects the
kernel to fill in a few slots with addresses that it uses to jump back
to the kernel's entry point for secondary CPUs.

Originally (on prerelease hardware) this firmware code contained a
bunch of workarounds to deal with boot ROM bugs.  However on all
shipped hardware we simply use this code to redirect to a kernel
function for bringing up the CPUs.

Let's stop relying on the code provided by the bootloader and just
plumb in our own (simple) code jump to the kernel.  This has the nice
benefit of fixing problems due to the fact that older bootloaders
(like the one shipped on the Samsung Chromebook 2) might have put
slightly different code into this location.

Once suspend/resume is implemented for systems using exynos-mcpm we'll
need to make sure we reinstall our fixed up code after resume.  ...but
that's not anything new since IRAM (and thus the address of the
mcpm_entry_point) is lost across suspend/resume anyway.

Signed-off-by: Doug Anderson <dianders@chromium.org>
---
 arch/arm/mach-exynos/mcpm-exynos.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c
index 0498d0b..3a7fad0 100644
--- a/arch/arm/mach-exynos/mcpm-exynos.c
+++ b/arch/arm/mach-exynos/mcpm-exynos.c
@@ -343,11 +343,13 @@ static int __init exynos_mcpm_init(void)
 	pr_info("Exynos MCPM support installed\n");
 
 	/*
-	 * Future entries into the kernel can now go
-	 * through the cluster entry vectors.
+	 * U-Boot SPL is hardcoded to jump to the start of ns_sram_base_addr
+	 * as part of secondary_cpu_start().  Let's redirect it to the
+	 * mcpm_entry_point().
 	 */
-	__raw_writel(virt_to_phys(mcpm_entry_point),
-			ns_sram_base_addr + MCPM_BOOT_ADDR_OFFSET);
+	__raw_writel(0xe59f0000, ns_sram_base_addr);     /* ldr r0, [pc, #0] */
+	__raw_writel(0xe12fff10, ns_sram_base_addr + 4); /* bx  r0 */
+	__raw_writel(virt_to_phys(mcpm_entry_point), ns_sram_base_addr + 8);
 
 	iounmap(ns_sram_base_addr);
 
-- 
2.0.0.526.g5318336


             reply	other threads:[~2014-06-06 21:43 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-06 21:43 Doug Anderson [this message]
2014-06-06 22:35 ` [PATCH] ARM: EXYNOS: mcpm: Don't rely on firmware's secondary_cpu_start Nicolas Pitre
2014-06-06 22:43   ` Doug Anderson
2014-06-06 22:46     ` Andrew Bresticker
2014-06-06 23:14 ` [PATCH v2] " Doug Anderson
2014-06-07  1:34   ` Nicolas Pitre
2014-06-09 18:09   ` Kevin Hilman
2014-06-09 20:05     ` Andrew Bresticker
2014-06-09 20:22       ` Nicolas Pitre
2014-06-09 20:35         ` Kevin Hilman
2014-06-09 20:55           ` Nicolas Pitre
2014-06-16 18:37             ` Doug Anderson
2014-06-16 18:47               ` Nicolas Pitre
2014-06-07 18:12 ` [PATCH] " Lorenzo Pieralisi
2014-06-09 17:03   ` Doug Anderson
2014-06-09 22:38     ` Lorenzo Pieralisi
2014-06-10  8:12       ` Chander Kashyap
2014-06-10 15:21         ` Doug Anderson
2014-06-10 15:49           ` Nicolas Pitre
2014-06-11  4:52             ` Chander Kashyap
2014-06-11 10:13               ` Lorenzo Pieralisi
2014-06-11 12:14                 ` Chander Kashyap
2014-06-11 13:15                   ` Lorenzo Pieralisi
2014-06-11 13:29                     ` Chander Kashyap
2014-06-11 13:34                     ` Abhilash Kesavan
2014-06-11 15:19               ` Doug Anderson
2014-06-11 15:28                 ` Kukjin Kim
2014-06-13 11:54                   ` Chander Kashyap
2014-06-13 13:29                     ` Nicolas Pitre
2014-06-13 15:10                     ` Doug Anderson
2014-06-16  7:40                       ` Chander Kashyap
2014-06-16 18:35                   ` Doug Anderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1402090985-8061-1-git-send-email-dianders@chromium.org \
    --to=dianders@chromium.org \
    --cc=a.kesavan@samsung.com \
    --cc=abrestic@chromium.org \
    --cc=inderpal.s@samsung.com \
    --cc=javier.martinez@collabora.co.uk \
    --cc=kgene.kim@samsung.com \
    --cc=khilman@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=nicolas.pitre@linaro.org \
    --cc=olof@lixom.net \
    --cc=thomas.ab@samsung.com \
    --cc=trblinux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).