All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [PATCH v4 04/25] x86: mp_init: Switch parameter names in start_aps()
Date: Tue,  7 Jul 2020 19:34:24 -0600	[thread overview]
Message-ID: <20200708013446.2600256-5-sjg@chromium.org> (raw)
In-Reply-To: <20200708013446.2600256-1-sjg@chromium.org>

These parameters are named differently from elsewhere in this file. Switch
them to avoid confusion.

Also add comments to this function.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
---

(no changes since v2)

Changes in v2:
- Add comments to explain what start_aps() does

 arch/x86/cpu/mp_init.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/arch/x86/cpu/mp_init.c b/arch/x86/cpu/mp_init.c
index e77d7f2cd6..8b00d57c88 100644
--- a/arch/x86/cpu/mp_init.c
+++ b/arch/x86/cpu/mp_init.c
@@ -308,13 +308,26 @@ static int apic_wait_timeout(int total_delay, const char *msg)
 	return 0;
 }
 
-static int start_aps(int ap_count, atomic_t *num_aps)
+/**
+ * start_aps() - Start up the APs and count how many we find
+ *
+ * This is called on the boot processor to start up all the other processors
+ * (here called APs).
+ *
+ * @num_aps: Number of APs we expect to find
+ * @ap_count: Initially zero. Incremented by this function for each AP found
+ * @return 0 if all APs were set up correctly or there are none to set up,
+ *	-ENOSPC if the SIPI vector is too high in memory,
+ *	-ETIMEDOUT if the ICR is busy or the second SIPI fails to complete
+ *	-EIO if not all APs check in correctly
+ */
+static int start_aps(int num_aps, atomic_t *ap_count)
 {
 	int sipi_vector;
 	/* Max location is 4KiB below 1MiB */
 	const int max_vector_loc = ((1 << 20) - (1 << 12)) >> 12;
 
-	if (ap_count == 0)
+	if (num_aps == 0)
 		return 0;
 
 	/* The vector is sent as a 4k aligned address in one byte */
@@ -326,7 +339,7 @@ static int start_aps(int ap_count, atomic_t *num_aps)
 		return -ENOSPC;
 	}
 
-	debug("Attempting to start %d APs\n", ap_count);
+	debug("Attempting to start %d APs\n", num_aps);
 
 	if (apic_wait_timeout(1000, "ICR not to be busy"))
 		return -ETIMEDOUT;
@@ -349,7 +362,7 @@ static int start_aps(int ap_count, atomic_t *num_aps)
 		return -ETIMEDOUT;
 
 	/* Wait for CPUs to check in up to 200 us */
-	wait_for_aps(num_aps, ap_count, 200, 15);
+	wait_for_aps(ap_count, num_aps, 200, 15);
 
 	/* Send 2nd SIPI */
 	if (apic_wait_timeout(1000, "ICR not to be busy"))
@@ -362,9 +375,9 @@ static int start_aps(int ap_count, atomic_t *num_aps)
 		return -ETIMEDOUT;
 
 	/* Wait for CPUs to check in */
-	if (wait_for_aps(num_aps, ap_count, 10000, 50)) {
+	if (wait_for_aps(ap_count, num_aps, 10000, 50)) {
 		debug("Not all APs checked in: %d/%d\n",
-		      atomic_read(num_aps), ap_count);
+		      atomic_read(ap_count), num_aps);
 		return -EIO;
 	}
 
-- 
2.27.0.383.g050319c2ae-goog

  parent reply	other threads:[~2020-07-08  1:34 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-08  1:34 [PATCH v4 00/25] x86: Enhance MTRR functionality to support multiple CPUs Simon Glass
2020-07-08  1:34 ` [PATCH v4 01/25] x86: mp_init: Switch to livetree Simon Glass
2020-07-08  1:34 ` [PATCH v4 02/25] x86: Move MP code into mp_init Simon Glass
2020-07-08  1:34 ` [PATCH v4 03/25] x86: mp_init: Avoid declarations in header files Simon Glass
2020-07-08  1:34 ` Simon Glass [this message]
2020-07-08  1:34 ` [PATCH v4 05/25] x86: mp_init: Drop the num_cpus static variable Simon Glass
2020-07-08  1:34 ` [PATCH v4 06/25] x86: mtrr: Fix 'ensable' typo Simon Glass
2020-07-08  1:34 ` [PATCH v4 07/25] x86: mp_init: Set up the CPU numbers at the start Simon Glass
2020-07-08  1:34 ` [PATCH v4 08/25] x86: mp_init: Adjust bsp_init() to return more information Simon Glass
2020-07-08  1:34 ` [PATCH v4 09/25] x86: cpu: Remove unnecessary #ifdefs Simon Glass
2020-07-08  1:34 ` [PATCH v4 10/25] x86: mp: Support APs waiting for instructions Simon Glass
2020-07-13  4:48   ` Bin Meng
2020-07-08  1:34 ` [PATCH v4 11/25] global_data: Add a generic global_data flag for SMP state Simon Glass
2020-07-13  4:49   ` Bin Meng
2020-07-08  1:34 ` [PATCH v4 12/25] x86: Set the SMP flag when MP init is complete Simon Glass
2020-07-08  1:34 ` [PATCH v4 13/25] x86: mp: Allow running functions on multiple CPUs Simon Glass
2020-07-13  4:56   ` Bin Meng
2020-07-13 20:57     ` Simon Glass
2020-07-08  1:34 ` [PATCH v4 14/25] x86: mp: Park CPUs before running the OS Simon Glass
2020-07-08  1:34 ` [PATCH v4 15/25] x86: mp: Add iterators for CPUs Simon Glass
2020-07-13  4:57   ` Bin Meng
2020-07-08  1:34 ` [PATCH v4 16/25] x86: mtrr: Use MP calls to list the MTRRs Simon Glass
2020-07-08  1:34 ` [PATCH v4 17/25] x86: Don't enable SMP in SPL Simon Glass
2020-07-08  1:34 ` [PATCH v4 18/25] x86: coral: Update the memory map Simon Glass
2020-07-08  1:34 ` [PATCH v4 19/25] x86: mtrr: Update MTRRs on all CPUs Simon Glass
2020-07-13  4:58   ` Bin Meng
2020-07-08  1:34 ` [PATCH v4 20/25] x86: mtrr: Add support for writing to MTRRs on any CPU Simon Glass
2020-07-08  1:34 ` [PATCH v4 21/25] x86: mtrr: Update the command to use the new mtrr calls Simon Glass
2020-07-08  1:34 ` [PATCH v4 22/25] x86: mtrr: Restructure so command execution is in one place Simon Glass
2020-07-08  1:34 ` [PATCH v4 23/25] x86: mtrr: Update 'mtrr' to allow setting MTRRs on any CPU Simon Glass
2020-07-08  1:34 ` [PATCH v4 24/25] x86: mp: Add more comments to the module Simon Glass
2020-07-08  1:34 ` [PATCH v4 25/25] x86: mtrr: Enhance 'mtrr' command to list MTRRs on any CPU Simon Glass
2020-07-13  5:11   ` Bin Meng
2020-07-17  3:24 ` [PATCH v4 00/25] x86: Enhance MTRR functionality to support multiple CPUs Simon Glass
2020-07-17  4:50   ` Bin Meng

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=20200708013446.2600256-5-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /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.