* [PATCH] cpufreq: scmi: Fix OPP addition failure with a dummy clock provider
@ 2020-11-10 11:10 Sudeep Holla
2020-11-10 11:24 ` Viresh Kumar
2020-11-17 4:35 ` Viresh Kumar
0 siblings, 2 replies; 4+ messages in thread
From: Sudeep Holla @ 2020-11-10 11:10 UTC (permalink / raw)
To: linux-pm, linux-arm-kernel
Cc: Viresh Kumar, Rafael J . Wysocki, Cristian Marussi, Sudeep Holla
Commit dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return
-EPROBE_DEFER") handles -EPROBE_DEFER for the clock/interconnects within
_allocate_opp_table() which is called from dev_pm_opp_add and it
now propagates the error back to the caller.
SCMI performance domain re-used clock bindings to keep it simple. However
with the above mentioned change, if clock property is present in a device
node, opps fails to get added with below errors until clk_get succeeds.
cpu0: failed to add opp 450000000Hz
cpu0: failed to add opps to the device
....(errors on cpu1-cpu4)
cpu5: failed to add opp 450000000Hz
cpu5: failed to add opps to the device
So, in order to fix the issue, we need to register dummy clock provider.
With the dummy clock provider, clk_get returns NULL(no errors!), then opp
core proceeds to add OPPs for the CPUs.
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Fixes: dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER")
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
drivers/cpufreq/scmi-cpufreq.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c
index e855e8612a67..78318508a6d6 100644
--- a/drivers/cpufreq/scmi-cpufreq.c
+++ b/drivers/cpufreq/scmi-cpufreq.c
@@ -8,6 +8,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/clk-provider.h>
#include <linux/cpu.h>
#include <linux/cpufreq.h>
#include <linux/cpumask.h>
@@ -228,12 +229,17 @@ static struct cpufreq_driver scmi_cpufreq_driver = {
static int scmi_cpufreq_probe(struct scmi_device *sdev)
{
int ret;
+ struct device *dev = &sdev->dev;
handle = sdev->handle;
if (!handle || !handle->perf_ops)
return -ENODEV;
+ /* dummy clock provider as needed by OPP if clocks property is used */
+ if (of_find_property(dev->of_node, "#clock-cells", NULL))
+ devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, NULL);
+
ret = cpufreq_register_driver(&scmi_cpufreq_driver);
if (ret) {
dev_err(&sdev->dev, "%s: registering cpufreq failed, err: %d\n",
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] cpufreq: scmi: Fix OPP addition failure with a dummy clock provider
2020-11-10 11:10 [PATCH] cpufreq: scmi: Fix OPP addition failure with a dummy clock provider Sudeep Holla
@ 2020-11-10 11:24 ` Viresh Kumar
2020-11-11 11:05 ` Sudeep Holla
2020-11-17 4:35 ` Viresh Kumar
1 sibling, 1 reply; 4+ messages in thread
From: Viresh Kumar @ 2020-11-10 11:24 UTC (permalink / raw)
To: Sudeep Holla
Cc: Rafael J . Wysocki, Cristian Marussi, linux-arm-kernel, linux-pm
On 10-11-20, 11:10, Sudeep Holla wrote:
> Commit dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return
> -EPROBE_DEFER") handles -EPROBE_DEFER for the clock/interconnects within
> _allocate_opp_table() which is called from dev_pm_opp_add and it
> now propagates the error back to the caller.
>
> SCMI performance domain re-used clock bindings to keep it simple. However
> with the above mentioned change, if clock property is present in a device
> node, opps fails to get added with below errors until clk_get succeeds.
>
> cpu0: failed to add opp 450000000Hz
> cpu0: failed to add opps to the device
> ....(errors on cpu1-cpu4)
> cpu5: failed to add opp 450000000Hz
> cpu5: failed to add opps to the device
>
> So, in order to fix the issue, we need to register dummy clock provider.
> With the dummy clock provider, clk_get returns NULL(no errors!), then opp
> core proceeds to add OPPs for the CPUs.
>
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
> Fixes: dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER")
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
> drivers/cpufreq/scmi-cpufreq.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c
> index e855e8612a67..78318508a6d6 100644
> --- a/drivers/cpufreq/scmi-cpufreq.c
> +++ b/drivers/cpufreq/scmi-cpufreq.c
> @@ -8,6 +8,7 @@
>
> #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>
> +#include <linux/clk-provider.h>
> #include <linux/cpu.h>
> #include <linux/cpufreq.h>
> #include <linux/cpumask.h>
> @@ -228,12 +229,17 @@ static struct cpufreq_driver scmi_cpufreq_driver = {
> static int scmi_cpufreq_probe(struct scmi_device *sdev)
> {
> int ret;
> + struct device *dev = &sdev->dev;
>
> handle = sdev->handle;
>
> if (!handle || !handle->perf_ops)
> return -ENODEV;
>
> + /* dummy clock provider as needed by OPP if clocks property is used */
> + if (of_find_property(dev->of_node, "#clock-cells", NULL))
> + devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, NULL);
> +
> ret = cpufreq_register_driver(&scmi_cpufreq_driver);
> if (ret) {
> dev_err(&sdev->dev, "%s: registering cpufreq failed, err: %d\n",
For 5.10-rc.
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cpufreq: scmi: Fix OPP addition failure with a dummy clock provider
2020-11-10 11:24 ` Viresh Kumar
@ 2020-11-11 11:05 ` Sudeep Holla
0 siblings, 0 replies; 4+ messages in thread
From: Sudeep Holla @ 2020-11-11 11:05 UTC (permalink / raw)
To: Viresh Kumar
Cc: Sudeep Holla, Rafael J . Wysocki, Cristian Marussi,
linux-arm-kernel, linux-pm
On Tue, Nov 10, 2020 at 04:54:14PM +0530, Viresh Kumar wrote:
> On 10-11-20, 11:10, Sudeep Holla wrote:
> > Commit dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return
> > -EPROBE_DEFER") handles -EPROBE_DEFER for the clock/interconnects within
> > _allocate_opp_table() which is called from dev_pm_opp_add and it
> > now propagates the error back to the caller.
> >
> > SCMI performance domain re-used clock bindings to keep it simple. However
> > with the above mentioned change, if clock property is present in a device
> > node, opps fails to get added with below errors until clk_get succeeds.
> >
> > cpu0: failed to add opp 450000000Hz
> > cpu0: failed to add opps to the device
> > ....(errors on cpu1-cpu4)
> > cpu5: failed to add opp 450000000Hz
> > cpu5: failed to add opps to the device
> >
> > So, in order to fix the issue, we need to register dummy clock provider.
> > With the dummy clock provider, clk_get returns NULL(no errors!), then opp
> > core proceeds to add OPPs for the CPUs.
> >
> > Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> > Cc: Viresh Kumar <viresh.kumar@linaro.org>
> > Fixes: dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER")
> > Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> > ---
> > drivers/cpufreq/scmi-cpufreq.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c
> > index e855e8612a67..78318508a6d6 100644
> > --- a/drivers/cpufreq/scmi-cpufreq.c
> > +++ b/drivers/cpufreq/scmi-cpufreq.c
> > @@ -8,6 +8,7 @@
> >
> > #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> >
> > +#include <linux/clk-provider.h>
> > #include <linux/cpu.h>
> > #include <linux/cpufreq.h>
> > #include <linux/cpumask.h>
> > @@ -228,12 +229,17 @@ static struct cpufreq_driver scmi_cpufreq_driver = {
> > static int scmi_cpufreq_probe(struct scmi_device *sdev)
> > {
> > int ret;
> > + struct device *dev = &sdev->dev;
> >
> > handle = sdev->handle;
> >
> > if (!handle || !handle->perf_ops)
> > return -ENODEV;
> >
> > + /* dummy clock provider as needed by OPP if clocks property is used */
> > + if (of_find_property(dev->of_node, "#clock-cells", NULL))
> > + devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, NULL);
> > +
> > ret = cpufreq_register_driver(&scmi_cpufreq_driver);
> > if (ret) {
> > dev_err(&sdev->dev, "%s: registering cpufreq failed, err: %d\n",
>
> For 5.10-rc.
>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
>
Thanks Viresh, I assume Rafael will take this directly as fix for v5.10
--
Regards,
Sudeep
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cpufreq: scmi: Fix OPP addition failure with a dummy clock provider
2020-11-10 11:10 [PATCH] cpufreq: scmi: Fix OPP addition failure with a dummy clock provider Sudeep Holla
2020-11-10 11:24 ` Viresh Kumar
@ 2020-11-17 4:35 ` Viresh Kumar
1 sibling, 0 replies; 4+ messages in thread
From: Viresh Kumar @ 2020-11-17 4:35 UTC (permalink / raw)
To: Sudeep Holla
Cc: Rafael J . Wysocki, Cristian Marussi, linux-arm-kernel, linux-pm
On 10-11-20, 11:10, Sudeep Holla wrote:
> Commit dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return
> -EPROBE_DEFER") handles -EPROBE_DEFER for the clock/interconnects within
> _allocate_opp_table() which is called from dev_pm_opp_add and it
> now propagates the error back to the caller.
>
> SCMI performance domain re-used clock bindings to keep it simple. However
> with the above mentioned change, if clock property is present in a device
> node, opps fails to get added with below errors until clk_get succeeds.
>
> cpu0: failed to add opp 450000000Hz
> cpu0: failed to add opps to the device
> ....(errors on cpu1-cpu4)
> cpu5: failed to add opp 450000000Hz
> cpu5: failed to add opps to the device
>
> So, in order to fix the issue, we need to register dummy clock provider.
> With the dummy clock provider, clk_get returns NULL(no errors!), then opp
> core proceeds to add OPPs for the CPUs.
>
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
> Fixes: dd461cd9183f ("opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER")
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
> drivers/cpufreq/scmi-cpufreq.c | 6 ++++++
> 1 file changed, 6 insertions(+)
Applied. Thanks.
--
viresh
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-11-17 4:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 11:10 [PATCH] cpufreq: scmi: Fix OPP addition failure with a dummy clock provider Sudeep Holla
2020-11-10 11:24 ` Viresh Kumar
2020-11-11 11:05 ` Sudeep Holla
2020-11-17 4:35 ` Viresh Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).