All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for HATAYAMA Daisuke <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
	tglx@linutronix.de, hpa@linux.intel.com,
	d.hatayama@jp.fujitsu.com
Subject: [tip:x86/bsp-hotplug] x86, apic: Add boot_cpu_is_bsp() to check if boot cpu is BSP
Date: Wed, 9 Oct 2013 16:15:53 -0700	[thread overview]
Message-ID: <tip-68c3467bb95a9e99f46d04cb96f60c04bb997ac8@git.kernel.org> (raw)
In-Reply-To: <20130829092758.5476.90694.stgit@localhost6.localdomain6>

Commit-ID:  68c3467bb95a9e99f46d04cb96f60c04bb997ac8
Gitweb:     http://git.kernel.org/tip/68c3467bb95a9e99f46d04cb96f60c04bb997ac8
Author:     HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
AuthorDate: Thu, 29 Aug 2013 18:27:58 +0900
Committer:  H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Wed, 9 Oct 2013 15:41:10 -0700

x86, apic: Add boot_cpu_is_bsp() to check if boot cpu is BSP

Kexec can enter the kdump 2nd kernel on AP if crash happens on AP. To
check if boot cpu is BSP, introduce a helper function
boot_cpu_is_bsp().

Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Link: http://lkml.kernel.org/r/20130829092758.5476.90694.stgit@localhost6.localdomain6
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
 arch/x86/include/asm/mpspec.h |  3 +++
 arch/x86/kernel/apic/apic.c   | 14 ++++++++++++++
 arch/x86/kernel/setup.c       |  2 ++
 3 files changed, 19 insertions(+)

diff --git a/arch/x86/include/asm/mpspec.h b/arch/x86/include/asm/mpspec.h
index 626cf70..a8a4338 100644
--- a/arch/x86/include/asm/mpspec.h
+++ b/arch/x86/include/asm/mpspec.h
@@ -47,10 +47,13 @@ extern int mp_bus_id_to_type[MAX_MP_BUSSES];
 extern DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
 
 extern unsigned int boot_cpu_physical_apicid;
+extern bool boot_cpu_is_bsp;
 extern unsigned int max_physical_apicid;
 extern int mpc_default_type;
 extern unsigned long mp_lapic_addr;
 
+extern void boot_cpu_is_bsp_init(void);
+
 #ifdef CONFIG_X86_LOCAL_APIC
 extern int smp_found_config;
 #else
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index a7eb82d..488709d 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -64,6 +64,12 @@ unsigned disabled_cpus;
 unsigned int boot_cpu_physical_apicid = -1U;
 
 /*
+ * Indicates whether the processor that is doing the boot up, is BSP
+ * processor or not.
+ */
+bool boot_cpu_is_bsp;
+
+/*
  * The highest APIC ID seen during enumeration.
  */
 unsigned int max_physical_apicid;
@@ -2589,3 +2595,11 @@ static int __init lapic_insert_resource(void)
  * that is using request_resource
  */
 late_initcall(lapic_insert_resource);
+
+void boot_cpu_is_bsp_init(void)
+{
+	u32 l, h;
+
+	rdmsr(MSR_IA32_APICBASE, l, h);
+	boot_cpu_is_bsp = (l & MSR_IA32_APICBASE_BSP) ? true : false;
+}
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index f0de629..a30bc06 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1166,6 +1166,8 @@ void __init setup_arch(char **cmdline_p)
 
 	early_quirks();
 
+	boot_cpu_is_bsp_init();
+
 	/*
 	 * Read APIC and some other early information from ACPI tables.
 	 */

  reply	other threads:[~2013-10-09 23:16 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-29  9:27 [PATCH 0/2] x86, apic: Disable BSP if boot cpu is AP HATAYAMA Daisuke
2013-08-29  9:27 ` HATAYAMA Daisuke
2013-08-29  9:27 ` [PATCH 1/2] x86, apic: Add boot_cpu_is_bsp() to check if boot cpu is BSP HATAYAMA Daisuke
2013-08-29  9:27   ` HATAYAMA Daisuke
2013-10-09 23:15   ` tip-bot for HATAYAMA Daisuke [this message]
2013-08-29  9:28 ` [PATCH 2/2] x86, apic: Disable BSP if boot cpu is AP HATAYAMA Daisuke
2013-08-29  9:28   ` HATAYAMA Daisuke
2013-08-31  5:22   ` Borislav Petkov
2013-08-31  5:22     ` Borislav Petkov
2013-09-02  2:32     ` HATAYAMA Daisuke
2013-09-02  2:32       ` HATAYAMA Daisuke
2013-09-02  7:13       ` Borislav Petkov
2013-09-02  7:13         ` Borislav Petkov
2013-09-02  9:42         ` HATAYAMA Daisuke
2013-09-02  9:42           ` HATAYAMA Daisuke
2013-09-04  6:12           ` Borislav Petkov
2013-09-04  6:12             ` Borislav Petkov
2013-09-09  6:18             ` HATAYAMA Daisuke
2013-09-09  6:18               ` HATAYAMA Daisuke
2013-10-09 23:16   ` [tip:x86/bsp-hotplug] " tip-bot for HATAYAMA Daisuke
2013-10-12 17:31     ` H. Peter Anvin
2013-10-12 17:42       ` Ingo Molnar
2013-11-11 19:54         ` H. Peter Anvin
2013-11-12 10:20           ` HATAYAMA Daisuke
2013-11-12 15:35             ` H. Peter Anvin
2013-08-29 13:54 ` [PATCH 0/2] " H. Peter Anvin
2013-08-29 13:54   ` H. Peter Anvin
2013-08-29 23:37   ` Eric W. Biederman
2013-08-29 23:37     ` Eric W. Biederman
2013-08-30 12:48     ` Vivek Goyal
2013-08-30 12:48       ` Vivek Goyal
2013-08-29 23:51   ` HATAYAMA Daisuke
2013-08-29 23:51     ` HATAYAMA Daisuke
2013-08-30 15:43     ` H. Peter Anvin
2013-08-30 15:43       ` H. Peter Anvin
2013-10-09 20:20       ` Vivek Goyal
2013-10-09 20:20         ` Vivek Goyal
2013-10-14  9:03         ` Petr Tesarik
2013-10-14  9:03           ` Petr Tesarik

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=tip-68c3467bb95a9e99f46d04cb96f60c04bb997ac8@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=d.hatayama@jp.fujitsu.com \
    --cc=hpa@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.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.