drm/i915/hwmon: Accept writes of value 0 to power1_max_interval
Subsystems (2)
PATCH 1/1 drm/i915/hwmon: Accept writes of value 0 to power1_max_interval
The value shown by power1_max_interval in millisec is essentially:
((1.x * power(2,y)) * 1000) >> 10
Where x and y are read from a HW register. On ATSM, x and y are 0 on power-up so the value shown is 0.
Writes of 0 to power1_max_interval had previously been disallowed to avoid computing ilog2(0) but this resulted in the corner-case bug below. Therefore allow writes of 0 now but special case that write to x = y = 0.
--- drivers/gpu/drm/i915/i915_hwmon.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_hwmon.c +9 -5
@@ -218,11 +218,15 @@ hwm_power1_max_interval_store(struct device *dev,/* val in hw units */ val =DIV_ROUND_CLOSEST_ULL ((u64 )val << hwmon->scl_shift_time,SF_TIME );/* Convert to 1.x * power(2,y) */ -if (!val) -return -EINVAL ; - y =ilog2 (val); -/* x = (val - (1 << y)) >> (y - 2); */ - x = (val - (1ul << y)) << x_w >> y; +if (!val) { +/* Avoid ilog2(0) */ + y =0 ; + x =0 ; + }else { + y =ilog2 (val); +/* x = (val - (1 << y)) >> (y - 2); */ + x = (val - (1ul << y)) << x_w >> y; + } rxy =REG_FIELD_PREP (PKG_PWR_LIM_1_TIME_X , x) |REG_FIELD_PREP (PKG_PWR_LIM_1_TIME_Y , y);
Signature · 1 line
2.38.0
Patchwork
CI[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/hwmon: Accept writes of value 0 to power1_max_interval
== Series Details ==
== Series Details ==
Series: drm/i915/hwmon: Accept writes of value 0 to power1_max_interval
URL : https://patchwork.freedesktop.org/series/114459/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_12789 -> Patchwork_114459v1
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114459v1/index.html
Participating hosts (38 -> 37)
------------------------------
Missing (1): fi-snb-2520m
Changes
-------
No changes found
Build changes
-------------
* Linux: CI_DRM_12789 -> Patchwork_114459v1
CI-20190529: 20190529
CI_DRM_12789: 8589fd9227ca62484e8599cbd62216230c2c9a64 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7174: 55642b7805d6fc5b987b396c2bbfa46db654db4f @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_114459v1: 8589fd9227ca62484e8599cbd62216230c2c9a64 @ git://anongit.freedesktop.org/gfx-ci/linux
### Linux commits
d1e30cfc6f64 drm/i915/hwmon: Accept writes of value 0 to power1_max_interval
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114459v1/index.html
Patchwork
CI[Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915/hwmon: Accept writes of value 0 to power1_max_interval
In reply to Ashutosh Dixit== Series Details ==
== Series Details ==
Series: drm/i915/hwmon: Accept writes of value 0 to power1_max_interval
URL : https://patchwork.freedesktop.org/series/114459/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_12789_full -> Patchwork_114459v1_full
====================================================
Summary
-------
**SUCCESS**
No regressions found.
Participating hosts (8 -> 8)
------------------------------
No changes in participating hosts
Known issues
------------
Here are the changes found in Patchwork_114459v1_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_exec_fence@parallel@vecs0:
- shard-glk: NOTRUN -> [ABORT][1] ([i915#8233]) +1 similar issue
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114459v1/shard-glk7/igt@gem_exec_fence@[email protected]
* igt@kms_ccs@pipe-c-bad-pixel-format-y_tiled_gen12_rc_ccs_cc:
- shard-glk: NOTRUN -> [SKIP][2] ([fdo#109271] / [i915#3886]) +3 similar issues
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114459v1/shard-glk7/igt@kms_ccs@pipe-c-bad-pixel-format-y_tiled_gen12_rc_ccs_cc.html
* igt@kms_cursor_crc@cursor-random-max-size:
- shard-glk: NOTRUN -> [SKIP][3] ([fdo#109271]) +10 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114459v1/shard-glk7/igt@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
[fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
[fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1397]: https://gitlab.freedesktop.org/drm/intel/issues/1397
[i915#2527]: https://gitlab.freedesktop.org/drm/intel/issues/2527
[i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
[i915#2587]: https://gitlab.freedesktop.org/drm/intel/issues/2587
[i915#2672]: https://gitlab.freedesktop.org/drm/intel/issues/2672
[i915#2842]: https://gitlab.freedesktop.org/drm/intel/issues/2842
[i915#2856]: https://gitlab.freedesktop.org/drm/intel/issues/2856
[i915#3281]: https://gitlab.freedesktop.org/drm/intel/issues/3281
[i915#3297]: https://gitlab.freedesktop.org/drm/intel/issues/3297
[i915#3458]: https://gitlab.freedesktop.org/drm/intel/issues/3458
[i915#3539]: https://gitlab.freedesktop.org/drm/intel/issues/3539
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3638]: https://gitlab.freedesktop.org/drm/intel/issues/3638
[i915#3689]: https://gitlab.freedesktop.org/drm/intel/issues/3689
[i915#3826]: https://gitlab.freedesktop.org/drm/intel/issues/3826
[i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
[i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
[i915#4538]: https://gitlab.freedesktop.org/drm/intel/issues/4538
[i915#4771]: https://gitlab.freedesktop.org/drm/intel/issues/4771
[i915#4833]: https://gitlab.freedesktop.org/drm/intel/issues/4833
[i915#4852]: https://gitlab.freedesktop.org/drm/intel/issues/4852
[i915#4860]: https://gitlab.freedesktop.org/drm/intel/issues/4860
[i915#4885]: https://gitlab.freedesktop.org/drm/intel/issues/4885
[i915#5176]: https://gitlab.freedesktop.org/drm/intel/issues/5176
[i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
[i915#6095]: https://gitlab.freedesktop.org/drm/intel/issues/6095
[i915#7116]: https://gitlab.freedesktop.org/drm/intel/issues/7116
[i915#7711]: https://gitlab.freedesktop.org/drm/intel/issues/7711
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#8233]: https://gitlab.freedesktop.org/drm/intel/issues/8233
Build changes
-------------
* Linux: CI_DRM_12789 -> Patchwork_114459v1
CI-20190529: 20190529
CI_DRM_12789: 8589fd9227ca62484e8599cbd62216230c2c9a64 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7174: 55642b7805d6fc5b987b396c2bbfa46db654db4f @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_114459v1: 8589fd9227ca62484e8599cbd62216230c2c9a64 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114459v1/index.html
Quoted 28 lines · Ashutosh Dixit
The value shown by
power1_max_intervalin millisec is essentially:((1.x * power(2,y)) * 1000) >> 10Where x and y are read from a HW register. On ATSM, x and y are 0 on power-up so the value shown is 0.
Writes of 0 to
power1_max_intervalhad previously been disallowed to avoid computing ilog2(0) but this resulted in the corner-case bug below. Therefore allow writes of 0 now but special case that write to x = y = 0.Signed-off-by Ashutosh Dixit <[email protected]>--- drivers/gpu/drm/i915/i915_hwmon.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)drivers/gpu/drm/i915/i915_hwmon.c +0
-4@@ -218,11 +218,15 @@ hwm_power1_max_interval_store(struct device *dev,/* val in hw units */ val =DIV_ROUND_CLOSEST_ULL ((u64 )val << hwmon->scl_shift_time,SF_TIME );/* Convert to 1.x * power(2,y) */ -if (!val) -return -EINVAL ; - y =ilog2 (val); -/* x = (val - (1 << y)) >> (y - 2); */
drivers/gpu/drm/i915/i915_hwmon.c hwm_power1_max_interval_store(struct device *dev, · line 229
Quoted 10 lines
drivers/gpu/drm/i915/i915_hwmon.c +9
-1- x = (val - (1ul << y)) << x_w >> y; +if (!val) { +/* Avoid ilog2(0) */ + y =0 ; + x =0 ; + }else { + y =ilog2 (val); +/* x = (val - (1 << y)) >> (y - 2); */ + x = (val - (1ul << y)) << x_w >> y; + }
Quoted 3 lines
drivers/gpu/drm/i915/i915_hwmon.c +0
-0rxy =REG_FIELD_PREP (PKG_PWR_LIM_1_TIME_X , x) |REG_FIELD_PREP (PKG_PWR_LIM_1_TIME_Y , y);