Merge commit 'lsk/v3.10/topic/arm64-topology~~' into arm64-v3.10
authorMark Brown <broonie@linaro.org>
Tue, 3 Jun 2014 11:20:23 +0000 (12:20 +0100)
committerMark Brown <broonie@linaro.org>
Tue, 3 Jun 2014 11:20:23 +0000 (12:20 +0100)
Conflicts:
arch/arm64/kernel/Makefile

1  2 
arch/arm64/Kconfig
arch/arm64/kernel/Makefile
arch/arm64/kernel/smp.c
arch/powerpc/kernel/prom.c

Simple merge
index deffb17700f786dfb8c2002103dca9a8e29a3949,b0196dd84550a1b269f7fdc0f9b7400c67bc9c17..44212cdac8ef1454e72157385dabed5f3555414c
@@@ -14,13 -14,11 +14,14 @@@ arm64-obj-y                := cputable.o debug-monito
  arm64-obj-$(CONFIG_COMPAT)            += sys32.o kuser32.o signal32.o         \
                                           sys_compat.o
  arm64-obj-$(CONFIG_MODULES)           += arm64ksyms.o module.o
 -arm64-obj-$(CONFIG_SMP)                       += smp.o smp_spin_table.o smp_psci.o
 +arm64-obj-$(CONFIG_SMP)                       += smp.o smp_spin_table.o
+ arm64-obj-$(CONFIG_SMP)                       += topology.o
 +arm64-obj-$(CONFIG_PERF_EVENTS)               += perf_regs.o
  arm64-obj-$(CONFIG_HW_PERF_EVENTS)    += perf_event.o
 -arm64-obj-$(CONFIG_HAVE_HW_BREAKPOINT)+= hw_breakpoint.o
 +arm64-obj-$(CONFIG_HAVE_HW_BREAKPOINT)        += hw_breakpoint.o
  arm64-obj-$(CONFIG_EARLY_PRINTK)      += early_printk.o
 +arm64-obj-$(CONFIG_KGDB)              += kgdb.o
 +arm64-obj-$(CONFIG_JUMP_LABEL)                += jump_label.o
  
  obj-y                                 += $(arm64-obj-y) vdso/
  obj-m                                 += $(arm64-obj-m)
index 6555060f9e9796949b5015680e6d381749d2b01d,262abe9b2632c120a28a0256936c7058e6ce3adc..00e107e5ecaee19d077eae37132098b1f2b8dccc
@@@ -163,124 -211,59 +168,126 @@@ asmlinkage void __cpuinit secondary_sta
        local_irq_enable();
        local_fiq_enable();
  
