<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/opp/core.c, branch v6.17</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.17</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.17'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2025-05-19T10:07:53Z</updated>
<entry>
<title>OPP: switch to use kmemdup_array()</title>
<updated>2025-05-19T10:07:53Z</updated>
<author>
<name>Zhang Enpei</name>
<email>zhang.enpei@zte.com.cn</email>
</author>
<published>2025-05-15T12:13:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=03eadcbd981b4c9b10ec89a046deeccb115c98b3'/>
<id>urn:sha1:03eadcbd981b4c9b10ec89a046deeccb115c98b3</id>
<content type='text'>
Use kmemdup_array() to avoid multiplication and possible overflows.

Signed-off-by: Zhang Enpei &lt;zhang.enpei@zte.com.cn&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>OPP: Use mutex locking guards</title>
<updated>2025-05-02T05:25:52Z</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2025-04-24T08:45:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ff9c512041f2b405536640374ae3a3fe10efaf8b'/>
<id>urn:sha1:ff9c512041f2b405536640374ae3a3fe10efaf8b</id>
<content type='text'>
Use mutex locking guard in the OPP core.

No intentional functional impact.

Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>OPP: Define and use scope-based cleanup helpers</title>
<updated>2025-05-02T05:25:40Z</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2025-04-23T08:51:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8c5d8c0b9e8184a86baede72ca392f90d867d22e'/>
<id>urn:sha1:8c5d8c0b9e8184a86baede72ca392f90d867d22e</id>
<content type='text'>
Define and use scope-based cleanup helpers for `struct opp` and `struct
opp_table`.

No intentional functional impact.

Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>OPP: Return opp_table from dev_pm_opp_get_opp_table_ref()</title>
<updated>2025-04-24T10:35:56Z</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2025-04-23T10:18:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ead694941686345bfd3f95100d889191cb9e3cda'/>
<id>urn:sha1:ead694941686345bfd3f95100d889191cb9e3cda</id>
<content type='text'>
For convenience of users, return back the pointer to the opp_table from
dev_pm_opp_get_opp_table_ref(), so they can do:

	opp_table = dev_pm_opp_get_opp_table_ref(tmp_table);

No intentional functional impact.

Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>OPP: Return opp from dev_pm_opp_get()</title>
<updated>2025-04-24T10:35:53Z</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2025-04-23T10:18:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7a3be00771aa9786c7bb4cdb0ee36fee45f67d69'/>
<id>urn:sha1:7a3be00771aa9786c7bb4cdb0ee36fee45f67d69</id>
<content type='text'>
For convenience of users, return back the pointer to the opp from
dev_pm_opp_get(), so they can do:

	opp = dev_pm_opp_get(tmp_opp);

No intentional functional impact.

Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>OPP: Remove _get_opp_table_kref()</title>
<updated>2025-04-24T10:35:33Z</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2025-04-24T08:51:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4cb1383f9522a3d2f5e26b70688417187c7d48e4'/>
<id>urn:sha1:4cb1383f9522a3d2f5e26b70688417187c7d48e4</id>
<content type='text'>
Use dev_pm_opp_get_opp_table_ref() directly instead.

No intentional functional impact.

Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>PM / OPP: Add reference counting helpers for Rust implementation</title>
<updated>2025-01-20T03:35:51Z</updated>
<author>
<name>Viresh Kumar</name>
<email>viresh.kumar@linaro.org</email>
</author>
<published>2024-01-09T06:27:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b489e7946656ed67fea1a30f5103eb62a8686e04'/>
<id>urn:sha1:b489e7946656ed67fea1a30f5103eb62a8686e04</id>
<content type='text'>
To ensure that resources such as OPP tables or OPP nodes are not freed
while in use by the Rust implementation, it is necessary to increment
their reference count from Rust code.

This commit introduces a new helper function,
dev_pm_opp_get_opp_table_ref(), to increment the reference count of an
OPP table and declares the existing helper dev_pm_opp_get() in pm_opp.h.

Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>OPP: fix dev_pm_opp_find_bw_*() when bandwidth table not initialized</title>
<updated>2024-12-23T10:57:24Z</updated>
<author>
<name>Neil Armstrong</name>
<email>neil.armstrong@linaro.org</email>
</author>
<published>2024-12-03T08:13:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b44b9bc7cab2967c3d6a791b1cd542c89fc07f0e'/>
<id>urn:sha1:b44b9bc7cab2967c3d6a791b1cd542c89fc07f0e</id>
<content type='text'>
If a driver calls dev_pm_opp_find_bw_ceil/floor() the retrieve bandwidth
from the OPP table but the bandwidth table was not created because the
interconnect properties were missing in the OPP consumer node, the
kernel will crash with:

Unable to handle kernel NULL pointer dereference at virtual address 0000000000000004
...
pc : _read_bw+0x8/0x10
lr : _opp_table_find_key+0x9c/0x174
...
Call trace:
  _read_bw+0x8/0x10 (P)
  _opp_table_find_key+0x9c/0x174 (L)
  _find_key+0x98/0x168
  dev_pm_opp_find_bw_ceil+0x50/0x88
...

In order to fix the crash, create an assert function to check
if the bandwidth table was created before trying to get a
bandwidth with _read_bw().

Fixes: add1dc094a74 ("OPP: Use generic key finding helpers for bandwidth key")
Signed-off-by: Neil Armstrong &lt;neil.armstrong@linaro.org&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>OPP: add index check to assert to avoid buffer overflow in _read_freq()</title>
<updated>2024-12-23T10:57:23Z</updated>
<author>
<name>Neil Armstrong</name>
<email>neil.armstrong@linaro.org</email>
</author>
<published>2024-12-03T08:12:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d659bc68ed489022ea33342cfbda2911a81e7a0d'/>
<id>urn:sha1:d659bc68ed489022ea33342cfbda2911a81e7a0d</id>
<content type='text'>
Pass the freq index to the assert function to make sure
we do not read a freq out of the opp-&gt;rates[] table when called
from the indexed variants:
dev_pm_opp_find_freq_exact_indexed() or
dev_pm_opp_find_freq_ceil/floor_indexed().

Add a secondary parameter to the assert function, unused
for assert_single_clk() then add assert_clk_index() which
will check for the clock index when called from the _indexed()
find functions.

Fixes: 142e17c1c2b4 ("OPP: Introduce dev_pm_opp_find_freq_{ceil/floor}_indexed() APIs")
Fixes: a5893928bb17 ("OPP: Add dev_pm_opp_find_freq_exact_indexed()")
Signed-off-by: Neil Armstrong &lt;neil.armstrong@linaro.org&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
<entry>
<title>opp: core: Fix off by one in dev_pm_opp_get_bw()</title>
<updated>2024-12-23T10:57:23Z</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@linaro.org</email>
</author>
<published>2024-11-30T10:07:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=402074f0105e93154409e4a86c02d09e5199d9a5'/>
<id>urn:sha1:402074f0105e93154409e4a86c02d09e5199d9a5</id>
<content type='text'>
The "opp-&gt;bandwidth" array has "opp-&gt;opp_table-&gt;path_count" number of
elements.  It's allocated in _opp_allocate().  So this &gt; needs to be &gt;=
to prevent an out of bounds access.

Fixes: d78653dcd8bf ("opp: core: implement dev_pm_opp_get_bw")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@linaro.org&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
</content>
</entry>
</feed>
