1. 05 8月, 2013 3 次提交
  2. 30 7月, 2013 9 次提交
    • N
      ARM: bL_switcher: add kernel cmdline param to disable the switcher on boot · c4821c05
      Nicolas Pitre 提交于
      By adding no_bL_switcher to the kernel cmdline string, the switcher
      won't be activated automatically at boot time.  It is still possible
      to activate it later with:
      
      	echo 1 > /sys/kernel/bL_switcher/active
      Signed-off-by: NNicolas Pitre <nico@linaro.org>
      c4821c05
    • N
      ARM: bL_switcher: ability to enable and disable the switcher via sysfs · 6b7437ae
      Nicolas Pitre 提交于
      The /sys/kernel/bL_switcher/enable file allows to enable or disable
      the switcher by writing 1 or 0 to it respectively.  It is still enabled
      by default on boot.
      Signed-off-by: NNicolas Pitre <nico@linaro.org>
      6b7437ae
    • N
      ARM: bL_switcher: do not hardcode GIC IDs in the code · ed96762e
      Nicolas Pitre 提交于
      Currently, GIC IDs are hardcoded making the code dependent on the 4+4 b.L
      configuration.  Let's allow for GIC IDs to be discovered upon switcher
      initialization to support other b.L configurations such as the 1+1 one,
      or 2+3 as on the VExpress TC2.
      Signed-off-by: NNicolas Pitre <nico@linaro.org>
      ed96762e
    • N
      ARM: bL_switcher: hot-unplug half of the available CPUs · 9797a0e9
      Nicolas Pitre 提交于
      In a regular kernel configuration, all the CPUs are initially available.
      But the switcher execution model uses half of them at any time.  Instead
      of hacking the DTB to remove half of the CPUs, let's remove them at
      run time and make sure we still have a working switcher configuration.
      This way, the same DTB can be used whether or not the switcher is used.
      Signed-off-by: NNicolas Pitre <nico@linaro.org>
      9797a0e9
    • N
      ARM: bL_switcher: simplify stack isolation · c052de26
      Nicolas Pitre 提交于
      We now have a dedicated thread for each logical CPU.  That's plenty
      of stack space for our needs.
      Signed-off-by: NNicolas Pitre <nico@linaro.org>
      c052de26
    • N
      ARM: bL_switcher: move to dedicated threads rather than workqueues · 71ce1dee
      Nicolas Pitre 提交于
      The workqueues are problematic as they may be contended.
      They can't be scheduled with top priority either.  Also the optimization
      in bL_switch_request() to skip the workqueue entirely when the target CPU
      and the calling CPU were the same didn't allow for bL_switch_request() to
      be called from atomic context, as might be the case for some cpufreq
      drivers.
      
      Let's move to dedicated kthreads instead.
      Signed-off-by: NNicolas Pitre <nico@linaro.org>
      71ce1dee
    • L
      ARM: bL_switcher: add clockevent save/restore support · 3f09d479
      Lorenzo Pieralisi 提交于
      Per-CPU timers that are shutdown when a CPU is switched over must be disabled
      upon switching and reprogrammed on the inbound CPU by relying on the
      clock events management API. save/restore sequence is executed with irqs
      disabled as mandated by the clock events API.
      
      The next_event is an absolute time, hence, when the inbound CPU resumes,
      if the timer has expired the min delta is forced into the tick device to
      fire after few cycles.
      
      This patch adds switching support for clock events that are per-CPU and
      have to be migrated when a switch takes place; the cpumask of the clock
      event device is checked against the cpumask of the current cpu, and if
      they match, the clockevent device mode is saved and it is put in
      shutdown mode. Resume code reprogrammes the tick device accordingly.
      
      Tested on A15/A7 fast models and architected timers.
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: NNicolas Pitre <nico@linaro.org>
      3f09d479
    • N
      ARM: b.L: core switcher code · 1c33be57
      Nicolas Pitre 提交于
      This is the core code implementing big.LITTLE switcher functionality.
      Rationale for this code is available here:
      
      http://lwn.net/Articles/481055/
      
      The main entry point for a switch request is:
      
      void bL_switch_request(unsigned int cpu, unsigned int new_cluster_id)
      
      If the calling CPU is not the wanted one, this wrapper takes care of
      sending the request to the appropriate CPU with schedule_work_on().
      
      At the moment the core switch operation is handled by bL_switch_to()
      which must be called on the CPU for which a switch is requested.
      
      What this code does:
      
        * Return early if the current cluster is the wanted one.
      
        * Close the gate in the kernel entry vector for both the inbound
          and outbound CPUs.
      
        * Wake up the inbound CPU so it can perform its reset sequence in
          parallel up to the kernel entry vector gate.
      
        * Migrate all interrupts in the GIC targeting the outbound CPU
          interface to the inbound CPU interface, including SGIs. This is
          performed by gic_migrate_target() in drivers/irqchip/irq-gic.c.
      
        * Call cpu_pm_enter() which takes care of flushing the VFP state to
          RAM and save the CPU interface config from the GIC to RAM.
      
        * Modify the cpu_logical_map to refer to the inbound physical CPU.
      
        * Call cpu_suspend() which saves the CPU state (general purpose
          registers, page table address) onto the stack and store the
          resulting stack pointer in an array indexed by the updated
          cpu_logical_map, then call the provided shutdown function.
          This happens in arch/arm/kernel/sleep.S.
      
      At this point, the provided shutdown function executed by the outbound
      CPU ungates the inbound CPU. Therefore the inbound CPU:
      
        * Picks up the saved stack pointer in the array indexed by its MPIDR
          in arch/arm/kernel/sleep.S.
      
        * The MMU and caches are re-enabled using the saved state on the
          provided stack, just like if this was a resume operation from a
          suspended state.
      
        * Then cpu_suspend() returns, although this is on the inbound CPU
          rather than the outbound CPU which called it initially.
      
        * The function cpu_pm_exit() is called which effect is to restore the
          CPU interface state in the GIC using the state previously saved by
          the outbound CPU.
      
        * Exit of bL_switch_to() to resume normal kernel execution on the
          new CPU.
      
      However, the outbound CPU is potentially still running in parallel while
      the inbound CPU is resuming normal kernel execution, hence we need
      per CPU stack isolation to execute bL_do_switch().  After the outbound
      CPU has ungated the inbound CPU, it calls mcpm_cpu_power_down() to:
      
        * Clean its L1 cache.
      
        * If it is the last CPU still alive in its cluster (last man standing),
          it also cleans its L2 cache and disables cache snooping from the other
          cluster.
      
        * Power down the CPU (or whole cluster).
      
      Code called from bL_do_switch() might end up referencing 'current' for
      some reasons.  However, 'current' is derived from the stack pointer.
      With any arbitrary stack, the returned value for 'current' and any
      dereferenced values through it are just random garbage which may lead to
      segmentation faults.
      
      The active page table during the execution of bL_do_switch() is also a
      problem.  There is no guarantee that the inbound CPU won't destroy the
      corresponding task which would free the attached page table while the
      outbound CPU is still running and relying on it.
      
      To solve both issues, we borrow some of the task space belonging to
      the init/idle task which, by its nature, is lightly used and therefore
      is unlikely to clash with our usage.  The init task is also never going
      away.
      
      Right now the logical CPU number is assumed to be equivalent to the
      physical CPU number within each cluster. The kernel should also be
      booted with only one cluster active.  These limitations will be lifted
      eventually.
      Signed-off-by: NNicolas Pitre <nico@linaro.org>
      1c33be57
    • N
      ARM: suspend: use hash of cpu_logical_map value to index into save array · 71a8986d
      Nicolas Pitre 提交于
      Currently we hash the MPIDR of the CPU being suspended to determine which
      entry in the sleep_save_sp array to use. In some situations, such as when
      we want to resume on another physical CPU, the MPIDR of another CPU should
      be used instead.
      
      So let's use the value of cpu_logical_map(smp_processor_id()) in place
      of the MPIDR in the suspend path.  This will result in the same index
      being used as with the previous code unless the caller has modified
      cpu_logical_map() beforehand with the MPIDR of the physical CPU the
      suspending logical CPU will resume on.
      
      Consequently, if doing a physical CPU migration, cpu_logical_map() must
      be updated appropriately somewhere between cpu_pm_enter() and
      cpu_suspend().
      
      The register allocation in __cpu_suspend is reworked in order to better
      accommodate the additional argument.
      Signed-off-by: NNicolas Pitre <nico@linaro.org>
      Acked-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Reviewed-by: NDave Martin <Dave.Martin@arm.com>
      71a8986d
  3. 26 7月, 2013 1 次提交
  4. 25 7月, 2013 1 次提交
  5. 24 7月, 2013 26 次提交