Revision tags: v6.6.25, v6.6.24, v6.6.23, v6.6.16, v6.6.15, v6.6.14, v6.6.13, v6.6.12, v6.6.11, v6.6.10 |
|
#
3da87064 |
| 05-Jan-2024 |
Viresh Kumar <viresh.kumar@linaro.org> |
OPP: Pass rounded rate to _set_opp()
commit 7269c250db1b89cda72ca419b7bd5e37997309d6 upstream.
The OPP core finds the eventual frequency to set with the help of clk_round_rate() and the same was ea
OPP: Pass rounded rate to _set_opp()
commit 7269c250db1b89cda72ca419b7bd5e37997309d6 upstream.
The OPP core finds the eventual frequency to set with the help of clk_round_rate() and the same was earlier getting passed to _set_opp() and that's what would get configured.
The commit 1efae8d2e777 ("OPP: Make dev_pm_opp_set_opp() independent of frequency") mistakenly changed that. Fix it.
Fixes: 1efae8d2e777 ("OPP: Make dev_pm_opp_set_opp() independent of frequency") Cc: v5.18+ <stable@vger.kernel.org> # v6.0+ Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
show more ...
|
Revision tags: v6.6.9, v6.6.8, v6.6.7, v6.6.6, v6.6.5, v6.6.4, v6.6.3, v6.6.2, v6.5.11, v6.6.1, v6.5.10, v6.6, v6.5.9, v6.5.8, v6.5.7, v6.5.6, v6.5.5, v6.5.4, v6.5.3, v6.5.2, v6.1.51, v6.5.1, v6.1.50, v6.5, v6.1.49, v6.1.48, v6.1.46, v6.1.45, v6.1.44, v6.1.43, v6.1.42, v6.1.41, v6.1.40 |
|
#
d920920f |
| 21-Jul-2023 |
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> |
OPP: Fix passing 0 to PTR_ERR in _opp_attach_genpd()
If dev_pm_domain_attach_by_name() returns NULL, then 0 will be passed to PTR_ERR() as reported by the smatch warning below:
drivers/opp/core.c:2
OPP: Fix passing 0 to PTR_ERR in _opp_attach_genpd()
If dev_pm_domain_attach_by_name() returns NULL, then 0 will be passed to PTR_ERR() as reported by the smatch warning below:
drivers/opp/core.c:2456 _opp_attach_genpd() warn: passing zero to 'PTR_ERR'
Fix it by checking for the non-NULL virt_dev pointer before passing it to PTR_ERR. Otherwise return -ENODEV.
Fixes: 4ea9496cbc95 ("opp: Fix error check in dev_pm_opp_attach_genpd()") Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
show more ...
|
#
7ddd8deb |
| 21-Jul-2023 |
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> |
OPP: Fix potential null ptr dereference in dev_pm_opp_get_required_pstate()
"opp" pointer is dereferenced before the IS_ERR_OR_NULL() check. Fix it by removing the dereference to cache opp_table and
OPP: Fix potential null ptr dereference in dev_pm_opp_get_required_pstate()
"opp" pointer is dereferenced before the IS_ERR_OR_NULL() check. Fix it by removing the dereference to cache opp_table and dereference it directly where opp_table is used.
This fixes the following smatch warning:
drivers/opp/core.c:232 dev_pm_opp_get_required_pstate() warn: variable dereferenced before IS_ERR check 'opp' (see line 230)
Fixes: 84cb7ff35fcf ("OPP: pstate is only valid for genpd OPP tables") Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
show more ...
|
#
746de825 |
| 21-Jul-2023 |
Viresh Kumar <viresh.kumar@linaro.org> |
OPP: Reuse dev_pm_opp_get_freq_indexed()
Reuse dev_pm_opp_get_freq_indexed() from dev_pm_opp_get_freq().
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Manivannan Sadhasivam <maniv
OPP: Reuse dev_pm_opp_get_freq_indexed()
Reuse dev_pm_opp_get_freq_indexed() from dev_pm_opp_get_freq().
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
show more ...
|
#
034d6aac |
| 21-Jul-2023 |
Viresh Kumar <viresh.kumar@linaro.org> |
OPP: Update _read_freq() to return the correct frequency
Now that we support finding indexed frequencies, lets update _read_freq() to return the right one.
Signed-off-by: Viresh Kumar <viresh.kumar
OPP: Update _read_freq() to return the correct frequency
Now that we support finding indexed frequencies, lets update _read_freq() to return the right one.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
show more ...
|
#
a5893928 |
| 21-Jul-2023 |
Viresh Kumar <viresh.kumar@linaro.org> |
OPP: Add dev_pm_opp_find_freq_exact_indexed()
The indexed version of the API is added for other floor and ceil, add the same for exact as well for completeness.
Signed-off-by: Viresh Kumar <viresh.
OPP: Add dev_pm_opp_find_freq_exact_indexed()
The indexed version of the API is added for other floor and ceil, add the same for exact as well for completeness.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
show more ...
|
#
5f756d03 |
| 20-Jul-2023 |
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> |
OPP: Introduce dev_pm_opp_get_freq_indexed() API
In the case of devices with multiple clocks, drivers need to specify the frequency index for the OPP framework to get the specific frequency within t
OPP: Introduce dev_pm_opp_get_freq_indexed() API
In the case of devices with multiple clocks, drivers need to specify the frequency index for the OPP framework to get the specific frequency within the required OPP. So let's introduce the dev_pm_opp_get_freq_indexed() API accepting the frequency index as an argument.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> [ Viresh: Fixed potential access to NULL opp pointer ] Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
show more ...
|
#
142e17c1 |
| 20-Jul-2023 |
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> |
OPP: Introduce dev_pm_opp_find_freq_{ceil/floor}_indexed() APIs
In the case of devices with multiple clocks, drivers need to specify the clock index for the OPP framework to find the OPP correspondi
OPP: Introduce dev_pm_opp_find_freq_{ceil/floor}_indexed() APIs
In the case of devices with multiple clocks, drivers need to specify the clock index for the OPP framework to find the OPP corresponding to the floor/ceil of the supplied frequency. So let's introduce the two new APIs accepting the clock index as an argument.
These APIs use the exising _find_key_ceil() helper by supplying the clock index to it.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> [ Viresh: Rearranged definitions in pm_opp.h ] Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
show more ...
|
Revision tags: v6.1.39, v6.1.38, v6.1.37, v6.1.36, v6.4, v6.1.35 |
|
#
7c41cdcd |
| 14-Jun-2023 |
Viresh Kumar <viresh.kumar@linaro.org> |
OPP: Simplify the over-designed pstate <-> level dance
While adding support for "performance states" in the OPP and genpd core, it was decided to set the `pstate` field via genpd's pm_genpd_opp_to_p
OPP: Simplify the over-designed pstate <-> level dance
While adding support for "performance states" in the OPP and genpd core, it was decided to set the `pstate` field via genpd's pm_genpd_opp_to_performance_state() helper, to allow platforms to set `pstate` even if they don't have a corresponding `level` field in the DT OPP tables (More details are present in commit 6e41766a6a50 ("PM / Domain: Implement of_genpd_opp_to_performance_state()")).
Revisiting that five years later clearly suggests that it was over-designed as all current users are eventually using the `level` value only.
The previous commit already added necessary checks to make sure pstate is only used for genpd tables. Lets now simplify this a little, and use `level` directly and remove `pstate` field altogether.
Suggested-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
show more ...
|
#
84cb7ff3 |
| 14-Jun-2023 |
Viresh Kumar <viresh.kumar@linaro.org> |
OPP: pstate is only valid for genpd OPP tables
It is not very clear right now that the `pstate` field is only valid for genpd OPP tables and not consumer tables. And there is no checking for the sam
OPP: pstate is only valid for genpd OPP tables
It is not very clear right now that the `pstate` field is only valid for genpd OPP tables and not consumer tables. And there is no checking for the same at various places.
Add checks in place to verify that and make it clear to the reader.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Reviewed-by: Bjorn Andersson <quic_bjorande@quicinc.com> Tested-by: Bjorn Andersson <quic_bjorande@quicinc.com>
show more ...
|
Revision tags: v6.1.34 |
|
#
04bd2eaf |
| 14-Jun-2023 |
Viresh Kumar <viresh.kumar@linaro.org> |
OPP: don't drop performance constraint on OPP table removal
This code was added (long back) by commit 009acd196fc8 ("PM / OPP: Support updating performance state of device's power domain") and at th
OPP: don't drop performance constraint on OPP table removal
This code was added (long back) by commit 009acd196fc8 ("PM / OPP: Support updating performance state of device's power domain") and at that time the `opp->pstate` field was used to store the performance state required by a device's OPP.
Over time that changed and the `->pstate` field is now used only for genpd devices and consumer devices access that via the required-opps instead.
Because of all these changes, _opp_table_kref_release() now drops the constraint only when the genpd's OPP table gets freed and not the device's. Which is definitely not what we wanted. And dropping the constraint doesn't have much meaning as the genpd itself is going away.
Moreover, if we want to drop constraints here, then just dropping the performance constraint alone isn't sufficient as there are other resource constraints like clk, regulator, etc. too, which must be handled.
Probably the right thing to do here is to leave this decision to the consumers, which can call `dev_pm_opp_set_rate(dev, 0)` or similar APIs to drop all constraints properly. Which many of the consumers already do.
Remove the special code, which is broken anyway.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
show more ...
|
Revision tags: v6.1.33 |
|
#
167eb2bd |
| 08-Jun-2023 |
Viresh Kumar <viresh.kumar@linaro.org> |
OPP: Staticize `lazy_opp_tables` in of.c
`lazy_opp_tables` is only used in of.c, move it there and mark it `static`.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
|
Revision tags: v6.1.32 |
|
#
b2a2ab03 |
| 30-May-2023 |
Stephan Gerhold <stephan.gerhold@kernkonzept.com> |
opp: Fix use-after-free in lazy_opp_tables after probe deferral
When dev_pm_opp_of_find_icc_paths() in _allocate_opp_table() returns -EPROBE_DEFER, the opp_table is freed again, to wait until all th
opp: Fix use-after-free in lazy_opp_tables after probe deferral
When dev_pm_opp_of_find_icc_paths() in _allocate_opp_table() returns -EPROBE_DEFER, the opp_table is freed again, to wait until all the interconnect paths are available.
However, if the OPP table is using required-opps then it may already have been added to the global lazy_opp_tables list. The error path does not remove the opp_table from the list again.
This can cause crashes later when the provider of the required-opps is added, since we will iterate over OPP tables that have already been freed. E.g.:
Unable to handle kernel NULL pointer dereference when read CPU: 0 PID: 7 Comm: kworker/0:0 Not tainted 6.4.0-rc3 PC is at _of_add_opp_table_v2 (include/linux/of.h:949 drivers/opp/of.c:98 drivers/opp/of.c:344 drivers/opp/of.c:404 drivers/opp/of.c:1032) -> lazy_link_required_opp_table()
Fix this by calling _of_clear_opp_table() to remove the opp_table from the list and clear other allocated resources. While at it, also add the missing mutex_destroy() calls in the error path.
Cc: stable@vger.kernel.org Suggested-by: Viresh Kumar <viresh.kumar@linaro.org> Fixes: 7eba0c7641b0 ("opp: Allow lazy-linking of required-opps") Signed-off-by: Stephan Gerhold <stephan.gerhold@kernkonzept.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
show more ...
|
Revision tags: v6.1.31, v6.1.30 |
|
#
9e28f7a7 |
| 20-May-2023 |
Adrián Larumbe <adrian.larumbe@collabora.com> |
OPP: rate-limit debug messages when no change in OPP is required
Otherwise, when enabling a debug build and dynamic debug in the kernel, it quickly floods the kernel ring buffer and makes debugging
OPP: rate-limit debug messages when no change in OPP is required
Otherwise, when enabling a debug build and dynamic debug in the kernel, it quickly floods the kernel ring buffer and makes debugging of other subsystems almost impossible, unless manually disabled.
Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
show more ...
|
Revision tags: v6.1.29, v6.1.28, v6.1.27, v6.1.26, v6.3, v6.1.25, v6.1.24, v6.1.23, v6.1.22, v6.1.21, v6.1.20, v6.1.19, v6.1.18, v6.1.17, v6.1.16, v6.1.15, v6.1.14, v6.1.13 |
|
#
528f2d8d |
| 22-Feb-2023 |
Viresh Kumar <viresh.kumar@linaro.org> |
OPP: Move required opps configuration to specialized callback
The required-opps configuration is closely tied to genpd and performance states at the moment and it is not very obvious that required-o
OPP: Move required opps configuration to specialized callback
The required-opps configuration is closely tied to genpd and performance states at the moment and it is not very obvious that required-opps can live without genpds. Though we don't support configuring required-opps for non-genpd cases currently.
This commit aims at separating these parts, where configuring genpds would be a special case of configuring the required-opps.
Add a specialized callback, set_required_opps(), to the opp table and set it to different callbacks accordingly.
This shouldn't result in any functional changes for now.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
show more ...
|
#
29b1a92e |
| 22-Feb-2023 |
Viresh Kumar <viresh.kumar@linaro.org> |
OPP: Handle all genpd cases together in _set_required_opps()
There is no real need of keeping separate code for single genpd case, it can be made to work with a simple change.
Signed-off-by: Viresh
OPP: Handle all genpd cases together in _set_required_opps()
There is no real need of keeping separate code for single genpd case, it can be made to work with a simple change.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
show more ...
|
Revision tags: v6.2, v6.1.12, v6.1.11, v6.1.10, v6.1.9, v6.1.8, v6.1.7, v6.1.6, v6.1.5, v6.0.19, v6.0.18, v6.1.4, v6.1.3, v6.0.17, v6.1.2, v6.0.16, v6.1.1, v6.0.15, v6.0.14, v6.0.13, v6.1, v6.0.12, v6.0.11, v6.0.10, v5.15.80, v6.0.9, v5.15.79, v6.0.8, v5.15.78, v6.0.7, v5.15.77, v5.15.76, v6.0.6, v6.0.5, v5.15.75, v6.0.4, v6.0.3, v6.0.2, v5.15.74, v5.15.73, v6.0.1, v5.15.72, v6.0, v5.15.71, v5.15.70, v5.15.69, v5.15.68, v5.15.67, v5.15.66, v5.15.65, v5.15.64, v5.15.63, v5.15.62, v5.15.61 |
|
#
d36cb843 |
| 15-Aug-2022 |
Christophe JAILLET <christophe.jaillet@wanadoo.fr> |
OPP: Fix an un-initialized variable usage
smatch complains that 'ret' may be returned un-initialized.
Explicitly return 0 if we reach the end of the function (should 'opp_table->clk_count' be 0).
OPP: Fix an un-initialized variable usage
smatch complains that 'ret' may be returned un-initialized.
Explicitly return 0 if we reach the end of the function (should 'opp_table->clk_count' be 0).
Fixes: 8174a3a613af ("OPP: Provide a simple implementation to configure multiple clocks") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
show more ...
|
Revision tags: v5.15.60, v5.15.59, v5.19, v5.15.58, v5.15.57, v5.15.56 |
|
#
3466ea2c |
| 18-Jul-2022 |
Liang He <windhl@126.com> |
OPP: Don't drop opp->np reference while it is still in use
The struct dev_pm_opp contains a reference of the DT node, opp->np, throughout its lifetime. We should increase the refcount for the same f
OPP: Don't drop opp->np reference while it is still in use
The struct dev_pm_opp contains a reference of the DT node, opp->np, throughout its lifetime. We should increase the refcount for the same from _opp_add_static_v2(), and drop it while removing the OPP finally.
Signed-off-by: Liang He <windhl@126.com> [ Viresh: Updated subject / commit log, create _of_clear_opp() and drop reference from it] Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
show more ...
|
Revision tags: v5.15.55, v5.15.54, v5.15.53 |
|
#
2f71ae1a |
| 04-Jul-2022 |
Viresh Kumar <viresh.kumar@linaro.org> |
OPP: Allow config_clks helper for single clk case
There is a corner case with Tegra30, where we want to skip clk configuration via dev_pm_opp_set_opp(), but still want the OPP core to read the "opp-
OPP: Allow config_clks helper for single clk case
There is a corner case with Tegra30, where we want to skip clk configuration via dev_pm_opp_set_opp(), but still want the OPP core to read the "opp-hz" property so we can find the right OPP via freq finding helpers.
This is the easiest of the ways to make it work, without any special hacks in the OPP core. Allow config_clks to be passed for single clk case.
Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
show more ...
|
Revision tags: v5.15.52, v5.15.51, v5.15.50, v5.15.49, v5.15.48, v5.15.47 |
|
#
8174a3a6 |
| 10-Jun-2022 |
Viresh Kumar <viresh.kumar@linaro.org> |
OPP: Provide a simple implementation to configure multiple clocks
This provides a simple implementation to configure multiple clocks for a device.
Tested-by: Dmitry Osipenko <dmitry.osipenko@collab
OPP: Provide a simple implementation to configure multiple clocks
This provides a simple implementation to configure multiple clocks for a device.
Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
show more ...
|
#
f123ea74 |
| 09-Jun-2022 |
Viresh Kumar <viresh.kumar@linaro.org> |
OPP: Assert clk_count == 1 for single clk helpers
Many helpers can be safely called only for devices that have a single clk associated with them. Assert the same for those routines.
Tested-by: Dmit
OPP: Assert clk_count == 1 for single clk helpers
Many helpers can be safely called only for devices that have a single clk associated with them. Assert the same for those routines.
Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
show more ...
|
#
e10a4644 |
| 09-Jun-2022 |
Viresh Kumar <viresh.kumar@linaro.org> |
OPP: Add key specific assert() method to key finding helpers
The helpers for the clock key, at least, would need to assert that the helpers are called only for single clock case. Prepare for that by
OPP: Add key specific assert() method to key finding helpers
The helpers for the clock key, at least, would need to assert that the helpers are called only for single clock case. Prepare for that by adding an argument to the key finding helpers.
Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
show more ...
|
#
274c3e83 |
| 05-Jul-2022 |
Viresh Kumar <viresh.kumar@linaro.org> |
OPP: Compare bandwidths for all paths in _opp_compare_key()
Replicate the same behavior as "rates" here and compare all values instead of relying on the first entry alone.
Signed-off-by: Viresh Kum
OPP: Compare bandwidths for all paths in _opp_compare_key()
Replicate the same behavior as "rates" here and compare all values instead of relying on the first entry alone.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
show more ...
|
#
2083da24 |
| 10-Jun-2022 |
Viresh Kumar <viresh.kumar@linaro.org> |
OPP: Allow multiple clocks for a device
This patch adds support to allow multiple clocks for a device.
The design is pretty much similar to how this is done for regulators, and platforms can supply
OPP: Allow multiple clocks for a device
This patch adds support to allow multiple clocks for a device.
The design is pretty much similar to how this is done for regulators, and platforms can supply their own version of the config_clks() callback if they have multiple clocks for their device. The core manages the calls via opp_table->config_clks() eventually.
We have kept both "clk" and "clks" fields in the OPP table structure and the reason is provided as a comment in _opp_set_clknames(). The same isn't done for "rates" though and we use rates[0] at most of the places now.
Co-developed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Tested-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
show more ...
|
Revision tags: v5.15.46, v5.15.45 |
|
#
1efae8d2 |
| 03-Jun-2022 |
Viresh Kumar <viresh.kumar@linaro.org> |
OPP: Make dev_pm_opp_set_opp() independent of frequency
dev_pm_opp_set_opp() can be called for any device, it may or may not have a frequency value associated with it.
If a frequency value isn't av
OPP: Make dev_pm_opp_set_opp() independent of frequency
dev_pm_opp_set_opp() can be called for any device, it may or may not have a frequency value associated with it.
If a frequency value isn't available, we pass 0 to _set_opp(). Make it optional instead by making _set_opp() accept a pointer instead, as the frequency value is anyway available in the OPP. This makes dev_pm_opp_set_opp() and _set_opp() completely independent of any special key value.
Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
show more ...
|