History

PSCI: cpuidle: Refactor CPU suspend power_state parameter handling

Current PSCI code handles idle state entry through the psci_cpu_suspend_enter() API, that takes an idle state index as a parameter and convert the index into a previously initialized power_state parameter before calling the PSCI.CPU_SUSPEND() with it. This is unwieldly, since it forces the PSCI firmware layer to keep track of power_state parameter for every idle state so that the index->power_state conversion can be made in the PSCI firmware layer instead of the CPUidle driver implementations. Move the power_state handling out of drivers/firmware/psci into the respective ACPI/DT PSCI CPUidle backends and convert the psci_cpu_suspend_enter() API to get the power_state parameter as input, which makes it closer to its firmware interface PSCI.CPU_SUSPEND() API. A notable side effect is that the PSCI ACPI/DT CPUidle backends now can directly handle (and if needed update) power_state parameters before handing them over to the PSCI firmware interface to trigger PSCI.CPU_SUSPEND() calls.

Lorenzo Pieralisi committed 7 years ago

Commit 9ffeb6d1 parent 78896145 files · +154 −160Browse files

Showing the changes to include/linux (2 of 5 files). Show all

Unified · Split

2 files
  1. include/linux/cpuidle.h +13 −4
  2. include/linux/psci.h +2 −2
include/linux/cpuidle.h+13−4
@@ -256,7 +256,10 @@ static inline int cpuidle_register_governor(struct cpuidle_governor *gov) · 255 unmodified lines
256256 {return 0;}
257257 #endif
258258
259−#define __CPU_PM_CPU_IDLE_ENTER(low_level_idle_enter, idx, is_retention) \
259+#define __CPU_PM_CPU_IDLE_ENTER(low_level_idle_enter, \
260+ idx, \
261+ state, \
262+ is_retention) \
260263 ({ \
261264 int __ret = 0; \
262265 \
@@ -268,7 +271,7 @@ static inline int cpuidle_register_governor(struct cpuidle_governor *gov) · 5 unmodified lines
268271 if (!is_retention) \
269272 __ret = cpu_pm_enter(); \
270273 if (!__ret) { \
271− __ret = low_level_idle_enter(idx); \
274+ __ret = low_level_idle_enter(state); \
272275 if (!is_retention) \
273276 cpu_pm_exit(); \
274277 } \
@@ -277,9 +280,15 @@ static inline int cpuidle_register_governor(struct cpuidle_governor *gov) · 2 unmodified lines
277280 })
278281
279282 #define CPU_PM_CPU_IDLE_ENTER(low_level_idle_enter, idx) \
280− __CPU_PM_CPU_IDLE_ENTER(low_level_idle_enter, idx, 0)
283+ __CPU_PM_CPU_IDLE_ENTER(low_level_idle_enter, idx, idx, 0)
281284
282285 #define CPU_PM_CPU_IDLE_ENTER_RETENTION(low_level_idle_enter, idx) \
283− __CPU_PM_CPU_IDLE_ENTER(low_level_idle_enter, idx, 1)
286+ __CPU_PM_CPU_IDLE_ENTER(low_level_idle_enter, idx, idx, 1)
287+
288+#define CPU_PM_CPU_IDLE_ENTER_PARAM(low_level_idle_enter, idx, state) \
289+ __CPU_PM_CPU_IDLE_ENTER(low_level_idle_enter, idx, state, 0)
290+
291+#define CPU_PM_CPU_IDLE_ENTER_RETENTION_PARAM(low_level_idle_enter, idx, state) \
292+ __CPU_PM_CPU_IDLE_ENTER(low_level_idle_enter, idx, state, 1)
284293
285294 #endif /* _LINUX_CPUIDLE_H */
include/linux/psci.h+2−2
@@ -15,8 +15,8 @@ · 14 unmodified lines
1515
1616 bool psci_tos_resident_on(int cpu);
1717
18−int psci_cpu_init_idle(unsigned int cpu);
19−int psci_cpu_suspend_enter(unsigned long index);
18+int psci_cpu_suspend_enter(u32 state);
19+bool psci_power_state_is_valid(u32 state);
2020
2121 enum psci_conduit {
2222 PSCI_CONDUIT_NONE,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t