[Skiboot] [RFC PATCH 3/4] cpu: idle move the minimum PM latency into the idle code
Nicholas Piggin
npiggin at gmail.com
Sun Aug 13 23:59:58 AEST 2017
The caller isn't in a position to know about PM heuristics, so
move the minimum timeout before power managmeent into the cpu idle
call. There is no functional change.
Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
core/cpu.c | 3 ++-
core/timebase.c | 4 +---
include/cpu.h | 2 +-
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/core/cpu.c b/core/cpu.c
index 0bdf8299..2a95dff6 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -402,10 +402,11 @@ void cpu_idle_job(void)
}
}
-void cpu_idle_delay(unsigned long delay, unsigned long min_pm)
+void cpu_idle_delay(unsigned long delay)
{
unsigned long now = mftb();
unsigned long end = now + delay;
+ unsigned long min_pm = usecs_to_tb(10);
if (pm_enabled && delay > min_pm) {
for (;;) {
diff --git a/core/timebase.c b/core/timebase.c
index ca961c39..f2dff44b 100644
--- a/core/timebase.c
+++ b/core/timebase.c
@@ -66,14 +66,12 @@ void time_wait(unsigned long duration)
void time_wait_nopoll(unsigned long duration)
{
- unsigned long min_sleep = usecs_to_tb(10);
-
if (this_cpu()->tb_invalid) {
cpu_relax();
return;
}
- cpu_idle_delay(duration, min_sleep);
+ cpu_idle_delay(duration);
}
void time_wait_ms(unsigned long ms)
diff --git a/include/cpu.h b/include/cpu.h
index fd3acf77..f08940f7 100644
--- a/include/cpu.h
+++ b/include/cpu.h
@@ -268,7 +268,7 @@ extern unsigned long __attrconst cpu_stack_bottom(unsigned int pir);
extern unsigned long __attrconst cpu_stack_top(unsigned int pir);
extern void cpu_idle_job(void);
-extern void cpu_idle_delay(unsigned long delay, unsigned long min_pm);
+extern void cpu_idle_delay(unsigned long delay);
extern void cpu_set_radix_mode(void);
extern void cpu_fast_reboot_complete(void);
--
2.13.3
More information about the Skiboot
mailing list