* [PATCH v2 1/2] cpuidle: riscv-sbi: Move sbi_cpuidle_init to arch_initcall
2024-08-14 5:44 [PATCH v2 0/2] cpuidle: riscv-sbi: Allow cpuidle pd used by other devices Nick Hu
@ 2024-08-14 5:44 ` Nick Hu
2024-08-23 7:09 ` Anup Patel
2024-08-14 5:44 ` [PATCH v2 2/2] cpuidle: riscv-sbi: Add cpuidle_disabled() check Nick Hu
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Nick Hu @ 2024-08-14 5:44 UTC (permalink / raw)
To: anup, rafael, daniel.lezcano, paul.walmsley, palmer, aou,
linux-pm, linux-riscv, linux-kernel, greentime.hu, zong.li
Cc: Nick Hu, Anup Patel
Move the sbi_cpuidle_init to the arch_initcall to prevent the consumer
devices from being deferred.
Signed-off-by: Nick Hu <nick.hu@sifive.com>
Link: https://lore.kernel.org/lkml/CAKddAkAOUJSnM=Px-YO=U6pis_7mODHZbmYqcgEzXikriqYvXQ@mail.gmail.com/
Suggested-by: Anup Patel <apatel@ventanamicro.com>
---
drivers/cpuidle/cpuidle-riscv-sbi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/cpuidle/cpuidle-riscv-sbi.c b/drivers/cpuidle/cpuidle-riscv-sbi.c
index a6e123dfe394..98e7751dbfe8 100644
--- a/drivers/cpuidle/cpuidle-riscv-sbi.c
+++ b/drivers/cpuidle/cpuidle-riscv-sbi.c
@@ -592,4 +592,4 @@ static int __init sbi_cpuidle_init(void)
return 0;
}
-device_initcall(sbi_cpuidle_init);
+arch_initcall(sbi_cpuidle_init);
--
2.34.1
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v2 1/2] cpuidle: riscv-sbi: Move sbi_cpuidle_init to arch_initcall
2024-08-14 5:44 ` [PATCH v2 1/2] cpuidle: riscv-sbi: Move sbi_cpuidle_init to arch_initcall Nick Hu
@ 2024-08-23 7:09 ` Anup Patel
0 siblings, 0 replies; 7+ messages in thread
From: Anup Patel @ 2024-08-23 7:09 UTC (permalink / raw)
To: Nick Hu
Cc: rafael, daniel.lezcano, paul.walmsley, palmer, aou, linux-pm,
linux-riscv, linux-kernel, greentime.hu, zong.li, Anup Patel
On Wed, Aug 14, 2024 at 11:14 AM Nick Hu <nick.hu@sifive.com> wrote:
>
> Move the sbi_cpuidle_init to the arch_initcall to prevent the consumer
> devices from being deferred.
>
> Signed-off-by: Nick Hu <nick.hu@sifive.com>
> Link: https://lore.kernel.org/lkml/CAKddAkAOUJSnM=Px-YO=U6pis_7mODHZbmYqcgEzXikriqYvXQ@mail.gmail.com/
> Suggested-by: Anup Patel <apatel@ventanamicro.com>
LGTM.
Reviewed-by: Anup Patel <anup@brainfault.org>
Regards,
Anup
> ---
> drivers/cpuidle/cpuidle-riscv-sbi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpuidle/cpuidle-riscv-sbi.c b/drivers/cpuidle/cpuidle-riscv-sbi.c
> index a6e123dfe394..98e7751dbfe8 100644
> --- a/drivers/cpuidle/cpuidle-riscv-sbi.c
> +++ b/drivers/cpuidle/cpuidle-riscv-sbi.c
> @@ -592,4 +592,4 @@ static int __init sbi_cpuidle_init(void)
>
> return 0;
> }
> -device_initcall(sbi_cpuidle_init);
> +arch_initcall(sbi_cpuidle_init);
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 2/2] cpuidle: riscv-sbi: Add cpuidle_disabled() check
2024-08-14 5:44 [PATCH v2 0/2] cpuidle: riscv-sbi: Allow cpuidle pd used by other devices Nick Hu
2024-08-14 5:44 ` [PATCH v2 1/2] cpuidle: riscv-sbi: Move sbi_cpuidle_init to arch_initcall Nick Hu
@ 2024-08-14 5:44 ` Nick Hu
2024-08-23 7:09 ` Anup Patel
2024-08-22 4:22 ` [PATCH v2 0/2] cpuidle: riscv-sbi: Allow cpuidle pd used by other devices Nick Hu
2024-10-18 19:30 ` patchwork-bot+linux-riscv
3 siblings, 1 reply; 7+ messages in thread
From: Nick Hu @ 2024-08-14 5:44 UTC (permalink / raw)
To: anup, rafael, daniel.lezcano, paul.walmsley, palmer, aou,
linux-pm, linux-riscv, linux-kernel, greentime.hu, zong.li
Cc: Nick Hu
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>
---
drivers/cpuidle/cpuidle-riscv-sbi.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/cpuidle/cpuidle-riscv-sbi.c b/drivers/cpuidle/cpuidle-riscv-sbi.c
index 98e7751dbfe8..3c8a509288f3 100644
--- a/drivers/cpuidle/cpuidle-riscv-sbi.c
+++ b/drivers/cpuidle/cpuidle-riscv-sbi.c
@@ -25,6 +25,7 @@
#include <asm/smp.h>
#include <asm/suspend.h>
+#include "cpuidle.h"
#include "dt_idle_states.h"
#include "dt_idle_genpd.h"
@@ -336,6 +337,9 @@ static int sbi_cpuidle_init_cpu(struct device *dev, int cpu)
return ret;
}
+ if (cpuidle_disabled())
+ return 0;
+
ret = cpuidle_register(drv, NULL);
if (ret)
goto deinit;
@@ -548,7 +552,10 @@ static int sbi_cpuidle_probe(struct platform_device *pdev)
/* Setup CPU hotplut notifiers */
sbi_idle_init_cpuhp();
- pr_info("idle driver registered for all CPUs\n");
+ if (cpuidle_disabled())
+ pr_info("cpuidle is disabled\n");
+ else
+ pr_info("idle driver registered for all CPUs\n");
return 0;
--
2.34.1
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v2 2/2] cpuidle: riscv-sbi: Add cpuidle_disabled() check
2024-08-14 5:44 ` [PATCH v2 2/2] cpuidle: riscv-sbi: Add cpuidle_disabled() check Nick Hu
@ 2024-08-23 7:09 ` Anup Patel
0 siblings, 0 replies; 7+ messages in thread
From: Anup Patel @ 2024-08-23 7:09 UTC (permalink / raw)
To: Nick Hu
Cc: rafael, daniel.lezcano, paul.walmsley, palmer, aou, linux-pm,
linux-riscv, linux-kernel, greentime.hu, zong.li
On Wed, Aug 14, 2024 at 11:14 AM Nick Hu <nick.hu@sifive.com> wrote:
>
> 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>
LGTM.
Reviewed-by: Anup Patel <anup@brainfault.org>
Regards,
Anup
> ---
> drivers/cpuidle/cpuidle-riscv-sbi.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/cpuidle/cpuidle-riscv-sbi.c b/drivers/cpuidle/cpuidle-riscv-sbi.c
> index 98e7751dbfe8..3c8a509288f3 100644
> --- a/drivers/cpuidle/cpuidle-riscv-sbi.c
> +++ b/drivers/cpuidle/cpuidle-riscv-sbi.c
> @@ -25,6 +25,7 @@
> #include <asm/smp.h>
> #include <asm/suspend.h>
>
> +#include "cpuidle.h"
> #include "dt_idle_states.h"
> #include "dt_idle_genpd.h"
>
> @@ -336,6 +337,9 @@ static int sbi_cpuidle_init_cpu(struct device *dev, int cpu)
> return ret;
> }
>
> + if (cpuidle_disabled())
> + return 0;
> +
> ret = cpuidle_register(drv, NULL);
> if (ret)
> goto deinit;
> @@ -548,7 +552,10 @@ static int sbi_cpuidle_probe(struct platform_device *pdev)
> /* Setup CPU hotplut notifiers */
> sbi_idle_init_cpuhp();
>
> - pr_info("idle driver registered for all CPUs\n");
> + if (cpuidle_disabled())
> + pr_info("cpuidle is disabled\n");
> + else
> + pr_info("idle driver registered for all CPUs\n");
>
> return 0;
>
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/2] cpuidle: riscv-sbi: Allow cpuidle pd used by other devices
2024-08-14 5:44 [PATCH v2 0/2] cpuidle: riscv-sbi: Allow cpuidle pd used by other devices Nick Hu
2024-08-14 5:44 ` [PATCH v2 1/2] cpuidle: riscv-sbi: Move sbi_cpuidle_init to arch_initcall Nick Hu
2024-08-14 5:44 ` [PATCH v2 2/2] cpuidle: riscv-sbi: Add cpuidle_disabled() check Nick Hu
@ 2024-08-22 4:22 ` Nick Hu
2024-10-18 19:30 ` patchwork-bot+linux-riscv
3 siblings, 0 replies; 7+ messages in thread
From: Nick Hu @ 2024-08-22 4:22 UTC (permalink / raw)
To: anup, rafael, daniel.lezcano, paul.walmsley, palmer, aou,
linux-pm, linux-riscv, linux-kernel, greentime.hu, zong.li
Hi Anup
Any suggestions on this one?
On Wed, Aug 14, 2024 at 1:44 PM Nick Hu <nick.hu@sifive.com> wrote:
>
> Add this patchset so the devices that inside the cpu/cluster power domain
> can use the cpuidle pd to register the genpd notifier to handle the PM
> when cpu/cluster is going to enter a deeper sleep state.
>
> Nick Hu (2):
> cpuidle: riscv-sbi: Move sbi_cpuidle_init to arch_initcall
> cpuidle: riscv-sbi: Add cpuidle_disabled() check
>
> drivers/cpuidle/cpuidle-riscv-sbi.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> --
> 2.34.1
>
Regards,
Nick
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/2] cpuidle: riscv-sbi: Allow cpuidle pd used by other devices
2024-08-14 5:44 [PATCH v2 0/2] cpuidle: riscv-sbi: Allow cpuidle pd used by other devices Nick Hu
` (2 preceding siblings ...)
2024-08-22 4:22 ` [PATCH v2 0/2] cpuidle: riscv-sbi: Allow cpuidle pd used by other devices Nick Hu
@ 2024-10-18 19:30 ` patchwork-bot+linux-riscv
3 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-10-18 19:30 UTC (permalink / raw)
To: Nick Hu
Cc: linux-riscv, anup, rafael, daniel.lezcano, paul.walmsley, palmer,
aou, linux-pm, linux-kernel, greentime.hu, zong.li
Hello:
This series was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:
On Wed, 14 Aug 2024 13:44:32 +0800 you wrote:
> Add this patchset so the devices that inside the cpu/cluster power domain
> can use the cpuidle pd to register the genpd notifier to handle the PM
> when cpu/cluster is going to enter a deeper sleep state.
>
> Nick Hu (2):
> cpuidle: riscv-sbi: Move sbi_cpuidle_init to arch_initcall
> cpuidle: riscv-sbi: Add cpuidle_disabled() check
>
> [...]
Here is the summary with links:
- [v2,1/2] cpuidle: riscv-sbi: Move sbi_cpuidle_init to arch_initcall
https://git.kernel.org/riscv/c/f8a23e3b79d6
- [v2,2/2] cpuidle: riscv-sbi: Add cpuidle_disabled() check
https://git.kernel.org/riscv/c/27b4d6aa29ab
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 7+ messages in thread