All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geoff Levand <geoffrey.levand@am.sony.com>
To: linuxppc-dev@ozlabs.org
Subject: [RFC 2/3] zImage: SMP hold
Date: Sat, 17 Feb 2007 17:17:04 -0800	[thread overview]
Message-ID: <45D7A910.60702@am.sony.com> (raw)

Add SMP secondary hold helper routines to the powerpc zImage bootwrapper.  For
platforms which are entered with multiple cpus.  These routines can be used to
hold the secondary cpus until the kernel is ready for entry.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>

---
 arch/powerpc/boot/main.c |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+)

--- ps3-linux-dev.orig/arch/powerpc/boot/main.c
+++ ps3-linux-dev/arch/powerpc/boot/main.c
@@ -290,6 +290,44 @@ static void set_cmdline(char *buf)
 		setprop(devp, "bootargs", buf, strlen(buf) + 1);
 }
 
+static volatile kernel_entry_t smp_secondary_entry = 0;
+
+/**
+ * smp_secondary_hold - Hold any secondary cpus until kernel is ready to enter.
+ * @cpu_id: Hardware cpu id.
+ *
+ * Called from the early entry code.
+ */
+
+void smp_secondary_hold(unsigned int cpu_id)
+{
+	while(!smp_secondary_entry)
+		(void)0;
+
+	printf("%s:%d: released cpu (%u)\n", __func__, __LINE__, cpu_id);
+
+	smp_secondary_entry(0, 0, NULL);
+
+	printf("Error: secondary cpu (%u) returned to bootwrapper!\n",
+		cpu_id);
+	exit();
+}
+
+/**
+ * smp_secondary_release - Release any secondary cpus.
+ * @kentry: The kernel entry for secondary cpus.
+ *
+ * Typically called by the primary cpu after the kernel is ready for entry.
+ */
+
+static void smp_secondary_release(kernel_entry_t kentry)
+{
+	printf("%s:%d\n", __func__, __LINE__);
+	smp_secondary_entry = kentry;
+
+	/* Do we need to yield to the secondary cpus here??? */
+}
+
 struct platform_ops platform_ops;
 struct dt_ops dt_ops;
 struct console_ops console_ops;
@@ -340,7 +378,10 @@ void start(unsigned long a1, unsigned lo
 	if (console_ops.close)
 		console_ops.close();
 
 	kentry = (kernel_entry_t) vmlinux.addr;
+
+	smp_secondary_release(kentry);
+
 	if (ft_addr)
 		kentry(ft_addr, 0, NULL);
 	else

             reply	other threads:[~2007-02-18  1:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-18  1:17 Geoff Levand [this message]
2007-02-19  0:32 ` [RFC 2/3] zImage: SMP hold Paul Mackerras
2007-02-19 15:33   ` Geoff Levand
2007-02-20  2:22 ` David Gibson
2007-02-20 14:32   ` Geoff Levand

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=45D7A910.60702@am.sony.com \
    --to=geoffrey.levand@am.sony.com \
    --cc=linuxppc-dev@ozlabs.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.