Skip to content

Commit 27b4d6a

Browse files
nick650823palmer-dabbelt
authored andcommitted
cpuidle: riscv-sbi: Add cpuidle_disabled() check
The consumer devices that inside the cpu/cluster power domain may register the genpd notifier where their power domains point to the pd nodes under '/cpus/power-domains'. If the cpuidle.off==1, the genpd notifier will fail due to sbi_cpuidle_pd_allow_domain_state is not set. We also need the sbi_cpuidle_cpuhp_up/down to invoke the callbacks. Therefore adding a cpuidle_disabled() check before cpuidle_register() to address the issue. Signed-off-by: Nick Hu <nick.hu@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20240814054434.3563453-3-nick.hu@sifive.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent f8a23e3 commit 27b4d6a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/cpuidle/cpuidle-riscv-sbi.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <asm/smp.h>
2626
#include <asm/suspend.h>
2727

28+
#include "cpuidle.h"
2829
#include "dt_idle_states.h"
2930
#include "dt_idle_genpd.h"
3031

@@ -336,6 +337,9 @@ static int sbi_cpuidle_init_cpu(struct device *dev, int cpu)
336337
return ret;
337338
}
338339

340+
if (cpuidle_disabled())
341+
return 0;
342+
339343
ret = cpuidle_register(drv, NULL);
340344
if (ret)
341345
goto deinit;
@@ -548,7 +552,10 @@ static int sbi_cpuidle_probe(struct platform_device *pdev)
548552
/* Setup CPU hotplut notifiers */
549553
sbi_idle_init_cpuhp();
550554

551-
pr_info("idle driver registered for all CPUs\n");
555+
if (cpuidle_disabled())
556+
pr_info("cpuidle is disabled\n");
557+
else
558+
pr_info("idle driver registered for all CPUs\n");
552559

553560
return 0;
554561

0 commit comments

Comments
 (0)