aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2014-05-23 04:15:25 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-05-27 23:35:34 -0400
commit441c19c8a290f5f1e1b263691641124c84232b6e (patch)
treea9541511426e26fc3a654d04fb38d2132ada9415 /arch/powerpc/kernel
parent64bb80d87f01ec01c76863b61b457e0904387f2f (diff)
powerpc/kvm/book3s_hv: Rework the secondary inhibit code
As part of the support for split core on POWER8, we want to be able to block splitting of the core while KVM VMs are active. The logic to do that would be exactly the same as the code we currently have for inhibiting onlining of secondaries. Instead of adding an identical mechanism to block split core, rework the secondary inhibit code to be a "HV KVM is active" check. We can then use that in both the cpu hotplug code and the upcoming split core code. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Michael Neuling <mikey@neuling.org> Acked-by: Alexander Graf <agraf@suse.de> Acked-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/smp.c34
1 files changed, 3 insertions, 31 deletions
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 4863ea14f270..5cdd9eb3b24c 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -36,6 +36,7 @@
36#include <linux/atomic.h> 36#include <linux/atomic.h>
37#include <asm/irq.h> 37#include <asm/irq.h>
38#include <asm/hw_irq.h> 38#include <asm/hw_irq.h>
39#include <asm/kvm_ppc.h>
39#include <asm/page.h> 40#include <asm/page.h>
40#include <asm/pgtable.h> 41#include <asm/pgtable.h>
41#include <asm/prom.h> 42#include <asm/prom.h>
@@ -458,38 +459,9 @@ int generic_check_cpu_restart(unsigned int cpu)
458 return per_cpu(cpu_state, cpu) == CPU_UP_PREPARE; 459 return per_cpu(cpu_state, cpu) == CPU_UP_PREPARE;
459} 460}
460 461
461static atomic_t secondary_inhibit_count; 462static bool secondaries_inhibited(void)
462
463/*
464 * Don't allow secondary CPU threads to come online
465 */
466void inhibit_secondary_onlining(void)
467{
468 /*
469 * This makes secondary_inhibit_count stable during cpu
470 * online/offline operations.
471 */
472 get_online_cpus();
473
474 atomic_inc(&secondary_inhibit_count);
475 put_online_cpus();
476}
477EXPORT_SYMBOL_GPL(inhibit_secondary_onlining);
478
479/*
480 * Allow secondary CPU threads to come online again
481 */
482void uninhibit_secondary_onlining(void)
483{
484 get_online_cpus();
485 atomic_dec(&secondary_inhibit_count);
486 put_online_cpus();
487}
488EXPORT_SYMBOL_GPL(uninhibit_secondary_onlining);
489
490static int secondaries_inhibited(void)
491{ 463{
492 return atomic_read(&secondary_inhibit_count); 464 return kvm_hv_mode_active();
493} 465}
494 466
495#else /* HOTPLUG_CPU */ 467#else /* HOTPLUG_CPU */