Skip to contentSkip to conversation

drm/i915: Clear bogus DMC BIOS/debug power well requests

PATCH In review Ville Syrjala 3 participants 7 messages Dec 5, 2018 – Dec 7, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Clear bogus DMC BIOS/debug power well requests

From: Ville Syrjälä <[email protected]>

The DMC firmware is confused and forces on the BIOS and debug power well requests for PW1 and MISC IO on some platforms. On BXT I measured this to waste about 10mW in the freeze system suspend state with the SoC in s0. I didn't get conclusive numbers for s0ix on account of the power consumption being much more noisy than in s0.

This is pretty much undoing part of commit 42d9366d41a9 ("drm/i915/gen9+: Don't remove secondary power well requests") where we stopped sanitizing the DMCs bogus request bits.

---
 drivers/gpu/drm/i915/intel_runtime_pm.c | 35 +++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_runtime_pm.c +33 -2
index 4350a5270423..6e349181dd1c 100644
@@ -336,10 +336,17 @@ static void hsw_wait_for_power_well_disable(struct drm_i915_private *dev_priv,
 	 * Bspec doesn't require waiting for PWs to get disabled, but still do
 	 * this for paranoia. The known cases where a PW will be forced on:
 	 * - a KVMR request on any power well via the KVMR request register
-	 * - a DMC request on PW1 and MISC_IO power wells via the BIOS and
-	 *   DEBUG request registers
+	 * - a debug request on any power well via the DEBUG request register
 	 * Skip the wait in case any of the request bits are set and print a
 	 * diagnostic message.
+	 *
+	 * Note that DMC firmware will also force on the PW1 BIOS request
+	 * on SKL-CNL, MISC_IO BIOS request on SKL-GLK (although MISC_IO
+	 * does not even exits on BXT/GLK so the bit doesn't stick),
+	 * and the PW1/MISC_IO debug request on BXT. We simply clear
+	 * those spurious requests in hsw_power_well_disable() to make
+	 * sure they don't waste power. Starting from ICL the DMC firmware
+	 * has been fixed to only force on the PW1 driver request bit.
 	 */
 	wait_for((disabled = !(I915_READ(regs->driver) &
 			       HSW_PWR_WELL_CTL_STATE(pw_idx))) ||
@@ -347,6 +354,11 @@ static void hsw_wait_for_power_well_disable(struct drm_i915_private *dev_priv,
 	if (disabled)
 		return;
 
+	WARN(reqs & 3,
+	     "%s left on (bios:%d driver:%d kvmr:%d debug:%d)\n",
+	     power_well->desc->name,
+	     !!(reqs & 1), !!(reqs & 2), !!(reqs & 4), !!(reqs & 8));
+
 	DRM_DEBUG_KMS("%s forced on (bios:%d driver:%d kvmr:%d debug:%d)\n",
 		      power_well->desc->name,
 		      !!(reqs & 1), !!(reqs & 2), !!(reqs & 4), !!(reqs & 8));
@@ -409,6 +421,7 @@ static void hsw_power_well_disable(struct drm_i915_private *dev_priv,
 				   struct i915_power_well *power_well)
 {
 	const struct i915_power_well_regs *regs = power_well->desc->hsw.regs;
+	enum i915_power_well_id id = power_well->desc->id;
 	int pw_idx = power_well->desc->hsw.idx;
 	u32 val;
 
@@ -417,6 +430,24 @@ static void hsw_power_well_disable(struct drm_i915_private *dev_priv,
 
 	val = I915_READ(regs->driver);
 	I915_WRITE(regs->driver, val & ~HSW_PWR_WELL_CTL_REQ(pw_idx));
+	/*
+	 * On SKL-CNL DMC firmware forces on the BIOS request.
+	 * This wastes a bit of power so clear it.
+	 */
+	if (INTEL_GEN(dev_priv) < 11 &&
+	    (id == SKL_DISP_PW_1 || id == SKL_DISP_PW_MISC_IO)) {
+		val = I915_READ(regs->bios);
+		I915_WRITE(regs->bios, val & ~HSW_PWR_WELL_CTL_REQ(pw_idx));
+	}
+	/*
+	 * On BXT DMC firmware forces on the debug request.
+	 * This wastes a bit of power so clear it.
+	 */
+	if (IS_BROXTON(dev_priv) &&
+	    (id == SKL_DISP_PW_1 || id == SKL_DISP_PW_MISC_IO)) {
+		val = I915_READ(regs->debug);
+		I915_WRITE(regs->debug, val & ~HSW_PWR_WELL_CTL_REQ(pw_idx));
+	}
 	hsw_wait_for_power_well_disable(dev_priv, power_well);
 }
 
Signature · 6 lines
2.18.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✓ Fi.CI.BAT: success for drm/i915: Clear bogus DMC BIOS/debug power well requests

== Series Details ==

== Series Details ==

Series: drm/i915: Clear bogus DMC BIOS/debug power well requests
URL : https://patchwork.freedesktop.org/series/53591/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5266 -> Patchwork_11023
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/53591/revisions/1/mbox/

Known issues
------------

Here are the changes found in Patchwork_11023 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@kms_chamelium@common-hpd-after-suspend:
- fi-icl-u2: NOTRUN -> DMESG-FAIL [fdo#103375] / [fdo#107732] / [fdo#108070] / [fdo#108924]

* {igt@runner@aborted}:
- fi-icl-u2: NOTRUN -> FAIL [fdo#108070]
- {fi-icl-y}: NOTRUN -> FAIL [fdo#108070]

#### Possible fixes ####

* igt@i915_selftest@live_hangcheck:
- fi-bwr-2160: DMESG-FAIL [fdo#108735] -> PASS

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
[fdo#107732]: https://bugs.freedesktop.org/show_bug.cgi?id=107732
[fdo#108070]: https://bugs.freedesktop.org/show_bug.cgi?id=108070
[fdo#108735]: https://bugs.freedesktop.org/show_bug.cgi?id=108735
[fdo#108924]: https://bugs.freedesktop.org/show_bug.cgi?id=108924

Participating hosts (47 -> 45)
------------------------------

Additional (2): fi-icl-y fi-icl-u2
Missing (4): fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u

Build changes
-------------

* Linux: CI_DRM_5266 -> Patchwork_11023

CI_DRM_5266: 529899779ce289fe64cd2249da1eb9bcea6a423f @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4741: 5c8f89f67c7b32014bc22421e48f3c0cf4e5ca3a @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_11023: 4e695c5989bb2889e4c0ef05f3b87d48c302f4d2 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

4e695c5989bb drm/i915: Clear bogus DMC BIOS/debug power well requests

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_11023/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

✓ Fi.CI.IGT: success for drm/i915: Clear bogus DMC BIOS/debug power well requests

In reply to Ville Syrjala
== Series Details ==

== Series Details ==

Series: drm/i915: Clear bogus DMC BIOS/debug power well requests
URL : https://patchwork.freedesktop.org/series/53591/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5266_full -> Patchwork_11023_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

Known issues
------------

Here are the changes found in Patchwork_11023_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_schedule@pi-ringfull-blt:
- {shard-iclb}: NOTRUN -> FAIL [fdo#103158]

* igt@gem_exec_schedule@pi-ringfull-render:
- shard-skl: NOTRUN -> FAIL [fdo#103158]

* igt@gem_ppgtt@blt-vs-render-ctx0:
- shard-skl: PASS -> TIMEOUT [fdo#108039]

* igt@gem_ppgtt@blt-vs-render-ctxn:
- shard-skl: NOTRUN -> TIMEOUT [fdo#108039]

* igt@i915_suspend@forcewake:
- shard-skl: PASS -> INCOMPLETE [fdo#104108] / [fdo#107773]

* igt@kms_atomic@plane_cursor_legacy:
- {shard-iclb}: PASS -> DMESG-WARN [fdo#107724] +18

* igt@kms_ccs@pipe-c-crc-sprite-planes-basic:
- {shard-iclb}: NOTRUN -> FAIL [fdo#107725]

* igt@kms_cursor_crc@cursor-128x42-onscreen:
- shard-apl: PASS -> FAIL [fdo#103232]

* igt@kms_cursor_crc@cursor-256x85-sliding:
- shard-skl: NOTRUN -> FAIL [fdo#103232] +1

* igt@kms_cursor_crc@cursor-64x64-onscreen:
- {shard-iclb}: NOTRUN -> FAIL [fdo#103232] +6

* igt@kms_draw_crc@draw-method-xrgb8888-render-ytiled:
- {shard-iclb}: PASS -> WARN [fdo#108336] +4

* igt@kms_fbcon_fbt@psr-suspend:
- shard-skl: NOTRUN -> FAIL [fdo#107882]

* igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-shrfb-draw-mmap-cpu:
- {shard-iclb}: NOTRUN -> DMESG-FAIL [fdo#107724]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-pri-shrfb-draw-render:
- shard-skl: NOTRUN -> FAIL [fdo#105682]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-wc:
- shard-apl: PASS -> FAIL [fdo#103167]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-pwrite:
- shard-glk: PASS -> FAIL [fdo#103167] +3

* igt@kms_frontbuffer_tracking@fbcpsr-1p-offscren-pri-indfb-draw-mmap-wc:
- shard-skl: NOTRUN -> FAIL [fdo#103167] +1

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-mmap-gtt:
- {shard-iclb}: PASS -> DMESG-FAIL [fdo#107724] +5

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-draw-mmap-wc:
- {shard-iclb}: PASS -> FAIL [fdo#103167]

* igt@kms_frontbuffer_tracking@fbcpsr-stridechange:
- shard-skl: NOTRUN -> FAIL [fdo#105683]

* igt@kms_frontbuffer_tracking@psr-1p-primscrn-pri-indfb-draw-mmap-cpu:
- {shard-iclb}: PASS -> DMESG-WARN [fdo#107724] / [fdo#108336] +9

* igt@kms_plane@pixel-format-pipe-a-planes:
- {shard-iclb}: NOTRUN -> FAIL [fdo#103166]

* {igt@kms_plane@pixel-format-pipe-a-planes-source-clamping}:
- shard-skl: NOTRUN -> DMESG-WARN [fdo#106885]

* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes:
- shard-glk: PASS -> INCOMPLETE [fdo#103359] / [k.org#198133]

* igt@kms_plane@plane-panning-top-left-pipe-a-planes:
- shard-apl: PASS -> INCOMPLETE [fdo#103927]

* igt@kms_plane@plane-position-covered-pipe-b-planes:
- {shard-iclb}: PASS -> FAIL [fdo#103166] +2

* igt@kms_plane_alpha_blend@pipe-a-alpha-7efc:
- shard-skl: NOTRUN -> FAIL [fdo#107815] / [fdo#108145] +1

* igt@kms_plane_alpha_blend@pipe-b-alpha-opaque-fb:
- shard-skl: NOTRUN -> FAIL [fdo#108145]

* igt@kms_plane_alpha_blend@pipe-c-coverage-7efc:
- shard-skl: PASS -> FAIL [fdo#107815]

* igt@kms_plane_scaling@pipe-b-scaler-with-rotation:
- {shard-iclb}: NOTRUN -> DMESG-WARN [fdo#107724] +1

* {igt@kms_rotation_crc@multiplane-rotation-cropping-top}:
- shard-kbl: PASS -> DMESG-FAIL [fdo#108950]

* igt@pm_rpm@fences-dpms:
- {shard-iclb}: PASS -> INCOMPLETE [fdo#108840]

* igt@pm_rpm@modeset-non-lpsp:
- {shard-iclb}: SKIP -> INCOMPLETE [fdo#108840]

* igt@pm_rpm@system-suspend:
- shard-skl: PASS -> INCOMPLETE [fdo#104108] / [fdo#107807]

#### Possible fixes ####

* igt@gem_userptr_blits@readonly-unsync:
- shard-skl: TIMEOUT [fdo#108887] -> PASS

* igt@i915_suspend@debugfs-reader:
- shard-skl: INCOMPLETE [fdo#104108] -> PASS

* igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-a:
- shard-hsw: DMESG-WARN [fdo#107956] -> PASS

* igt@kms_color@pipe-b-legacy-gamma:
- shard-apl: FAIL [fdo#104782] -> PASS

* igt@kms_cursor_crc@cursor-128x128-onscreen:
- shard-apl: FAIL [fdo#103232] -> PASS
- shard-glk: FAIL [fdo#103232] -> PASS +1

* igt@kms_flip@flip-vs-expired-vblank-interruptible:
- shard-skl: FAIL [fdo#105363] -> PASS

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-mmap-gtt:
- shard-apl: FAIL [fdo#103167] -> PASS

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-pri-indfb-draw-blt:
- shard-skl: FAIL [fdo#103167] -> PASS

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-pwrite:
- {shard-iclb}: DMESG-FAIL [fdo#107724] -> PASS +3

* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-cur-indfb-move:
- shard-glk: FAIL [fdo#103167] -> PASS +4

* igt@kms_frontbuffer_tracking@fbc-2p-rte:
- shard-glk: FAIL [fdo#103167] / [fdo#105682] -> PASS

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-draw-pwrite:
- {shard-iclb}: FAIL [fdo#103167] -> PASS +2

* igt@kms_frontbuffer_tracking@fbcpsr-rgb101010-draw-mmap-gtt:
- shard-skl: FAIL [fdo#103167] / [fdo#105682] -> PASS

* igt@kms_frontbuffer_tracking@psr-1p-primscrn-cur-indfb-draw-pwrite:
- {shard-iclb}: DMESG-WARN [fdo#107724] / [fdo#108336] -> PASS +8

* igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a-frame-sequence:
- shard-skl: FAIL [fdo#103191] / [fdo#107362] -> PASS

* {igt@kms_plane@pixel-format-pipe-c-planes-source-clamping}:
- shard-glk: FAIL [fdo#108948] -> PASS

* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes:
- shard-kbl: INCOMPLETE [fdo#103665] -> PASS

* igt@kms_plane_alpha_blend@pipe-a-coverage-7efc:
- shard-skl: FAIL [fdo#107815] / [fdo#108145] -> PASS

* igt@kms_plane_multiple@atomic-pipe-b-tiling-x:
- shard-glk: FAIL [fdo#103166] -> PASS +1

* igt@kms_plane_multiple@atomic-pipe-c-tiling-yf:
- shard-apl: FAIL [fdo#103166] -> PASS

* {igt@kms_rotation_crc@multiplane-rotation-cropping-top}:
- shard-glk: DMESG-FAIL [fdo#105763] / [fdo#106538] -> PASS

* igt@pm_backlight@basic-brightness:
- {shard-iclb}: DMESG-WARN [fdo#107724] -> PASS +12

* igt@pm_rpm@gem-execbuf-stress-pc8:
- {shard-iclb}: INCOMPLETE [fdo#107713] / [fdo#108840] -> SKIP
- shard-skl: INCOMPLETE [fdo#107807] -> SKIP

* igt@pm_rpm@modeset-lpsp:
- {shard-iclb}: DMESG-WARN [fdo#108654] -> PASS

#### Warnings ####

* igt@i915_suspend@shrink:
- shard-skl: INCOMPLETE [fdo#106886] -> DMESG-WARN [fdo#108784]

* igt@kms_ccs@pipe-a-crc-primary-basic:
- {shard-iclb}: DMESG-WARN [fdo#107724] / [fdo#108336] -> FAIL [fdo#107725]

* igt@kms_ccs@pipe-a-crc-primary-rotation-180:
- {shard-iclb}: FAIL [fdo#107725] -> DMESG-WARN [fdo#107724] / [fdo#108336]

* igt@kms_cursor_crc@cursor-256x256-random:
- {shard-iclb}: FAIL [fdo#103232] -> DMESG-WARN [fdo#107724] / [fdo#108336] +1

* igt@kms_cursor_legacy@long-nonblocking-modeset-vs-cursor-atomic:
- {shard-iclb}: INCOMPLETE -> DMESG-WARN [fdo#107724]

* igt@kms_frontbuffer_tracking@psr-1p-primscrn-spr-indfb-fullscreen:
- {shard-iclb}: FAIL [fdo#103167] -> DMESG-WARN [fdo#107724] / [fdo#108336]

* igt@kms_hdmi_inject@inject-audio:
- {shard-iclb}: FAIL [fdo#102370] -> DMESG-FAIL [fdo#107724]

* {igt@kms_plane@pixel-format-pipe-a-planes-source-clamping}:
- {shard-iclb}: FAIL [fdo#108948] -> DMESG-WARN [fdo#107724] / [fdo#108336]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#102370]: https://bugs.freedesktop.org/show_bug.cgi?id=102370
[fdo#103158]: https://bugs.freedesktop.org/show_bug.cgi?id=103158
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#103359]: https://bugs.freedesktop.org/show_bug.cgi?id=103359
[fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
[fdo#104782]: https://bugs.freedesktop.org/show_bug.cgi?id=104782
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#105682]: https://bugs.freedesktop.org/show_bug.cgi?id=105682
[fdo#105683]: https://bugs.freedesktop.org/show_bug.cgi?id=105683
[fdo#105763]: https://bugs.freedesktop.org/show_bug.cgi?id=105763
[fdo#106538]: https://bugs.freedesktop.org/show_bug.cgi?id=106538
[fdo#106885]: https://bugs.freedesktop.org/show_bug.cgi?id=106885
[fdo#106886]: https://bugs.freedesktop.org/show_bug.cgi?id=106886
[fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#107725]: https://bugs.freedesktop.org/show_bug.cgi?id=107725
[fdo#107773]: https://bugs.freedesktop.org/show_bug.cgi?id=107773
[fdo#107807]: https://bugs.freedesktop.org/show_bug.cgi?id=107807
[fdo#107815]: https://bugs.freedesktop.org/show_bug.cgi?id=107815
[fdo#107882]: https://bugs.freedesktop.org/show_bug.cgi?id=107882
[fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
[fdo#108039]: https://bugs.freedesktop.org/show_bug.cgi?id=108039
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108336]: https://bugs.freedesktop.org/show_bug.cgi?id=108336
[fdo#108654]: https://bugs.freedesktop.org/show_bug.cgi?id=108654
[fdo#108784]: https://bugs.freedesktop.org/show_bug.cgi?id=108784
[fdo#108840]: https://bugs.freedesktop.org/show_bug.cgi?id=108840
[fdo#108887]: https://bugs.freedesktop.org/show_bug.cgi?id=108887
[fdo#108948]: https://bugs.freedesktop.org/show_bug.cgi?id=108948
[fdo#108950]: https://bugs.freedesktop.org/show_bug.cgi?id=108950
[k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133

Participating hosts (7 -> 7)
------------------------------

No changes in participating hosts

Build changes
-------------

* Linux: CI_DRM_5266 -> Patchwork_11023

CI_DRM_5266: 529899779ce289fe64cd2249da1eb9bcea6a423f @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4741: 5c8f89f67c7b32014bc22421e48f3c0cf4e5ca3a @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_11023: 4e695c5989bb2889e4c0ef05f3b87d48c302f4d2 @ 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_11023/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
In reply to Ville Syrjala
Quoted 9 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

The DMC firmware is confused and forces on the BIOS and debug power well requests for PW1 and MISC IO on some platforms. On BXT I measured this to waste about 10mW in the freeze system suspend state with the SoC in s0. I didn't get conclusive numbers for s0ix on account of the power consumption being much more noisy than in s0.

Quoted 7 lines

This is pretty much undoing part of commit 42d9366d41a9 ("drm/i915/gen9+: Don't remove secondary power well requests") where we stopped sanitizing the DMCs bogus request bits.

Thanks for the effort for clarifying this.

The justification in 42d9366d41a9 for not removing the PW#1 and MISC_IO driver request bits is not too solid, I admit. Bspec 4230 has this to say about them (for SKL, but same in practice for the rest):

"""
4. Disable Power Well 1 (PG1) and Misc IO Power

Clear PWR_WELL_CTL Power Well 1 Request to 0b. Do not clear Misc IO Power Request. Wait for 10us. Do not poll for the power well to disable. Other clients may be keeping it enabled.
"""

With MISC_IO we would clearly do the opposite in this patch wrt. the spec.

With PW#1 it's unclear if the spec means only the driver's request bit or all of them, but "other clients may be keeping it enabled" suggests to me it means only the driver's request bit. OTOH removing only the driver's request bit alone doesn't make sense due to DMC forcing on the BIOS (and debug) request bits anyway.

I opened a BSpec update request to clarify this, I suggest waiting for an update there before going ahead with this change.

Quoted 57 lines
---
 drivers/gpu/drm/i915/intel_runtime_pm.c | 35 +++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_runtime_pm.c +20 -2
index 4350a5270423..6e349181dd1c 100644
@@ -336,10 +336,17 @@ static void hsw_wait_for_power_well_disable(struct drm_i915_private *dev_priv,
 	 * Bspec doesn't require waiting for PWs to get disabled, but still do
 	 * this for paranoia. The known cases where a PW will be forced on:
 	 * - a KVMR request on any power well via the KVMR request register
-	 * - a DMC request on PW1 and MISC_IO power wells via the BIOS and
-	 *   DEBUG request registers
+	 * - a debug request on any power well via the DEBUG request register
 	 * Skip the wait in case any of the request bits are set and print a
 	 * diagnostic message.
+	 *
+	 * Note that DMC firmware will also force on the PW1 BIOS request
+	 * on SKL-CNL, MISC_IO BIOS request on SKL-GLK (although MISC_IO
+	 * does not even exits on BXT/GLK so the bit doesn't stick),
+	 * and the PW1/MISC_IO debug request on BXT. We simply clear
+	 * those spurious requests in hsw_power_well_disable() to make
+	 * sure they don't waste power. Starting from ICL the DMC firmware
+	 * has been fixed to only force on the PW1 driver request bit.
 	 */
 	wait_for((disabled = !(I915_READ(regs->driver) &
 			       HSW_PWR_WELL_CTL_STATE(pw_idx))) ||
@@ -347,6 +354,11 @@ static void hsw_wait_for_power_well_disable(struct drm_i915_private *dev_priv,
 	if (disabled)
 		return;
 
+	WARN(reqs & 3,
+	     "%s left on (bios:%d driver:%d kvmr:%d debug:%d)\n",
+	     power_well->desc->name,
+	     !!(reqs & 1), !!(reqs & 2), !!(reqs & 4), !!(reqs & 8));
+
 	DRM_DEBUG_KMS("%s forced on (bios:%d driver:%d kvmr:%d debug:%d)\n",
 		      power_well->desc->name,
 		      !!(reqs & 1), !!(reqs & 2), !!(reqs & 4), !!(reqs & 8));
@@ -409,6 +421,7 @@ static void hsw_power_well_disable(struct drm_i915_private *dev_priv,
 				   struct i915_power_well *power_well)
 {
 	const struct i915_power_well_regs *regs = power_well->desc->hsw.regs;
+	enum i915_power_well_id id = power_well->desc->id;
 	int pw_idx = power_well->desc->hsw.idx;
 	u32 val;
 
@@ -417,6 +430,24 @@ static void hsw_power_well_disable(struct drm_i915_private *dev_priv,
 
 	val = I915_READ(regs->driver);
 	I915_WRITE(regs->driver, val & ~HSW_PWR_WELL_CTL_REQ(pw_idx));
+	/*
+	 * On SKL-CNL DMC firmware forces on the BIOS request.
+	 * This wastes a bit of power so clear it.
+	 */
+	if (INTEL_GEN(dev_priv) < 11 &&

drivers/gpu/drm/i915/intel_runtime_pm.c static void hsw_power_well_disable(struct drm_i915_private *dev_priv, · line 447

Quoted 10 lines
drivers/gpu/drm/i915/intel_runtime_pm.c +10 -0
+	    (id == SKL_DISP_PW_1 || id == SKL_DISP_PW_MISC_IO)) {
+		val = I915_READ(regs->bios);
+		I915_WRITE(regs->bios, val & ~HSW_PWR_WELL_CTL_REQ(pw_idx));
+	}
+	/*
+	 * On BXT DMC firmware forces on the debug request.
+	 * This wastes a bit of power so clear it.
+	 */
+	if (IS_BROXTON(dev_priv) &&
+	    (id == SKL_DISP_PW_1 || id == SKL_DISP_PW_MISC_IO)) {

No MISC_IO on BXT, so is this just for symmetry with the above if-block?

Quoted 9 lines
drivers/gpu/drm/i915/intel_runtime_pm.c +3 -0
+		val = I915_READ(regs->debug);
+		I915_WRITE(regs->debug, val & ~HSW_PWR_WELL_CTL_REQ(pw_idx));
+	}
 	hsw_wait_for_power_well_disable(dev_priv, power_well);
 }
 
Signature · 1 line
2.18.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
Quoted 24 lines · Imre Deak
Quoted 9 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

The DMC firmware is confused and forces on the BIOS and debug power well requests for PW1 and MISC IO on some platforms. On BXT I measured this to waste about 10mW in the freeze system suspend state with the SoC in s0. I didn't get conclusive numbers for s0ix on account of the power consumption being much more noisy than in s0.

Quoted 7 lines

This is pretty much undoing part of commit 42d9366d41a9 ("drm/i915/gen9+: Don't remove secondary power well requests") where we stopped sanitizing the DMCs bogus request bits.

Thanks for the effort for clarifying this.

The justification in 42d9366d41a9 for not removing the PW#1 and MISC_IO driver request bits is not too solid, I admit. Bspec 4230 has this to say about them (for SKL, but same in practice for the rest):

Quoted 8 lines

"""
4. Disable Power Well 1 (PG1) and Misc IO Power

Clear PWR_WELL_CTL Power Well 1 Request to 0b. Do not clear Misc IO Power Request. Wait for 10us. Do not poll for the power well to disable. Other clients may be keeping it enabled.
"""

With MISC_IO we would clearly do the opposite in this patch wrt. the spec.

Actually we don't disable MISC_IO during SKL display core uninit, so we'd still follow the spec regarding this.

Quoted 86 lines

With PW#1 it's unclear if the spec means only the driver's request bit or all of them, but "other clients may be keeping it enabled" suggests to me it means only the driver's request bit. OTOH removing only the driver's request bit alone doesn't make sense due to DMC forcing on the BIOS (and debug) request bits anyway.

I opened a BSpec update request to clarify this, I suggest waiting for an update there before going ahead with this change.

Quoted 57 lines
---
 drivers/gpu/drm/i915/intel_runtime_pm.c | 35 +++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_runtime_pm.c +20 -2
index 4350a5270423..6e349181dd1c 100644
@@ -336,10 +336,17 @@ static void hsw_wait_for_power_well_disable(struct drm_i915_private *dev_priv,
 	 * Bspec doesn't require waiting for PWs to get disabled, but still do
 	 * this for paranoia. The known cases where a PW will be forced on:
 	 * - a KVMR request on any power well via the KVMR request register
-	 * - a DMC request on PW1 and MISC_IO power wells via the BIOS and
-	 *   DEBUG request registers
+	 * - a debug request on any power well via the DEBUG request register
 	 * Skip the wait in case any of the request bits are set and print a
 	 * diagnostic message.
+	 *
+	 * Note that DMC firmware will also force on the PW1 BIOS request
+	 * on SKL-CNL, MISC_IO BIOS request on SKL-GLK (although MISC_IO
+	 * does not even exits on BXT/GLK so the bit doesn't stick),
+	 * and the PW1/MISC_IO debug request on BXT. We simply clear
+	 * those spurious requests in hsw_power_well_disable() to make
+	 * sure they don't waste power. Starting from ICL the DMC firmware
+	 * has been fixed to only force on the PW1 driver request bit.
 	 */
 	wait_for((disabled = !(I915_READ(regs->driver) &
 			       HSW_PWR_WELL_CTL_STATE(pw_idx))) ||
@@ -347,6 +354,11 @@ static void hsw_wait_for_power_well_disable(struct drm_i915_private *dev_priv,
 	if (disabled)
 		return;
 
+	WARN(reqs & 3,
+	     "%s left on (bios:%d driver:%d kvmr:%d debug:%d)\n",
+	     power_well->desc->name,
+	     !!(reqs & 1), !!(reqs & 2), !!(reqs & 4), !!(reqs & 8));
+
 	DRM_DEBUG_KMS("%s forced on (bios:%d driver:%d kvmr:%d debug:%d)\n",
 		      power_well->desc->name,
 		      !!(reqs & 1), !!(reqs & 2), !!(reqs & 4), !!(reqs & 8));
@@ -409,6 +421,7 @@ static void hsw_power_well_disable(struct drm_i915_private *dev_priv,
 				   struct i915_power_well *power_well)
 {
 	const struct i915_power_well_regs *regs = power_well->desc->hsw.regs;
+	enum i915_power_well_id id = power_well->desc->id;
 	int pw_idx = power_well->desc->hsw.idx;
 	u32 val;
 
@@ -417,6 +430,24 @@ static void hsw_power_well_disable(struct drm_i915_private *dev_priv,
 
 	val = I915_READ(regs->driver);
 	I915_WRITE(regs->driver, val & ~HSW_PWR_WELL_CTL_REQ(pw_idx));
+	/*
+	 * On SKL-CNL DMC firmware forces on the BIOS request.
+	 * This wastes a bit of power so clear it.
+	 */
+	if (INTEL_GEN(dev_priv) < 11 &&

drivers/gpu/drm/i915/intel_runtime_pm.c static void hsw_power_well_disable(struct drm_i915_private *dev_priv, · line 447

Quoted 10 lines
drivers/gpu/drm/i915/intel_runtime_pm.c +10 -0
+	    (id == SKL_DISP_PW_1 || id == SKL_DISP_PW_MISC_IO)) {
+		val = I915_READ(regs->bios);
+		I915_WRITE(regs->bios, val & ~HSW_PWR_WELL_CTL_REQ(pw_idx));
+	}
+	/*
+	 * On BXT DMC firmware forces on the debug request.
+	 * This wastes a bit of power so clear it.
+	 */
+	if (IS_BROXTON(dev_priv) &&
+	    (id == SKL_DISP_PW_1 || id == SKL_DISP_PW_MISC_IO)) {

No MISC_IO on BXT, so is this just for symmetry with the above if-block?

Quoted 6 lines
drivers/gpu/drm/i915/intel_runtime_pm.c +3 -0
+		val = I915_READ(regs->debug);
+		I915_WRITE(regs->debug, val & ~HSW_PWR_WELL_CTL_REQ(pw_idx));
+	}
 	hsw_wait_for_power_well_disable(dev_priv, power_well);
 }
 
Quoted 7 lines
Quoted 3 lines
Signature · 1 line
2.18.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
In reply to Imre Deak
Quoted 50 lines · Imre Deak
Quoted 9 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

The DMC firmware is confused and forces on the BIOS and debug power well requests for PW1 and MISC IO on some platforms. On BXT I measured this to waste about 10mW in the freeze system suspend state with the SoC in s0. I didn't get conclusive numbers for s0ix on account of the power consumption being much more noisy than in s0.

Quoted 7 lines

This is pretty much undoing part of commit 42d9366d41a9 ("drm/i915/gen9+: Don't remove secondary power well requests") where we stopped sanitizing the DMCs bogus request bits.

Thanks for the effort for clarifying this.

The justification in 42d9366d41a9 for not removing the PW#1 and MISC_IO driver request bits is not too solid, I admit. Bspec 4230 has this to say about them (for SKL, but same in practice for the rest):

"""
4. Disable Power Well 1 (PG1) and Misc IO Power

Clear PWR_WELL_CTL Power Well 1 Request to 0b. Do not clear Misc IO Power Request. Wait for 10us. Do not poll for the power well to disable. Other clients may be keeping it enabled.
"""

With MISC_IO we would clearly do the opposite in this patch wrt. the spec.

With PW#1 it's unclear if the spec means only the driver's request bit or all of them, but "other clients may be keeping it enabled" suggests to me it means only the driver's request bit. OTOH removing only the driver's request bit alone doesn't make sense due to DMC forcing on the BIOS (and debug) request bits anyway.

I opened a BSpec update request to clarify this, I suggest waiting for an update there before going ahead with this change.

Quoted 8 lines
---
 drivers/gpu/drm/i915/intel_runtime_pm.c | 35 +++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_runtime_pm.c +0 -0
index 4350a5270423..6e349181dd1c 100644

<snip>

Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/i915/intel_runtime_pm.c +9 -0
@@ -417,6 +430,24 @@ static void hsw_power_well_disable(struct drm_i915_private *dev_priv,
 
 	val = I915_READ(regs->driver);
 	I915_WRITE(regs->driver, val & ~HSW_PWR_WELL_CTL_REQ(pw_idx));
+	/*
+	 * On SKL-CNL DMC firmware forces on the BIOS request.
+	 * This wastes a bit of power so clear it.
+	 */
+	if (INTEL_GEN(dev_priv) < 11 &&
+	    (id == SKL_DISP_PW_1 || id == SKL_DISP_PW_MISC_IO)) {
+		val = I915_READ(regs->bios);
+		I915_WRITE(regs->bios, val & ~HSW_PWR_WELL_CTL_REQ(pw_idx));
+	}
Quoted 8 lines

drivers/gpu/drm/i915/intel_runtime_pm.c static void hsw_power_well_disable(struct drm_i915_private *dev_priv, · line 447

Quoted 6 lines
drivers/gpu/drm/i915/intel_runtime_pm.c +6 -0
+	/*
+	 * On BXT DMC firmware forces on the debug request.
+	 * This wastes a bit of power so clear it.
+	 */
+	if (IS_BROXTON(dev_priv) &&
+	    (id == SKL_DISP_PW_1 || id == SKL_DISP_PW_MISC_IO)) {

No MISC_IO on BXT, so is this just for symmetry with the above if-block?

Just copy-pasted it so got it in both. I can drop the misc-io here if you prefer that.

Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/i915/intel_runtime_pm.c +3 -0
+		val = I915_READ(regs->debug);
+		I915_WRITE(regs->debug, val & ~HSW_PWR_WELL_CTL_REQ(pw_idx));
+	}
 	hsw_wait_for_power_well_disable(dev_priv, power_well);
 }
 
Signature · 1 line
2.18.1
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by
#6 lore raw
Quoted 74 lines · Ville Syrjälä
Quoted 50 lines · Imre Deak
Quoted 9 lines · Ville Syrjala

From: Ville Syrjälä <[email protected]>

The DMC firmware is confused and forces on the BIOS and debug power well requests for PW1 and MISC IO on some platforms. On BXT I measured this to waste about 10mW in the freeze system suspend state with the SoC in s0. I didn't get conclusive numbers for s0ix on account of the power consumption being much more noisy than in s0.

Quoted 7 lines

This is pretty much undoing part of commit 42d9366d41a9 ("drm/i915/gen9+: Don't remove secondary power well requests") where we stopped sanitizing the DMCs bogus request bits.

Thanks for the effort for clarifying this.

The justification in 42d9366d41a9 for not removing the PW#1 and MISC_IO driver request bits is not too solid, I admit. Bspec 4230 has this to say about them (for SKL, but same in practice for the rest):

"""
4. Disable Power Well 1 (PG1) and Misc IO Power

Clear PWR_WELL_CTL Power Well 1 Request to 0b. Do not clear Misc IO Power Request. Wait for 10us. Do not poll for the power well to disable. Other clients may be keeping it enabled.
"""

With MISC_IO we would clearly do the opposite in this patch wrt. the spec.

With PW#1 it's unclear if the spec means only the driver's request bit or all of them, but "other clients may be keeping it enabled" suggests to me it means only the driver's request bit. OTOH removing only the driver's request bit alone doesn't make sense due to DMC forcing on the BIOS (and debug) request bits anyway.

I opened a BSpec update request to clarify this, I suggest waiting for an update there before going ahead with this change.

Quoted 8 lines
---
 drivers/gpu/drm/i915/intel_runtime_pm.c | 35 +++++++++++++++++++++++--
 1 file changed, 33 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_runtime_pm.c +0 -0
index 4350a5270423..6e349181dd1c 100644

<snip>

Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/i915/intel_runtime_pm.c +9 -0
@@ -417,6 +430,24 @@ static void hsw_power_well_disable(struct drm_i915_private *dev_priv,
 
 	val = I915_READ(regs->driver);
 	I915_WRITE(regs->driver, val & ~HSW_PWR_WELL_CTL_REQ(pw_idx));
+	/*
+	 * On SKL-CNL DMC firmware forces on the BIOS request.
+	 * This wastes a bit of power so clear it.
+	 */
+	if (INTEL_GEN(dev_priv) < 11 &&
+	    (id == SKL_DISP_PW_1 || id == SKL_DISP_PW_MISC_IO)) {
+		val = I915_READ(regs->bios);
+		I915_WRITE(regs->bios, val & ~HSW_PWR_WELL_CTL_REQ(pw_idx));
+	}
Quoted 8 lines

drivers/gpu/drm/i915/intel_runtime_pm.c static void hsw_power_well_disable(struct drm_i915_private *dev_priv, · line 447

Quoted 6 lines
drivers/gpu/drm/i915/intel_runtime_pm.c +6 -0
+	/*
+	 * On BXT DMC firmware forces on the debug request.
+	 * This wastes a bit of power so clear it.
+	 */
+	if (IS_BROXTON(dev_priv) &&
+	    (id == SKL_DISP_PW_1 || id == SKL_DISP_PW_MISC_IO)) {

No MISC_IO on BXT, so is this just for symmetry with the above if-block?

Quoted 2 lines

Just copy-pasted it so got it in both. I can drop the misc-io here if you prefer that.

Yes imo, it's clearer that way. With that it's

provided the change wouldn't be NAKed by the pending BSpec update, but I doubt it would. Let's still wait for an update.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_runtime_pm.c +3 -0
+		val = I915_READ(regs->debug);
+		I915_WRITE(regs->debug, val & ~HSW_PWR_WELL_CTL_REQ(pw_idx));
+	}
 	hsw_wait_for_power_well_disable(dev_priv, power_well);
 }
 
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Signature · 1 line
2.18.1
Signature · 2 lines
Ville Syrjälä
Intel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx