]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - arch/powerpc/kernel/smp.c
powerpc: Correct DSCR during TM context switch
[karo-tx-linux.git] / arch / powerpc / kernel / smp.c
index 4863ea14f270a3de45a9ea1afa6c4023da8e3122..7753af2d261381bcc21bf3e21f8ee4f4880847e9 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/atomic.h>
 #include <asm/irq.h>
 #include <asm/hw_irq.h>
+#include <asm/kvm_ppc.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/prom.h>
@@ -458,38 +459,9 @@ int generic_check_cpu_restart(unsigned int cpu)
        return per_cpu(cpu_state, cpu) == CPU_UP_PREPARE;
 }
 
-static atomic_t secondary_inhibit_count;
-
-/*
- * Don't allow secondary CPU threads to come online
- */
-void inhibit_secondary_onlining(void)
-{
-       /*
-        * This makes secondary_inhibit_count stable during cpu
-        * online/offline operations.
-        */
-       get_online_cpus();
-
-       atomic_inc(&secondary_inhibit_count);
-       put_online_cpus();
-}
-EXPORT_SYMBOL_GPL(inhibit_secondary_onlining);
-
-/*
- * Allow secondary CPU threads to come online again
- */
-void uninhibit_secondary_onlining(void)
-{
-       get_online_cpus();
-       atomic_dec(&secondary_inhibit_count);
-       put_online_cpus();
-}
-EXPORT_SYMBOL_GPL(uninhibit_secondary_onlining);
-
-static int secondaries_inhibited(void)
+static bool secondaries_inhibited(void)
 {
-       return atomic_read(&secondary_inhibit_count);
+       return kvm_hv_mode_active();
 }
 
 #else /* HOTPLUG_CPU */
@@ -518,7 +490,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)
         * Don't allow secondary threads to come online if inhibited
         */
        if (threads_per_core > 1 && secondaries_inhibited() &&
-           cpu % threads_per_core != 0)
+           cpu_thread_in_subcore(cpu))
                return -EBUSY;
 
        if (smp_ops == NULL ||
@@ -773,6 +745,28 @@ int setup_profiling_timer(unsigned int multiplier)
        return 0;
 }
 
+#ifdef CONFIG_SCHED_SMT
+/* cpumask of CPUs with asymetric SMT dependancy */
+static const int powerpc_smt_flags(void)
+{
+       int flags = SD_SHARE_CPUPOWER | SD_SHARE_PKG_RESOURCES;
+
+       if (cpu_has_feature(CPU_FTR_ASYM_SMT)) {
+               printk_once(KERN_INFO "Enabling Asymmetric SMT scheduling\n");
+               flags |= SD_ASYM_PACKING;
+       }
+       return flags;
+}
+#endif
+
+static struct sched_domain_topology_level powerpc_topology[] = {
+#ifdef CONFIG_SCHED_SMT
+       { cpu_smt_mask, powerpc_smt_flags, SD_INIT_NAME(SMT) },
+#endif
+       { cpu_cpu_mask, SD_INIT_NAME(DIE) },
+       { NULL, },
+};
+
 void __init smp_cpus_done(unsigned int max_cpus)
 {
        cpumask_var_t old_mask;
@@ -797,15 +791,8 @@ void __init smp_cpus_done(unsigned int max_cpus)
 
        dump_numa_cpu_topology();
 
-}
+       set_sched_topology(powerpc_topology);
 
-int arch_sd_sibling_asym_packing(void)
-{
-       if (cpu_has_feature(CPU_FTR_ASYM_SMT)) {
-               printk_once(KERN_INFO "Enabling Asymmetric SMT scheduling\n");
-               return SD_ASYM_PACKING;
-       }
-       return 0;
 }
 
 #ifdef CONFIG_HOTPLUG_CPU