+       smp_store_cpu_info(cpu);
        /*
 -       * OK, now it's safe to let the boot CPU continue.  Wait for
 -       * the CPU migration code to notice that the CPU is online
 -       * before we continue.
 +       * OK, it's off to the idle thread for us
         */
 -      set_cpu_online(cpu, true);
 -      complete(&cpu_running);
 +      cpu_startup_entry(CPUHP_ONLINE);
 +}
  
 +#ifdef CONFIG_HOTPLUG_CPU
 +static int op_cpu_disable(unsigned int cpu)
 +{
        /*
 -       * OK, it's off to the idle thread for us
 +       * If we don't have a cpu_die method, abort before we reach the point
 +       * of no return. CPU0 may not have an cpu_ops, so test for it.
         */
 -      cpu_startup_entry(CPUHP_ONLINE);
 +      if (!cpu_ops[cpu] || !cpu_ops[cpu]->cpu_die)
 +              return -EOPNOTSUPP;
 +
 +      /*
 +       * We may need to abort a hot unplug for some other mechanism-specific
 +       * reason.
 +       */
 +      if (cpu_ops[cpu]->cpu_disable)
 +              return cpu_ops[cpu]->cpu_disable(cpu);
 +
 +      return 0;
  }
  
 -void __init smp_cpus_done(unsigned int max_cpus)
 +/*
 + * __cpu_disable runs on the processor to be shutdown.
 + */
 +int __cpu_disable(void)
  {
 -      unsigned long bogosum = loops_per_jiffy * num_online_cpus();
 +      unsigned int cpu = smp_processor_id();
 +      int ret;
  
 -      pr_info("SMP: Total of %d processors activated (%lu.%02lu BogoMIPS).\n",
 -              num_online_cpus(), bogosum / (500000/HZ),
 -              (bogosum / (5000/HZ)) % 100);
 +      ret = op_cpu_disable(cpu);
 +      if (ret)
 +              return ret;
 +
 +      /*
 +       * Take this CPU offline.  Once we clear this, we can't return,
 +       * and we must not schedule until we're ready to give up the cpu.
 +       */
 +      set_cpu_online(cpu, false);
 +
 +      /*
 +       * OK - migrate IRQs away from this CPU
 +       */
 +      migrate_irqs();
 +
 +      /*
 +       * Remove this CPU from the vm mask set of all processes.
 +       */
 +      clear_tasks_mm_cpumask(cpu);
 +
 +      return 0;
  }
  
 -void __init smp_prepare_boot_cpu(void)
 +static DECLARE_COMPLETION(cpu_died);
 +
 +/*
 + * called on the thread which is asking for a CPU to be shutdown -
 + * waits until shutdown has completed, or it is timed out.
 + */
 +void __cpu_die(unsigned int cpu)
  {
 +      if (!wait_for_completion_timeout(&cpu_died, msecs_to_jiffies(5000))) {
 +              pr_crit("CPU%u: cpu didn't die\n", cpu);
 +              return;
 +      }
 +      pr_notice("CPU%u: shutdown\n", cpu);
  }
  
 -static void (*smp_cross_call)(const struct cpumask *, unsigned int);
 +/*
 + * Called from the idle thread for the CPU which has been shutdown.
 + *
 + * Note that we disable IRQs here, but do not re-enable them
 + * before returning to the caller. This is also the behaviour
 + * of the other hotplug-cpu capable cores, so presumably coming
 + * out of idle fixes this.
 + */
 +void cpu_die(void)
 +{
 +      unsigned int cpu = smp_processor_id();
  
 -static const struct smp_enable_ops *enable_ops[] __initconst = {
 -      &smp_spin_table_ops,
 -      &smp_psci_ops,
 -      NULL,
 -};
 +      idle_task_exit();
  
 -static const struct smp_enable_ops *smp_enable_ops[NR_CPUS];
 +      local_irq_disable();
  
 -static const struct smp_enable_ops * __init smp_get_enable_ops(const char *name)
 -{
 -      const struct smp_enable_ops **ops = enable_ops;
 +      /* Tell __cpu_die() that this CPU is now safe to dispose of */
 +      complete(&cpu_died);
  
 -      while (*ops) {
 -              if (!strcmp(name, (*ops)->name))
 -                      return *ops;
 +      /*
 +       * Actually shutdown the CPU. This must never fail. The specific hotplug
 +       * mechanism must perform all required cache maintenance to ensure that
 +       * no dirty lines are lost in the process of shutting down the CPU.
 +       */
 +      cpu_ops[cpu]->cpu_die(cpu);
  
 -              ops++;
 -      }
 +      BUG();
 +}
 +#endif
 +
 +void __init smp_cpus_done(unsigned int max_cpus)
 +{
 +      unsigned long bogosum = loops_per_jiffy * num_online_cpus();
 +
 +      pr_info("SMP: Total of %d processors activated (%lu.%02lu BogoMIPS).\n",
 +              num_online_cpus(), bogosum / (500000/HZ),
 +              (bogosum / (5000/HZ)) % 100);
 +}
  
 -      return NULL;
 +void __init smp_prepare_boot_cpu(void)
 +{
 +      set_my_cpu_offset(per_cpu_offset(smp_processor_id()));
  }
  
 +static void (*smp_cross_call)(const struct cpumask *, unsigned int);
 +
  /*
   * Enumerate the possible CPU set from the device tree and build the
   * cpu logical map array containing MPIDR values related to logical
@@@ -391,9 -390,13 +398,13 @@@ next
  
  void __init smp_prepare_cpus(unsigned int max_cpus)
  {
 -      int cpu, err;
 -      unsigned int ncores = num_possible_cpus();
 +      int err;
 +      unsigned int cpu, ncores = num_possible_cpus();
  
+       init_cpu_topology();
+       smp_store_cpu_info(smp_processor_id());
        /*
         * are we trying to boot more cores than exist?
         */
Simple merge