<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/cpufreq/intel_pstate.c, branch linux-4.4.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.4.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.4.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2019-03-23T07:44:21Z</updated>
<entry>
<title>cpufreq: Use struct kobj_attribute instead of struct global_attr</title>
<updated>2019-03-23T07:44:21Z</updated>
<author>
<name>Viresh Kumar</name>
</author>
<published>2019-01-25T07:23:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c8d66722d84b7d543073edf3459e024869b706e3'/>
<id>urn:sha1:c8d66722d84b7d543073edf3459e024869b706e3</id>
<content type='text'>
commit 625c85a62cb7d3c79f6e16de3cfa972033658250 upstream.

The cpufreq_global_kobject is created using kobject_create_and_add()
helper, which assigns the kobj_type as dynamic_kobj_ktype and show/store
routines are set to kobj_attr_show() and kobj_attr_store().

These routines pass struct kobj_attribute as an argument to the
show/store callbacks. But all the cpufreq files created using the
cpufreq_global_kobject expect the argument to be of type struct
attribute. Things work fine currently as no one accesses the "attr"
argument. We may not see issues even if the argument is used, as struct
kobj_attribute has struct attribute as its first element and so they
will both get same address.

But this is logically incorrect and we should rather use struct
kobj_attribute instead of struct global_attr in the cpufreq core and
drivers and the show/store callbacks should take struct kobj_attribute
as argument instead.

This bug is caught using CFI CLANG builds in android kernel which
catches mismatch in function prototypes for such callbacks.

Reported-by: Donghee Han &lt;dh.han@samsung.com&gt;
Reported-by: Sangkyu Kim &lt;skwith.kim@samsung.com&gt;
Signed-off-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;


</content>
</entry>
<entry>
<title>cpufreq: intel_pstate: Enable HWP by default</title>
<updated>2018-05-26T06:48:54Z</updated>
<author>
<name>Srinivas Pandruvada</name>
</author>
<published>2016-02-25T23:09:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f5a80c5d9ca98045bae32ef29a9ab031066047ba'/>
<id>urn:sha1:f5a80c5d9ca98045bae32ef29a9ab031066047ba</id>
<content type='text'>
commit 7791e4aa59ad724e0b4c8b4dea547a5735108972 upstream.

If the processor supports HWP, enable it by default without checking
for the cpu model. This will allow to enable HWP in all supported
processors without driver change.

Signed-off-by: Srinivas Pandruvada &lt;srinivas.pandruvada@linux.intel.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Thomas Renninger &lt;trenn@suse.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>cpufreq: intel_pstate: Fix unsafe HWP MSR access</title>
<updated>2016-10-28T07:01:26Z</updated>
<author>
<name>Srinivas Pandruvada</name>
</author>
<published>2016-10-08T19:42:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d756b52c8bbe7735cc881dab46378518d2d4b1f1'/>
<id>urn:sha1:d756b52c8bbe7735cc881dab46378518d2d4b1f1</id>
<content type='text'>
commit f9f4872df6e1801572949f8a370c886122d4b6da upstream.

This is a requirement that MSR MSR_PM_ENABLE must be set to 0x01 before
reading MSR_HWP_CAPABILITIES on a given CPU. If cpufreq init() is
scheduled on a CPU which is not same as policy-&gt;cpu or migrates to a
different CPU before calling msr read for MSR_HWP_CAPABILITIES, it
is possible that MSR_PM_ENABLE was not to set to 0x01 on that CPU.
This will cause GP fault. So like other places in this path
rdmsrl_on_cpu should be used instead of rdmsrl.

Moreover the scope of MSR_HWP_CAPABILITIES is on per thread basis, so it
should be read from the same CPU, for which MSR MSR_HWP_REQUEST is
getting set.

dmesg dump or warning:

