<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/opp/opp.h, branch v5.15.7</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v5.15.7</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v5.15.7'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2021-03-12T03:56:52+00:00</updated>
<entry>
<title>opp: Don't drop extra references to OPPs accidentally</title>
<updated>2021-03-12T03:56:52+00:00</updated>
<author>
<name>Beata Michalska</name>
<email>beata.michalska@arm.com</email>
</author>
<published>2021-03-04T15:07:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=606a5d4227e4610399c61086ac55c46068a90b03'/>
<id>urn:sha1:606a5d4227e4610399c61086ac55c46068a90b03</id>
<content type='text'>
We are required to call dev_pm_opp_put() from outside of the
opp_table-&gt;lock as debugfs removal needs to happen lock-less to avoid
circular dependency issues.

commit cf1fac943c63 ("opp: Reduce the size of critical section in
_opp_kref_release()") tried to fix that introducing a new routine
_opp_get_next() which keeps returning OPPs that can be freed by the
callers and this routine shall be called without holding the
opp_table-&gt;lock.

Though the commit overlooked the fact that the OPPs can be referenced by
other users as well and this routine will end up dropping references
which were taken by other users and hence freeing the OPPs prematurely.

In effect, other users of the OPPs will end up having invalid pointers
at hand. We didn't see any crash reports earlier as the exact situation
never happened, though it is certainly possible.

We need a way to mark which OPPs are no longer referenced by the OPP
core, so we don't drop extra references to them accidentally.

This commit adds another OPP flag, "removed", which is used to track
this. And now we should never end up dropping extra references to the
OPPs.

Cc: v5.11+ &lt;stable@vger.kernel.org&gt; # v5.11+
Fixes: cf1fac943c63 ("opp: Reduce the size of critical section in _opp_kref_release()")
Signed-off-by: Beata Michalska &lt;beata.michalska@arm.com&gt;
[ Viresh: Almost rewrote entire patch, added new "removed" field,
	  rewrote commit log and added the correct Fixes tag. ]
Co-developed-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>opp: Don't skip freq update for different frequency</title>
<updated>2021-02-18T07:01:08+00:00</updated>
<author>
<name>Jonathan Marek</name>
<email>jonathan@marek.ca</email>
</author>
<published>2021-02-16T20:10:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=de04241ab87afcaac26f15fcc32a7bd27294dd47'/>
<id>urn:sha1:de04241ab87afcaac26f15fcc32a7bd27294dd47</id>
<content type='text'>
We skip the OPP update if the current and target OPPs are same. This is
fine for the devices that don't support frequency but may cause issues
for the ones that need to program frequency.

An OPP entry doesn't really signify a single operating frequency but
rather the highest frequency at which the other properties of the OPP
entry apply. And we may reach here with different frequency values,
while all of them would point to the same OPP entry in the OPP table.

We just need to update the clock frequency in that case, though in order
to not add special exit points we reuse the code flow from a normal
path.

While at it, rearrange the conditionals in the 'if' statement to check
'enabled' flag at the end.

Fixes: 81c4d8a3c414 ("opp: Keep track of currently programmed OPP")
Signed-off-by: Jonathan Marek &lt;jonathan@marek.ca&gt;
[ Viresh: Improved commit log and subject, rename current_freq as
	  current_rate, document it, remove local variable and rearrange
	  code. ]
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>opp: Allow lazy-linking of required-opps</title>
<updated>2021-02-02T05:00:53+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2019-11-25T08:27:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7eba0c7641b0009818e469dbfcdd87a0155ab9d4'/>
<id>urn:sha1:7eba0c7641b0009818e469dbfcdd87a0155ab9d4</id>
<content type='text'>
The OPP core currently requires the required opp tables to be available
before the dependent OPP table is added, as it needs to create links
from the dependent OPP table to the required ones. This may not be
convenient for all the platforms though, as this requires strict
ordering for probing the drivers.

This patch allows lazy-linking of the required-opps. The OPP tables for
which the required-opp-tables aren't available at the time of their
initialization, are added to a special list of OPP tables:
lazy_opp_tables. Later on, whenever a new OPP table is registered with
the OPP core, we check if it is required by an OPP table in the pending
list; if yes, then we complete the linking then and there.

An OPP table is marked unusable until the time all its required-opp
tables are available. And if lazy-linking fails for an OPP table, the
OPP core disables all of its OPPs to make sure no one can use them.

Tested-by: Hsin-Yi Wang &lt;hsinyi@chromium.org&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>opp: Keep track of currently programmed OPP</title>
<updated>2021-02-02T04:57:52+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2021-01-20T10:46:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=81c4d8a3c41488e5491142c31cd7a821ff5d71ec'/>
<id>urn:sha1:81c4d8a3c41488e5491142c31cd7a821ff5d71ec</id>
<content type='text'>
The dev_pm_opp_set_rate() helper needs to know the currently programmed
OPP to make few decisions and currently we try to find it on every
invocation of this routine.

Lets start keeping track of the current_opp programmed for the devices
of the opp table, that will be quite useful going forward.

If we fail to find the current OPP, we pick the first one available in
the list, as the list is in ascending order of frequencies, level, or
bandwidth and that's the best guess we can make anyway.

Note that we used to do the frequency comparison a bit early in
dev_pm_opp_set_rate() previously, and now instead we check the target
opp, which shall be more accurate anyway.

We need to make sure that current_opp's memory doesn't get freed while
it is being used and so we keep a reference of it until the time it is
used.

Now that current_opp will always be set, we can drop some unnecessary
checks as well.

Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Tested-by: Dmitry Osipenko &lt;digetx@gmail.com&gt;
</content>
</entry>
<entry>
<title>opp: Prepare for -&gt;set_opp() helper to work without regulators</title>
<updated>2021-02-02T04:57:39+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2021-01-19T06:28:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=38bb34393804b79eff647bdf96762db5efce392c'/>
<id>urn:sha1:38bb34393804b79eff647bdf96762db5efce392c</id>
<content type='text'>
Until now the -&gt;set_opp() helper (i.e. special implementation for
setting the OPPs for platforms) was implemented only to take care of
multiple regulators case, but going forward we would need that for other
use cases as well.

This patch prepares for that by allocating the regulator specific part
from dev_pm_opp_set_regulators() and the opp helper part from
dev_pm_opp_register_set_opp_helper().

Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Tested-by: Dmitry Osipenko &lt;digetx@gmail.com&gt;
</content>
</entry>
<entry>
<title>opp: Defer acquiring the clk until OPPs are added</title>
<updated>2021-02-02T04:57:20+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2021-01-28T06:35:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=32439ac7535a8eddfa016c62ca66ce33b7df1573'/>
<id>urn:sha1:32439ac7535a8eddfa016c62ca66ce33b7df1573</id>
<content type='text'>
We acquire the clk at the time the OPP table is allocated, though it
works fine, it is not the best place to do so. One of the main reason
being we may need to acquire it again from dev_pm_opp_set_clkname() if
the platform wants another clock to be acquired instead.

There is also requirement from some of the platforms where they do not
want the OPP core to manage the clock at all.

This patch hence defers acquiring the clk until the time we are certain
about which clk we need to acquire and if we really need to acquire one.
With this commit, the clk will get acquired either from
dev_pm_opp_set_clkname() or while we initialize the OPPs within the
table.

Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Tested-by: Dmitry Osipenko &lt;digetx@gmail.com&gt;
</content>
</entry>
<entry>
<title>opp: Staticize _add_opp_table()</title>
<updated>2021-02-02T04:56:58+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2021-01-28T05:38:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d758eaf5f8cbdf2554e34269c75694f60c38745d'/>
<id>urn:sha1:d758eaf5f8cbdf2554e34269c75694f60c38745d</id>
<content type='text'>
_add_opp_table() isn't used outside of core.c, mark it static.

Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>opp: Don't create an OPP table from dev_pm_opp_get_opp_table()</title>
<updated>2020-12-09T05:51:11+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2020-11-06T05:07:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e77dcb0b732dd355ca594909f6c2085dfc46cde2'/>
<id>urn:sha1:e77dcb0b732dd355ca594909f6c2085dfc46cde2</id>
<content type='text'>
It has been found that some users (like cpufreq-dt and others on LKML)
have abused the helper dev_pm_opp_get_opp_table() to create the OPP
table instead of just finding it, which is the wrong thing to do. This
routine was meant for OPP core's internal working and exposed the whole
functionality by mistake.

Change the scope of dev_pm_opp_get_opp_table() to only finding the
table. The internal helpers _opp_get_opp_table*() are thus renamed to
_add_opp_table*(), dev_pm_opp_get_opp_table_indexed() is removed (as we
don't need the index field for finding the OPP table) and so the only
user, genpd, is updated.

Note that the prototype of _add_opp_table() was already left in opp.h by
mistake when it was removed earlier and so we weren't required to add it
now.

Acked-by: Ulf Hansson &lt;ulf.hansson@linaro.org&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'opp/linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm</title>
<updated>2020-10-05T11:31:32+00:00</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2020-10-05T11:31:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=757e282188f0138a06ebf925c950995feb7bd666'/>
<id>urn:sha1:757e282188f0138a06ebf925c950995feb7bd666</id>
<content type='text'>
Pull opertaing performance points (OPP) framework fixes for 5.10-rc1
from Viresh Kumar:

"- Return -EPROBE_DEFER properly from dev_pm_opp_get_opp_table()
   (Stephan Gerhold).

 - Minor cleanups around required-opps (Stephan Gerhold).

 - Extends opp-supported-hw property to contain multiple versions
   (Viresh Kumar).

 - Multiple cleanups around dev_pm_opp_attach_genpd() (Viresh Kumar).

 - Multiple fixes, cleanups in the OPP core for overall better design
   (Viresh Kumar)."

* 'opp/linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm:
  opp: Allow opp-level to be set to 0
  opp: Prevent memory leak in dev_pm_opp_attach_genpd()
  ARM: tegra: Pass multiple versions in opp-supported-hw property
  opp: Allow opp-supported-hw to contain multiple versions
  dt-bindings: opp: Allow opp-supported-hw to contain multiple versions
  opp: Set required OPPs in reverse order when scaling down
  opp: Reduce code duplication in _set_required_opps()
  opp: Drop unnecessary check from dev_pm_opp_attach_genpd()
  opp: Handle multiple calls for same OPP table in _of_add_opp_table_v1()
  opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER
  opp: Remove _dev_pm_opp_find_and_remove_table() wrapper
  opp: Split out _opp_set_rate_zero()
  opp: Reuse the enabled flag in !target_freq path
  opp: Rename regulator_enabled and use it as status of all resources
</content>
</entry>
<entry>
<title>opp: Don't drop reference for an OPP table that was never parsed</title>
<updated>2020-08-31T09:19:47+00:00</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2020-08-31T07:33:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=922ff0759a16299e24cacfc981ac07914d8f1826'/>
<id>urn:sha1:922ff0759a16299e24cacfc981ac07914d8f1826</id>
<content type='text'>
dev_pm_opp_remove_table() should drop a reference to the OPP table only
if the DT OPP table was parsed earlier with a call to
dev_pm_opp_of_add_table() earlier. Else it may end up dropping the
reference to the OPP table, which was added as a result of other calls
like dev_pm_opp_set_clkname(). And would hence result in undesirable
behavior later on when caller would try to free the resource again.

Fixes: 03758d60265c ("opp: Replace list_kref with a local counter")
Reported-by: Naresh Kamboju &lt;naresh.kamboju@linaro.org&gt;
Reported-by: Anders Roxell &lt;anders.roxell@linaro.org&gt;
Tested-by: Naresh Kamboju &lt;naresh.kamboju@linaro.org&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
</feed>
