<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/powercap/intel_rapl_common.c, branch v6.3.2</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.3.2</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.3.2'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2023-02-13T16:01:31+00:00</updated>
<entry>
<title>powercap: intel_rapl: Fix handling for large time window</title>
<updated>2023-02-13T16:01:31+00:00</updated>
<author>
<name>Zhang Rui</name>
<email>rui.zhang@intel.com</email>
</author>
<published>2023-02-11T03:17:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cf835b005b2857c2fd763a006c1957f332e5254b'/>
<id>urn:sha1:cf835b005b2857c2fd763a006c1957f332e5254b</id>
<content type='text'>
When setting the power limit time window, software updates the 'y' bits
and 'f' bits in the power limit register, and the value hardware takes
follows the formula below

	Time window = 2 ^ y * (1 + f / 4) * Time_Unit

When handling large time window input from userspace, using left
shifting breaks in two cases:

 1. when ilog2(value) is bigger than 31, in expression "1 &lt;&lt; y", left
    shifting by more than 31 bits has undefined behavior. This breaks
    'y'. For example, on an Alderlake platform, "1 &lt;&lt; 32" returns 1.

 2. when ilog2(value) equals 31, "1 &lt;&lt; 31" returns negative value
    because '1' is recognized as signed int. And this breaks 'f'.

Given that 'y' has 5 bits and hardware can never take a value larger
than 31, fix the first problem by clamp the time window to the maximum
possible value that the hardware can take.

Fix the second problem by using unsigned bit left shift.

Note that hardware has its own maximum time window limitation, which
may be lower than the time window value retrieved from the power limit
register. When this happens, hardware clamps the input to its maximum
time window limitation. That is why a software clamp is preferred to
handle the problem on hand.

Signed-off-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
[ rjw: Adjusted the comment added by this change ]
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>powercap: intel_rapl: add support for Emerald Rapids</title>
<updated>2023-01-20T16:23:56+00:00</updated>
<author>
<name>Zhang Rui</name>
<email>rui.zhang@intel.com</email>
</author>
<published>2023-01-04T14:36:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7adc6885259edd4ef5c9a7a62fd4270cf38fdbfb'/>
<id>urn:sha1:7adc6885259edd4ef5c9a7a62fd4270cf38fdbfb</id>
<content type='text'>
Add Emerald Rapids to the list of supported processor models in the
Intel RAPL power capping driver.

Signed-off-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>powercap: intel_rapl: add support for Meteor Lake</title>
<updated>2023-01-20T16:23:56+00:00</updated>
<author>
<name>Zhang Rui</name>
<email>rui.zhang@intel.com</email>
</author>
<published>2023-01-04T14:36:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bdaad038cc3c620a769f2156e7c9aab8605411c2'/>
<id>urn:sha1:bdaad038cc3c620a769f2156e7c9aab8605411c2</id>
<content type='text'>
Add Meteor Lake to the list of supported processor models in the
Intel RAPL power capping driver.

Signed-off-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>powercap: intel_rapl: Use standard Energy Unit for SPR Dram RAPL domain</title>
<updated>2022-09-24T17:32:46+00:00</updated>
<author>
<name>Zhang Rui</name>
<email>rui.zhang@intel.com</email>
</author>
<published>2022-09-24T05:47:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4c081324df5608b73428662ca54d5221ea03a6bd'/>
<id>urn:sha1:4c081324df5608b73428662ca54d5221ea03a6bd</id>
<content type='text'>
Intel Xeon servers used to use a fixed energy resolution (15.3uj) for
Dram RAPL domain. But on SPR, Dram RAPL domain follows the standard
energy resolution as described in MSR_RAPL_POWER_UNIT.

Remove the SPR dram_domain_energy_unit quirk.

Fixes: 2d798d9f5967 ("powercap: intel_rapl: add support for Sapphire Rapids")
Signed-off-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
Tested-by: Wang Wendy &lt;wendy.wang@intel.com&gt;
Cc: 5.9+ &lt;stable@vger.kernel.org&gt; # 5.9+
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>powercap: intel_rapl: fix UBSAN shift-out-of-bounds issue</title>
<updated>2022-09-21T18:16:15+00:00</updated>
<author>
<name>Chao Qin</name>
<email>chao.qin@intel.com</email>
</author>
<published>2022-09-20T06:08:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2d93540014387d1c73b9ccc4d7895320df66d01b'/>
<id>urn:sha1:2d93540014387d1c73b9ccc4d7895320df66d01b</id>
<content type='text'>
When value &lt; time_unit, the parameter of ilog2() will be zero and
the return value is -1. u64(-1) is too large for shift exponent
and then will trigger shift-out-of-bounds:

