aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/smp.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-10 21:54:22 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-10 21:54:22 -0400
commitc5aec4c76af1a2d89ee2f2d4d5463b2ad2d85de5 (patch)
tree628ae2d9370a6739fd98d8d2f055b46c87ab9316 /arch/powerpc/kernel/smp.c
parent2937f5efa5754754daf46de745f67350f7f06ec2 (diff)
parent0c0a3e5a100bbc4aaedd140e82b429227a76701b (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Pull powerpc updates from Ben Herrenschmidt: "Here is the bulk of the powerpc changes for this merge window. It got a bit delayed in part because I wasn't paying attention, and in part because I discovered I had a core PCI change without a PCI maintainer ack in it. Bjorn eventually agreed it was ok to merge it though we'll probably improve it later and I didn't want to rebase to add his ack. There is going to be a bit more next week, essentially fixes that I still want to sort through and test. The biggest item this time is the support to build the ppc64 LE kernel with our new v2 ABI. We previously supported v2 userspace but the kernel itself was a tougher nut to crack. This is now sorted mostly thanks to Anton and Rusty. We also have a fairly big series from Cedric that add support for 64-bit LE zImage boot wrapper. This was made harder by the fact that traditionally our zImage wrapper was always 32-bit, but our new LE toolchains don't really support 32-bit anymore (it's somewhat there but not really "supported") so we didn't want to rely on it. This meant more churn that just endian fixes. This brings some more LE bits as well, such as the ability to run in LE mode without a hypervisor (ie. under OPAL firmware) by doing the right OPAL call to reinitialize the CPU to take HV interrupts in the right mode and the usual pile of endian fixes. There's another series from Gavin adding EEH improvements (one day we *will* have a release with less than 20 EEH patches, I promise!). Another highlight is the support for the "Split core" functionality on P8 by Michael. This allows a P8 core to be split into "sub cores" of 4 threads which allows the subcores to run different guests under KVM (the HW still doesn't support a partition per thread). And then the usual misc bits and fixes ..." [ Further delayed by gmail deciding that BenH is a dirty spammer. Google knows. ] * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (155 commits) powerpc/powernv: Add missing include to LPC code selftests/powerpc: Test the THP bug we fixed in the previous commit powerpc/mm: Check paca psize is up to date for huge mappings powerpc/powernv: Pass buffer size to OPAL validate flash call powerpc/pseries: hcall functions are exported to modules, need _GLOBAL_TOC() powerpc: Exported functions __clear_user and copy_page use r2 so need _GLOBAL_TOC() powerpc/powernv: Set memory_block_size_bytes to 256MB powerpc: Allow ppc_md platform hook to override memory_block_size_bytes powerpc/powernv: Fix endian issues in memory error handling code powerpc/eeh: Skip eeh sysfs when eeh is disabled powerpc: 64bit sendfile is capped at 2GB powerpc/powernv: Provide debugfs access to the LPC bus via OPAL powerpc/serial: Use saner flags when creating legacy ports powerpc: Add cpu family documentation powerpc/xmon: Fix up xmon format strings powerpc/powernv: Add calls to support little endian host powerpc: Document sysfs DSCR interface powerpc: Fix regression of per-CPU DSCR setting powerpc: Split __SYSFS_SPRSETUP macro arch: powerpc/fadump: Cleaning up inconsistent NULL checks ...
Diffstat (limited to 'arch/powerpc/kernel/smp.c')
-rw-r--r--arch/powerpc/kernel/smp.c43
1 files changed, 11 insertions, 32 deletions
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 10ffffef0414..7753af2d2613 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>
@@ -390,6 +391,7 @@ void smp_prepare_boot_cpu(void)
390#ifdef CONFIG_PPC64 391#ifdef CONFIG_PPC64
391 paca[boot_cpuid].__current = current; 392 paca[boot_cpuid].__current = current;
392#endif 393#endif
394 set_numa_node(numa_cpu_lookup_table[boot_cpuid]);
393 current_set[boot_cpuid] = task_thread_info(current); 395 current_set[boot_cpuid] = task_thread_info(current);
394} 396}
395 397
@@ -457,38 +459,9 @@ int generic_check_cpu_restart(unsigned int cpu)
457 return per_cpu(cpu_state, cpu) == CPU_UP_PREPARE; 459 return per_cpu(cpu_state, cpu) == CPU_UP_PREPARE;
458} 460}
459 461
460static atomic_t secondary_inhibit_count; 462static bool secondaries_inhibited(void)
461
462/*
463 * Don't allow secondary CPU threads to come online
464 */
465void inhibit_secondary_onlining(void)
466{ 463{
467 /* 464 return kvm_hv_mode_active();
468 * This makes secondary_inhibit_count stable during cpu
469 * online/offline operations.
470 */
471 get_online_cpus();
472
473 atomic_inc(&secondary_inhibit_count);
474 put_online_cpus();
475}
476EXPORT_SYMBOL_GPL(inhibit_secondary_onlining);
477
478/*
479 * Allow secondary CPU threads to come online again
480 */
481void uninhibit_secondary_onlining(void)
482{
483 get_online_cpus();
484 atomic_dec(&secondary_inhibit_count);
485 put_online_cpus();
486}
487EXPORT_SYMBOL_GPL(uninhibit_secondary_onlining);
488
489static int secondaries_inhibited(void)
490{
491 return atomic_read(&secondary_inhibit_count);
492} 465}
493 466
494#else /* HOTPLUG_CPU */ 467#else /* HOTPLUG_CPU */
@@ -517,7 +490,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)
517 * Don't allow secondary threads to come online if inhibited 490 * Don't allow secondary threads to come online if inhibited
518 */ 491 */
519 if (threads_per_core > 1 && secondaries_inhibited() && 492 if (threads_per_core > 1 && secondaries_inhibited() &&
520 cpu % threads_per_core != 0) 493 cpu_thread_in_subcore(cpu))
521 return -EBUSY; 494 return -EBUSY;
522 495
523 if (smp_ops == NULL || 496 if (smp_ops == NULL ||
@@ -750,6 +723,12 @@ void start_secondary(void *unused)
750 } 723 }
751 traverse_core_siblings(cpu, true); 724 traverse_core_siblings(cpu, true);
752 725
726 /*
727 * numa_node_id() works after this.
728 */
729 set_numa_node(numa_cpu_lookup_table[cpu]);
730 set_numa_mem(local_memory_node(numa_cpu_lookup_table[cpu]));
731
753 smp_wmb(); 732 smp_wmb();
754 notify_cpu_starting(cpu); 733 notify_cpu_starting(cpu);
755 set_cpu_online(cpu, true); 734 set_cpu_online(cpu, true);