[   22.014488] WARNING: CPU: 139 PID: 1 at arch/x86/mm/extable.c:50 ex_handler_rdmsr_unsafe+0x68/0x70
[   22.014492] unchecked MSR access error: RDMSR from 0x771
[   22.014493] Modules linked in:
[   22.014507] CPU: 139 PID: 1 Comm: swapper/0 Not tainted 4.7.5+ #1
...
...
[   22.014516] Call Trace:
[   22.014542]  [&lt;ffffffff813d7dd1&gt;] dump_stack+0x63/0x82
[   22.014558]  [&lt;ffffffff8107bc8b&gt;] __warn+0xcb/0xf0
[   22.014561]  [&lt;ffffffff8107bcff&gt;] warn_slowpath_fmt+0x4f/0x60
[   22.014563]  [&lt;ffffffff810676f8&gt;] ex_handler_rdmsr_unsafe+0x68/0x70
[   22.014564]  [&lt;ffffffff810677d9&gt;] fixup_exception+0x39/0x50
[   22.014604]  [&lt;ffffffff8102e400&gt;] do_general_protection+0x80/0x150
[   22.014610]  [&lt;ffffffff817f9ec8&gt;] general_protection+0x28/0x30
[   22.014635]  [&lt;ffffffff81687940&gt;] ? get_target_pstate_use_performance+0xb0/0xb0
[   22.014642]  [&lt;ffffffff810600c7&gt;] ? native_read_msr+0x7/0x40
[   22.014657]  [&lt;ffffffff81688123&gt;] intel_pstate_hwp_set+0x23/0x130
[   22.014660]  [&lt;ffffffff81688406&gt;] intel_pstate_set_policy+0x1b6/0x340
[   22.014662]  [&lt;ffffffff816829bb&gt;] cpufreq_set_policy+0xeb/0x2c0
[   22.014664]  [&lt;ffffffff81682f39&gt;] cpufreq_init_policy+0x79/0xe0
[   22.014666]  [&lt;ffffffff81682cb0&gt;] ? cpufreq_update_policy+0x120/0x120
[   22.014669]  [&lt;ffffffff816833a6&gt;] cpufreq_online+0x406/0x820
[   22.014671]  [&lt;ffffffff8168381f&gt;] cpufreq_add_dev+0x5f/0x90
[   22.014717]  [&lt;ffffffff81530ac8&gt;] subsys_interface_register+0xb8/0x100
[   22.014719]  [&lt;ffffffff816821bc&gt;] cpufreq_register_driver+0x14c/0x210
[   22.014749]  [&lt;ffffffff81fe1d90&gt;] intel_pstate_init+0x39d/0x4d5
[   22.014751]  [&lt;ffffffff81fe13f2&gt;] ? cpufreq_gov_dbs_init+0x12/0x12

Signed-off-by: Srinivas Pandruvada &lt;srinivas.pandruvada@linux.intel.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>intel_pstate: Fix MSR_CONFIG_TDP_x addressing in core_get_max_pstate()</title>
<updated>2016-08-20T16:09:18Z</updated>
<author>
<name>Jan Kiszka</name>
</author>
<published>2016-07-08T18:42:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=695c69bf304d7874e0b918684818711f0d7830f9'/>
<id>urn:sha1:695c69bf304d7874e0b918684818711f0d7830f9</id>
<content type='text'>
commit 5fc8f707a2aa40c767c3a338738b9b6fcd151ac1 upstream.

If MSR_CONFIG_TDP_CONTROL is locked, we currently try to address some
MSR 0x80000648 or so. Mask out the relevant level bits 0 and 1.

Found while running over the Jailhouse hypervisor which became upset
about this strange MSR index.

Signed-off-by: Jan Kiszka &lt;jan.kiszka@siemens.com&gt;
Acked-by: Srinivas Pandruvada &lt;srinivas.pandruvada@linux.intel.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>cpufreq: intel_pstate: Fix processing for turbo activation ratio</title>
<updated>2016-05-04T21:48:44Z</updated>
<author>
<name>Srinivas Pandruvada</name>
</author>
<published>2016-04-23T02:53:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=61fe67520c4394c90f688c61c5c16dd63824cd42'/>
<id>urn:sha1:61fe67520c4394c90f688c61c5c16dd63824cd42</id>
<content type='text'>
commit 1becf03545a0859ceaaf9e8c2d9861882a71cb01 upstream.

When the config TDP level is not nominal (level = 0), the MSR values for
reading level 1 and level 2 ratios contain power in low 14 bits and actual
ratio bits are at bits [23:16]. The current processing for level 1 and
level 2 is wrong as there is no shift done to get actual ratio.

Fixes: 6a35fc2d6c22 (cpufreq: intel_pstate: get P1 from TAR when available)
Signed-off-by: Srinivas Pandruvada &lt;srinivas.pandruvada@linux.intel.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>cpufreq: intel_pstate: Minor cleanup for FRAC_BITS</title>
<updated>2015-12-12T01:28:19Z</updated>
<author>
<name>Prarit Bhargava</name>
</author>
<published>2015-12-08T18:44:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=88b7b7c0c2ba2c1f2c589ee883050717fe91af22'/>
<id>urn:sha1:88b7b7c0c2ba2c1f2c589ee883050717fe91af22</id>
<content type='text'>
785ee27 ("cpufreq: intel_pstate: Fix limits-&gt;max_perf rounding error")
hardcodes the value of FRAC_BITS.  This patch fixes that minor issue.