shift exponent 18446744073709551615 is too large for 32-bit type 'int'
Call Trace:
 rapl_compute_time_window_core
 rapl_write_data_raw
 set_time_window
 store_constraint_time_window_us

Signed-off-by: Chao Qin &lt;chao.qin@intel.com&gt;
Acked-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>powercap: intel_rapl: Add support for RAPTORLAKE_S</title>
<updated>2022-09-03T18:20:55+00:00</updated>
<author>
<name>Zhang Rui</name>
<email>rui.zhang@intel.com</email>
</author>
<published>2022-08-30T03:01:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0d7a23b5f8e162bf2c5caab06f5df4aee2619073'/>
<id>urn:sha1:0d7a23b5f8e162bf2c5caab06f5df4aee2619073</id>
<content type='text'>
Add intel_rapl support for RAPTORLAKE_S platform, which behaves the same
as RAPTORLAKE and RAPTORLAKE_P platforms.

Signed-off-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>powercap: intel_rapl: Add support for RAPTORLAKE_P</title>
<updated>2022-07-05T18:59:20+00:00</updated>
<author>
<name>George D Sworo</name>
<email>george.d.sworo@intel.com</email>
</author>
<published>2022-06-01T19:22:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2755714656d0f2f41adfe231f3865e72da2cbe39'/>
<id>urn:sha1:2755714656d0f2f41adfe231f3865e72da2cbe39</id>
<content type='text'>
Add RAPTORLAKE_P to the list of supported processor models in the Intel
RAPL power capping driver.

Signed-off-by: George D Sworo &lt;george.d.sworo@intel.com&gt;
Acked-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
Tested-by: Sumeet Pawnikar &lt;sumeet.r.pawnikar@intel.com&gt;
[ rjw: Minor changelog edits ]
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>powercap: intel_rapl: remove redundant store to value after multiply</title>
<updated>2022-05-19T17:48:17+00:00</updated>
<author>
<name>Colin Ian King</name>
<email>colin.i.king@gmail.com</email>
</author>
<published>2022-05-18T08:45:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=59cafa728c373551423d67a1369289a717006a4b'/>
<id>urn:sha1:59cafa728c373551423d67a1369289a717006a4b</id>
<content type='text'>
There is no need to store the result of the multiply back to variable value
after the multiplication. The store is redundant, replace *= with just *.

Cleans up clang scan build warning:
warning: Although the value stored to 'value' is used in the enclosing
expression, the value is never actually read from 'value'
[deadcode.DeadStores]

Signed-off-by: Colin Ian King &lt;colin.i.king@gmail.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>powercap: intel_rapl: add support for ALDERLAKE_N</title>
<updated>2022-05-18T18:40:50+00:00</updated>
<author>
<name>Zhang Rui</name>
<email>rui.zhang@intel.com</email>
</author>
<published>2022-05-13T05:00:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f125bdbdd6bd4a88f3697e5850359d3ffe43a3f2'/>
<id>urn:sha1:f125bdbdd6bd4a88f3697e5850359d3ffe43a3f2</id>
<content type='text'>
Add ALDERLAKE_N to the list of supported processor models in the Intel
RAPL power capping driver.

Signed-off-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
[ rjw: Changelog ]
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>powercap: intel_rapl: add support for RaptorLake</title>
<updated>2022-04-22T14:39:39+00:00</updated>
<author>
<name>Zhang Rui</name>
<email>rui.zhang@intel.com</email>
</author>
<published>2022-04-21T15:07:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ae0dc7ed1a7c713ee9ba563a328d3b4d59223d7c'/>
<id>urn:sha1:ae0dc7ed1a7c713ee9ba563a328d3b4d59223d7c</id>
<content type='text'>
Add intel_rapl support for the RaptorLake platform.

Signed-off-by: Zhang Rui &lt;rui.zhang@intel.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
</feed>
