diff options
author | Nicholas Piggin <npiggin@gmail.com> | 2021-12-17 12:17:21 +1000 |
---|---|---|
committer | Cédric Le Goater <clg@kaod.org> | 2021-12-17 10:34:23 +0100 |
commit | 3ff8fa0acc6aa3b3598cdb3e30fdf80257125740 (patch) | |
tree | 116d49f47e02ecde34bd35c1722452bc359e1ab0 | |
parent | 6cd712f95027f0d158aeb7548e319b0a847b1d3d (diff) | |
download | skiboot-3ff8fa0acc6aa3b3598cdb3e30fdf80257125740.zip skiboot-3ff8fa0acc6aa3b3598cdb3e30fdf80257125740.tar.gz skiboot-3ff8fa0acc6aa3b3598cdb3e30fdf80257125740.tar.bz2 |
core/cpu: refactor IPI sending
Pull the IPI sending code into its own function where it is used in
two places.
cpu_wake() already checks in_idle, so its caller does not need to
check pm_enabled.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
-rw-r--r-- | core/cpu.c | 31 |
1 files changed, 13 insertions, 18 deletions
@@ -96,13 +96,8 @@ void __nomcount cpu_relax(void) barrier(); } -static void cpu_wake(struct cpu_thread *cpu) +static void cpu_send_ipi(struct cpu_thread *cpu) { - /* Is it idle ? If not, no need to wake */ - sync(); - if (!cpu->in_idle) - return; - if (proc_gen == proc_gen_p8) { /* Poke IPI */ icp_kick_cpu(cpu); @@ -111,6 +106,14 @@ static void cpu_wake(struct cpu_thread *cpu) } } +static void cpu_wake(struct cpu_thread *cpu) +{ + /* Is it idle ? If not, no need to wake */ + sync(); + if (cpu->in_idle) + cpu_send_ipi(cpu); +} + /* * If chip_id is >= 0, schedule the job on that node. * Otherwise schedule the job anywhere. @@ -195,8 +198,7 @@ static void queue_job_on_cpu(struct cpu_thread *cpu, struct cpu_job *job) cpu->job_has_no_return = true; else cpu->job_count++; - if (pm_enabled) - cpu_wake(cpu); + cpu_wake(cpu); unlock(&cpu->job_lock); } @@ -607,16 +609,9 @@ static void reconfigure_idle_start(void) */ sync(); - if (proc_gen == proc_gen_p8) { - for_each_available_cpu(cpu) { - if (cpu->in_sleep || cpu->in_idle) - icp_kick_cpu(cpu); - } - } else if (proc_gen == proc_gen_p9 || proc_gen == proc_gen_p10) { - for_each_available_cpu(cpu) { - if (cpu->in_sleep || cpu->in_idle) - p9_dbell_send(cpu->pir); - } + for_each_available_cpu(cpu) { + if (cpu->in_sleep || cpu->in_idle) + cpu_send_ipi(cpu); } /* |