1. 02 Aug, 2019 1 commit
  2. 19 Jun, 2019 1 commit
  3. 08 Nov, 2018 2 commits
  4. 25 Jun, 2018 1 commit
  5. 05 Mar, 2018 1 commit
  6. 13 Oct, 2017 2 commits
    • Leo Yan's avatar
      ARM: cpuidle: Refactor rollback operations if init fails · 7943bfae
      Leo Yan authored
      If init fails, we need execute two levels rollback operations: the first
      level is for the failed CPU rollback operations, the second level is to
      iterate all succeeded CPUs to cancel their registration; currently the
      code uses one function to finish these two levels rollback operations.
      
      This commit is to refactor rollback operations, so it adds a new
      function arm_idle_init_cpu() to encapsulate one specified CPU driver
      registration and rollback the first level operations; and use function
      arm_idle_init() to iterate all CPUs and finish the second level's
      rollback operations.
      Suggested-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      Acked-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      7943bfae
    • Leo Yan's avatar
      ARM: cpuidle: Correct driver unregistration if init fails · 0f87855d
      Leo Yan authored
      If cpuidle init fails, the code misses to unregister the driver for
      current CPU. Furthermore, we also need to rollback to cancel all
      previous CPUs registration; but the code retrieves driver handler by
      using function cpuidle_get_driver(), this function returns back
      current CPU driver handler but not previous CPU's handler, which leads
      to the failure handling code cannot unregister previous CPUs driver.
      
      This commit fixes two mentioned issues, it adds error handling path
      'goto out_unregister_drv' for current CPU driver unregistration; and
      it is to replace cpuidle_get_driver() with cpuidle_get_cpu_driver(),
      the later function can retrieve driver handler for previous CPUs
      according to the CPU device handler so can unregister the driver
      properly.
      
      This patch also adds extra error handling paths 'goto out_kfree_dev'
      and 'goto out_kfree_drv' and adjusts the freeing sentences for previous
      CPUs; so make the code more readable for freeing 'dev' and 'drv'
      structures.
      Suggested-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      Fixes: d50a7d8a (ARM: cpuidle: Support asymmetric idle definition)
      Acked-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      0f87855d
  7. 19 Sep, 2017 1 commit
    • Stefan Wahren's avatar
      ARM: cpuidle: Avoid memleak if init fail · ed40fad9
      Stefan Wahren authored
      In case there are no DT idle states defined or
      cpuidle_register_driver() fails, the copy of the idle driver is leaked:
      
          unreferenced object 0xede0dc00 (size 1024):
          comm "swapper/0", pid 1, jiffies 4294937431 (age 744.510s)
          hex dump (first 32 bytes):
          94 9e 0b c1 00 00 00 00 00 00 00 00 00 00 00 00 ................
          57 46 49 00 00 00 00 00 00 00 00 00 00 00 00 00 WFI.............
          backtrace:
          [<c1295f04>] arm_idle_init+0x44/0x1ac
          [<c0301e6c>] do_one_initcall+0x3c/0x16c
          [<c1200d70>] kernel_init_freeable+0x110/0x1d0
          [<c0cb3624>] kernel_init+0x8/0x114
          [<c0307a98>] ret_from_fork+0x14/0x3c
      
      So fix this by freeing the unregistered copy in error case.
      Signed-off-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
      Fixes: d50a7d8a (ARM: cpuidle: Support asymmetric idle definition)
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ed40fad9
  8. 23 Jun, 2017 1 commit
    • Daniel Lezcano's avatar
      ARM: cpuidle: Support asymmetric idle definition · d50a7d8a
      Daniel Lezcano authored
      Some hardware have clusters with different idle states. The current code does
      not support this and fails as it expects all the idle states to be identical.
      
      Because of this, the Mediatek mtk8173 had to create the same idle state for a
      big.Little system and now the Hisilicon 960 is facing the same situation.
      
      Solve this by simply assuming the multiple driver will be needed for all the
      platforms using the ARM generic cpuidle driver which makes sense because of the
      different topologies we can support with a single kernel for ARM32 or ARM64.
      
      Every CPU has its own driver, so every single CPU can specify in the DT the
      idle states.
      
      This simple approach allows to support the future dynamIQ system, current SMP
      and HMP.
      
      Tested on:
       - 96boards: Hikey 620
       - 96boards: Hikey 960
       - 96boards: dragonboard410c
       - Mediatek 8173
      Tested-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      Acked-by: default avatarSudeep Holla <sudeep.holla@arm.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      d50a7d8a
  9. 12 Aug, 2016 1 commit
  10. 21 Jul, 2016 1 commit
  11. 28 Apr, 2016 1 commit
  12. 24 Mar, 2015 5 commits
  13. 27 Jan, 2015 1 commit
    • Lorenzo Pieralisi's avatar
      arm64: kernel: remove ARM64_CPU_SUSPEND config option · af3cfdbf
      Lorenzo Pieralisi authored
      ARM64_CPU_SUSPEND config option was introduced to make code providing
      context save/restore selectable only on platforms requiring power
      management capabilities.
      
      Currently ARM64_CPU_SUSPEND depends on the PM_SLEEP config option which
      in turn is set by the SUSPEND config option.
      
      The introduction of CPU_IDLE for arm64 requires that code configured
      by ARM64_CPU_SUSPEND (context save/restore) should be compiled in
      in order to enable the CPU idle driver to rely on CPU operations
      carrying out context save/restore.
      
      The ARM64_CPUIDLE config option (ARM64 generic idle driver) is therefore
      forced to select ARM64_CPU_SUSPEND, even if there may be (ie PM_SLEEP)
      failed dependencies, which is not a clean way of handling the kernel
      configuration option.
      
      For these reasons, this patch removes the ARM64_CPU_SUSPEND config option
      and makes the context save/restore dependent on CPU_PM, which is selected
      whenever either SUSPEND or CPU_IDLE are configured, cleaning up dependencies
      in the process.
      
      This way, code previously configured through ARM64_CPU_SUSPEND is
      compiled in whenever a power management subsystem requires it to be
      present in the kernel (SUSPEND || CPU_IDLE), which is the behaviour
      expected on ARM64 kernels.
      
      The cpu_suspend and cpu_init_idle CPU operations are added only if
      CPU_IDLE is selected, since they are CPU_IDLE specific methods and
      should be grouped and defined accordingly.
      
      PSCI CPU operations are updated to reflect the introduced changes.
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      af3cfdbf
  14. 19 Nov, 2014 1 commit
  15. 12 Nov, 2014 1 commit
    • Daniel Lezcano's avatar
      cpuidle: Invert CPUIDLE_FLAG_TIME_VALID logic · b82b6cca
      Daniel Lezcano authored
      The only place where the time is invalid is when the ACPI_CSTATE_FFH entry
      method is not set. Otherwise for all the drivers, the time can be correctly
      measured.
      
      Instead of duplicating the CPUIDLE_FLAG_TIME_VALID flag in all the drivers
      for all the states, just invert the logic by replacing it by the flag
      CPUIDLE_FLAG_TIME_INVALID, hence we can set this flag only for the acpi idle
      driver, remove the former flag from all the drivers and invert the logic with
      this flag in the different governor.
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      b82b6cca
  16. 25 Sep, 2014 1 commit
    • Lorenzo Pieralisi's avatar
      drivers: cpuidle: CPU idle ARM64 driver · 3299b63d
      Lorenzo Pieralisi authored
      This patch implements a generic CPU idle driver for ARM64 machines.
      
      It relies on the DT idle states infrastructure to initialize idle
      states count and respective parameters. Current code assumes the driver
      is managing idle states on all possible CPUs but can be easily
      generalized to support heterogenous systems and build cpumasks at
      runtime using MIDRs or DT cpu nodes compatible properties.
      
      The driver relies on the arm64 CPU operations to call the idle
      initialization hook used to parse and save suspend back-end specific
      idle states information upon probing.
      
      Idle state index 0 is always initialized as a simple wfi state, ie always
      considered present and functional on all ARM64 platforms.
      
      Idle state indices higher than 0 trigger idle state entry by calling
      the cpu_suspend function, that triggers the suspend operation through
      the CPU operations suspend back-end hook. cpu_suspend passes the idle
      state index as a parameter so that the CPU operations suspend back-end
      can retrieve the required idle state data by using the idle state
      index to execute a look-up on its internal data structures.
      Reviewed-by: default avatarAshwin Chaugule <ashwin.chaugule@linaro.org>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      3299b63d