Fixes: 785ee2788141 (cpufreq: intel_pstate: Fix limits-&gt;max_perf rounding error)
Signed-off-by: Prarit Bhargava &lt;prarit@redhat.com&gt;
Acked-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>intel_pstate: Fix "performance" mode behavior with HWP enabled</title>
<updated>2015-11-25T22:37:44Z</updated>
<author>
<name>Alexandra Yates</name>
</author>
<published>2015-11-18T22:58:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=584ee3dcb1d6232857c1e38bb28d9f6bf0ec89f5'/>
<id>urn:sha1:584ee3dcb1d6232857c1e38bb28d9f6bf0ec89f5</id>
<content type='text'>
If hardware-driven P-state selection (HWP) is enabled, the
"performance" mode of intel_pstate should only allow the processor
to use the highest-performance P-state available.  That is not
the case currently, so make it actually happen.

Acked-by: Srinivas Pandruvada &lt;srinivas.pandruvada@linux.intel.com&gt;
Signed-off-by: Alexandra Yates &lt;alexandra.yates@linux.intel.com&gt;
[ rjw: Subject and changelog ]
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>cpufreq: intel_pstate: Fix limits-&gt;max_perf rounding error</title>
<updated>2015-11-23T22:15:34Z</updated>
<author>
<name>Prarit Bhargava</name>
</author>
<published>2015-11-20T23:47:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=785ee27881411bd971d5e37a7fd72a5063fc1237'/>
<id>urn:sha1:785ee27881411bd971d5e37a7fd72a5063fc1237</id>
<content type='text'>
A rounding error was found in the calculation of limits-&gt;max_perf
in intel_pstate_set_policy(), which is used to calculate the max and min
pstate values in intel_pstate_get_min_max().  In that code,
limits-&gt;max_perf is truncated to 2 hex digits such that, for example,
0x169 was incorrectly calculated to 0x16 instead of 0x17.  This resulted in
the pstate being set one level too low.  This patch rounds the value of
limits-&gt;max_perf up instead of down so that the correct max pstate can
be reached.

Signed-off-by: Prarit Bhargava &lt;prarit@redhat.com&gt;
Acked-by: Srinivas Pandruvada &lt;srinivas.pandruvada@linux.intel.com&gt;
Acked-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>cpufreq: intel_pstate: Fix limits-&gt;max_policy_pct rounding error</title>
<updated>2015-11-23T22:14:10Z</updated>
<author>
<name>Prarit Bhargava</name>
</author>
<published>2015-11-20T23:47:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8478f53946f01b8365a206ac58a2640e3e408fb2'/>
<id>urn:sha1:8478f53946f01b8365a206ac58a2640e3e408fb2</id>
<content type='text'>
I have a Intel (6,63) processor with a "marketing" frequency (from
/proc/cpuinfo) of 2100MHz, and a max turbo frequency of 2600MHz.  I
can execute

cpupower frequency-set -g powersave --min 1200MHz --max 2100MHz

and the max_freq_pct is set to 80.  When adding load to the system I noticed
that the cpu frequency only reached 2000MHZ and not 2100MHz as expected.

This is because limits-&gt;max_policy_pct is calculated as 2100 * 100 /2600 = 80.7
and is rounded down to 80 when it should be rounded up to 81.  This patch
adds a DIV_ROUND_UP() which will return the correct value.

Signed-off-by: Prarit Bhargava &lt;prarit@redhat.com&gt;
Acked-by: Srinivas Pandruvada &lt;srinivas.pandruvada@linux.intel.com&gt;
Acked-by: Viresh Kumar &lt;viresh.kumar@linaro.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
<entry>
<title>cpufreq: intel_pstate: Add separate support for Airmont cores</title>
<updated>2015-11-18T23:21:46Z</updated>
<author>
<name>Philippe Longepe</name>
</author>
<published>2015-11-10T01:40:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1421df63c3cf956c69c26ac9660c6e223eeed980'/>
<id>urn:sha1:1421df63c3cf956c69c26ac9660c6e223eeed980</id>
<content type='text'>
There are two flavors of Atom cores to be supported by intel_pstate,
Silvermont and Airmont, so make the driver distinguish between them by
adding separate frequency tables.

Separate the CPU defaults params for each of them and match the CPU IDs
against them as appropriate.

Signed-off-by: Philippe Longepe &lt;philippe.longepe@linux.intel.com&gt;
Signed-off-by: Stephane Gasparini &lt;stephane.gasparini@linux.intel.com&gt;
Acked-by: Srinivas Pandruvada &lt;srinivas.pandruvada@linux.intel.com&gt;
[ rjw: Subject and changelog ]
Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
</content>
</entry>
</feed>
