summaryrefslogtreecommitdiff
path: root/arch/x86/kernel/tboot.c
diff options
context:
space:
mode:
authorRichard Cochran <rcochran@linutronix.de>2016-07-13 20:16:57 +0300
committerIngo Molnar <mingo@kernel.org>2016-07-15 11:40:30 +0300
commitae6a8a2ed721ecdbc15d32b2089af5ed2190adc7 (patch)
tree1e07fa25af0b6ebdf9ed1bee47e2caeed4dcc1f8 /arch/x86/kernel/tboot.c
parent27c01a8c73e15b2135b96a1866e1dbeb797e4806 (diff)
downloadlinux-ae6a8a2ed721ecdbc15d32b2089af5ed2190adc7.tar.xz
x86/tboot: Convert to hotplug state machine
Install the callbacks via the state machine and let the core invoke the callbacks on the already online CPUs. Signed-off-by: Richard Cochran <rcochran@linutronix.de> Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de> Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Gang Wei <gang.wei@intel.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Ning Sun <ning.sun@intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Richard L Maliszewski <richard.l.maliszewski@intel.com> Cc: Shane Wang <shane.wang@intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: rt@linutronix.de Cc: tboot-devel@lists.sourceforge.net Link: http://lkml.kernel.org/r/20160713153337.400227322@linutronix.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel/tboot.c')
-rw-r--r--arch/x86/kernel/tboot.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index 9b0185fbe3eb..654f6c66fe45 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -323,25 +323,16 @@ static int tboot_wait_for_aps(int num_aps)
return !(atomic_read((atomic_t *)&tboot->num_in_wfs) == num_aps);
}
-static int tboot_cpu_callback(struct notifier_block *nfb, unsigned long action,
- void *hcpu)
+static int tboot_dying_cpu(unsigned int cpu)
{
- switch (action) {
- case CPU_DYING:
- atomic_inc(&ap_wfs_count);
- if (num_online_cpus() == 1)
- if (tboot_wait_for_aps(atomic_read(&ap_wfs_count)))
- return NOTIFY_BAD;
- break;
+ atomic_inc(&ap_wfs_count);
+ if (num_online_cpus() == 1) {
+ if (tboot_wait_for_aps(atomic_read(&ap_wfs_count)))
+ return -EBUSY;
}
- return NOTIFY_OK;
+ return 0;
}
-static struct notifier_block tboot_cpu_notifier =
-{
- .notifier_call = tboot_cpu_callback,
-};
-
#ifdef CONFIG_DEBUG_FS
#define TBOOT_LOG_UUID { 0x26, 0x25, 0x19, 0xc0, 0x30, 0x6b, 0xb4, 0x4d, \
@@ -417,8 +408,8 @@ static __init int tboot_late_init(void)
tboot_create_trampoline();
atomic_set(&ap_wfs_count, 0);
- register_hotcpu_notifier(&tboot_cpu_notifier);
-
+ cpuhp_setup_state(CPUHP_AP_X86_TBOOT_DYING, "AP_X86_TBOOT_DYING", NULL,
+ tboot_dying_cpu);
#ifdef CONFIG_DEBUG_FS
debugfs_create_file("tboot_log", S_IRUSR,
arch_debugfs_dir, NULL, &tboot_log_fops);