Skip to contentSkip to conversation

drm/i915: Fix TypeC mode initialization during system resume

PATCH In review Imre Deak 3 participants 5 messages Sep 22, 2022 – Sep 26, 2022

Subsystems (3)
lore
Share & tools
lore

Imre Deak

author
#0 lore raw

PATCH 1/1 drm/i915: Fix TypeC mode initialization during system resume

During system resume DP MST requires AUX to be working already before the HW state readout of the given encoder. Since AUX requires the encoder/PHY TypeC mode to be initialized, which atm only happens during HW state readout, these AUX transfers can change the TypeC mode incorrectly (disconnecting the PHY for an enabled encoder) and trigger the state check WARNs in intel_tc_port_sanitize().

Fix this by initializing the TypeC mode earlier both during driver loading and system resume and making sure that the mode can't change until the encoder's state is read out. While at it add the missing DocBook comments and rename intel_tc_port_sanitize()->intel_tc_port_sanitize_mode() for consistency.

---
 drivers/gpu/drm/i915/display/intel_ddi.c |  8 ++-
 drivers/gpu/drm/i915/display/intel_tc.c  | 68 ++++++++++++++++++------
 drivers/gpu/drm/i915/display/intel_tc.h  |  3 +-
 3 files changed, 61 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/display/intel_ddi.c +7 -1
index 643832d55c282..5ce5e885694c8 100644
@@ -3591,7 +3591,7 @@ static void intel_ddi_sync_state(struct intel_encoder *encoder,
 	enum phy phy = intel_port_to_phy(i915, encoder->port);
 
 	if (intel_phy_is_tc(i915, phy))
-		intel_tc_port_sanitize(enc_to_dig_port(encoder));
+		intel_tc_port_sanitize_mode(enc_to_dig_port(encoder));
 
 	if (crtc_state && intel_crtc_has_dp_encoder(crtc_state))
 		intel_dp_sync_state(encoder, crtc_state);
@@ -3789,11 +3789,17 @@ static void intel_ddi_encoder_destroy(struct drm_encoder *encoder)
 
 static void intel_ddi_encoder_reset(struct drm_encoder *encoder)
 {
+	struct drm_i915_private *i915 = to_i915(encoder->dev);
 	struct intel_dp *intel_dp = enc_to_intel_dp(to_intel_encoder(encoder));
+	struct intel_digital_port *dig_port = enc_to_dig_port(to_intel_encoder(encoder));
+	enum phy phy = intel_port_to_phy(i915, dig_port->base.port);
 
 	intel_dp->reset_link_params = true;
 
 	intel_pps_encoder_reset(intel_dp);
+
+	if (intel_phy_is_tc(i915, phy))
+		intel_tc_port_init_mode(dig_port);
 }
 
 static const struct drm_encoder_funcs intel_ddi_funcs = {
drivers/gpu/drm/i915/display/intel_tc.c +52 -16

104 lines not on this page · raw message

drivers/gpu/drm/i915/display/intel_tc.h +2 -1
index 6b47b29f551c9..d54082e2d5e8d 100644
@@ -24,7 +24,8 @@ int intel_tc_port_fia_max_lane_count(struct intel_digital_port *dig_port);
 void intel_tc_port_set_fia_lane_count(struct intel_digital_port *dig_port,
 				      int required_lanes);
 
-void intel_tc_port_sanitize(struct intel_digital_port *dig_port);
+void intel_tc_port_init_mode(struct intel_digital_port *dig_port);
+void intel_tc_port_sanitize_mode(struct intel_digital_port *dig_port);
 void intel_tc_port_lock(struct intel_digital_port *dig_port);
 void intel_tc_port_unlock(struct intel_digital_port *dig_port);
 void intel_tc_port_flush_work(struct intel_digital_port *dig_port);
Signature · 1 line
2.37.1
#1 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Fix TypeC mode initialization during system resume

== Series Details ==

== Series Details ==

Series: drm/i915: Fix TypeC mode initialization during system resume
URL : https://patchwork.freedesktop.org/series/108914/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_12168 -> Patchwork_108914v1
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/index.html

Participating hosts (44 -> 43)
------------------------------

Missing (1): fi-bdw-samus

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_108914v1:

### IGT changes ###

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@i915_selftest@live@gt_pm:
- {bat-adln-1}: NOTRUN -> [DMESG-FAIL][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/bat-adln-1/igt@i915_selftest@live@gt_pm.html

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

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

### IGT changes ###

#### Issues hit ####

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions-varying-size:
- fi-bsw-kefka: [PASS][2] -> [FAIL][3] ([i915#6298])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/fi-bsw-kefka/igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions-varying-size.html
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/fi-bsw-kefka/igt@kms_cursor_legacy@basic-busy-flip-before-cursor@atomic-transitions-varying-size.html

#### Possible fixes ####

* igt@gem_exec_suspend@basic-s0@smem:
- {bat-adlm-1}: [DMESG-WARN][4] ([i915#2867]) -> [PASS][5]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/bat-adlm-1/igt@gem_exec_suspend@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/bat-adlm-1/igt@gem_exec_suspend@[email protected]

* igt@i915_selftest@live@gt_lrc:
- {bat-adln-1}: [INCOMPLETE][6] -> [PASS][7]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/bat-adln-1/igt@i915_selftest@live@gt_lrc.html
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/bat-adln-1/igt@i915_selftest@live@gt_lrc.html

* igt@i915_selftest@live@mman:
- fi-rkl-guc: [INCOMPLETE][8] ([i915#6794]) -> [PASS][9]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/fi-rkl-guc/igt@i915_selftest@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/fi-rkl-guc/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@requests:
- {bat-rpls-1}: [INCOMPLETE][10] ([i915#6257] / [i915#6380]) -> [PASS][11]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/bat-rpls-1/igt@i915_selftest@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/bat-rpls-1/igt@i915_selftest@[email protected]

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

[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#2867]: https://gitlab.freedesktop.org/drm/intel/issues/2867
[i915#6257]: https://gitlab.freedesktop.org/drm/intel/issues/6257
[i915#6298]: https://gitlab.freedesktop.org/drm/intel/issues/6298
[i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
[i915#6380]: https://gitlab.freedesktop.org/drm/intel/issues/6380
[i915#6794]: https://gitlab.freedesktop.org/drm/intel/issues/6794

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

* Linux: CI_DRM_12168 -> Patchwork_108914v1

CI-20190529: 20190529
CI_DRM_12168: fea329811a7bc341aac5f51ab66ec41a3d0844af @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6662: dcb1d7a8822e62935f4fe3f2e6a04caaee669369 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_108914v1: fea329811a7bc341aac5f51ab66ec41a3d0844af @ git://anongit.freedesktop.org/gfx-ci/linux

### Linux commits

2c99fea5b0dc drm/i915: Fix TypeC mode initialization during system resume

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/index.html

#2 lore raw

[Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915: Fix TypeC mode initialization during system resume

In reply to Imre Deak
== Series Details ==

== Series Details ==

Series: drm/i915: Fix TypeC mode initialization during system resume
URL : https://patchwork.freedesktop.org/series/108914/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_12168_full -> Patchwork_108914v1_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

Participating hosts (9 -> 9)
------------------------------

No changes in participating hosts

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_fair@basic-none@vcs1:
- shard-iclb: NOTRUN -> [FAIL][1] ([i915#2842]) +2 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb2/igt@gem_exec_fair@[email protected]

* igt@gem_exec_flush@basic-batch-kernel-default-cmd:
- shard-iclb: NOTRUN -> [SKIP][2] ([fdo#109313])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb5/igt@[email protected]

* igt@gem_exec_nop@basic-series:
- shard-glk: [PASS][3] -> [DMESG-WARN][4] ([i915#118])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-glk3/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-glk7/igt@[email protected]

* igt@gem_huc_copy@huc-copy:
- shard-tglb: [PASS][5] -> [SKIP][6] ([i915#2190])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-tglb5/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-tglb7/igt@[email protected]

* igt@gem_lmem_swapping@basic:
- shard-iclb: NOTRUN -> [SKIP][7] ([i915#4613])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb8/igt@[email protected]

* igt@gem_mmap_gtt@fault-concurrent-y:
- shard-snb: [PASS][8] -> [INCOMPLETE][9] ([i915#5161])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-snb7/igt@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-snb4/igt@[email protected]

* igt@gem_pxp@create-regular-context-1:
- shard-iclb: NOTRUN -> [SKIP][10] ([i915#4270]) +2 similar issues
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb1/igt@[email protected]

* igt@gem_render_copy@y-tiled-to-vebox-linear:
- shard-iclb: NOTRUN -> [SKIP][11] ([i915#768]) +2 similar issues
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb5/igt@[email protected]

* igt@gem_softpin@evict-snoop-interruptible:
- shard-iclb: NOTRUN -> [SKIP][12] ([fdo#109312])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb5/igt@[email protected]

* igt@gem_userptr_blits@coherency-unsync:
- shard-iclb: NOTRUN -> [SKIP][13] ([i915#3297]) +1 similar issue
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb1/igt@[email protected]

* igt@gem_userptr_blits@vma-merge:
- shard-iclb: NOTRUN -> [FAIL][14] ([i915#3318])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb1/igt@[email protected]

* igt@gen3_render_linear_blits:
- shard-iclb: NOTRUN -> [SKIP][15] ([fdo#109289]) +3 similar issues
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb8/igt@gen3_render_linear_blits.html

* igt@gen9_exec_parse@allowed-all:
- shard-glk: [PASS][16] -> [DMESG-WARN][17] ([i915#5566] / [i915#716])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-glk3/igt@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-glk5/igt@[email protected]

* igt@gen9_exec_parse@allowed-single:
- shard-apl: [PASS][18] -> [DMESG-WARN][19] ([i915#5566] / [i915#716])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-apl3/igt@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-apl3/igt@[email protected]

* igt@gen9_exec_parse@bb-start-param:
- shard-iclb: NOTRUN -> [SKIP][20] ([i915#2856]) +2 similar issues
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb8/igt@[email protected]

* igt@i915_pm_dc@dc3co-vpb-simulation:
- shard-iclb: NOTRUN -> [SKIP][21] ([i915#658]) +1 similar issue
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb5/igt@[email protected]

* igt@i915_pm_dc@dc6-psr:
- shard-iclb: [PASS][22] -> [FAIL][23] ([i915#3989] / [i915#454])
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-iclb2/igt@[email protected]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb7/igt@[email protected]

* igt@i915_pm_rpm@modeset-non-lpsp:
- shard-iclb: NOTRUN -> [SKIP][24] ([fdo#110892])
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb5/igt@[email protected]

* igt@kms_big_fb@4-tiled-8bpp-rotate-180:
- shard-iclb: NOTRUN -> [SKIP][25] ([i915#5286]) +2 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb8/igt@[email protected]

* igt@kms_big_fb@y-tiled-64bpp-rotate-90:
- shard-iclb: NOTRUN -> [SKIP][26] ([fdo#110725] / [fdo#111614]) +1 similar issue
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb1/igt@[email protected]

* igt@kms_big_fb@yf-tiled-64bpp-rotate-180:
- shard-iclb: NOTRUN -> [SKIP][27] ([fdo#110723])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb1/igt@[email protected]

* igt@kms_ccs@pipe-b-crc-primary-basic-y_tiled_gen12_rc_ccs_cc:
- shard-iclb: NOTRUN -> [SKIP][28] ([fdo#109278] / [i915#3886]) +6 similar issues
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb5/igt@kms_ccs@pipe-b-crc-primary-basic-y_tiled_gen12_rc_ccs_cc.html

* igt@kms_ccs@pipe-c-crc-primary-basic-y_tiled_gen12_mc_ccs:
- shard-apl: NOTRUN -> [SKIP][29] ([fdo#109271] / [i915#3886]) +5 similar issues
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-apl6/igt@kms_ccs@pipe-c-crc-primary-basic-y_tiled_gen12_mc_ccs.html

* igt@kms_chamelium@dp-mode-timings:
- shard-iclb: NOTRUN -> [SKIP][30] ([fdo#109284] / [fdo#111827]) +5 similar issues
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb1/igt@[email protected]

* igt@kms_chamelium@vga-hpd:
- shard-apl: NOTRUN -> [SKIP][31] ([fdo#109271] / [fdo#111827]) +8 similar issues
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-apl2/igt@[email protected]

* igt@kms_content_protection@atomic:
- shard-apl: NOTRUN -> [TIMEOUT][32] ([i915#1319])
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-apl3/igt@[email protected]

* igt@kms_content_protection@dp-mst-type-1:
- shard-iclb: NOTRUN -> [SKIP][33] ([i915#3116])
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb5/igt@[email protected]

* igt@kms_content_protection@uevent:
- shard-iclb: NOTRUN -> [SKIP][34] ([fdo#109300] / [fdo#111066])
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb1/igt@[email protected]

* igt@kms_cursor_crc@cursor-random-512x512:
- shard-iclb: NOTRUN -> [SKIP][35] ([i915#3359])
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb5/igt@[email protected]

* igt@kms_cursor_legacy@short-busy-flip-before-cursor:
- shard-iclb: NOTRUN -> [SKIP][36] ([i915#4103])
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb8/igt@[email protected]

* igt@kms_flip@2x-wf_vblank-ts-check:
- shard-iclb: NOTRUN -> [SKIP][37] ([fdo#109274]) +3 similar issues
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb8/igt@kms_flip@2x-wf_vblank-ts-check.html

* igt@kms_flip@flip-vs-expired-vblank-interruptible@c-hdmi-a2:
- shard-glk: [PASS][38] -> [FAIL][39] ([i915#79])
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-glk9/igt@kms_flip@[email protected]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-glk3/igt@kms_flip@[email protected]

* igt@kms_flip_scaled_crc@flip-32bpp-4tile-to-64bpp-4tile-downscaling@pipe-a-valid-mode:
- shard-iclb: NOTRUN -> [SKIP][40] ([i915#2587] / [i915#2672]) +4 similar issues
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb5/igt@kms_flip_scaled_crc@flip-32bpp-4tile-to-64bpp-4tile-downscaling@pipe-a-valid-mode.html

* igt@kms_flip_scaled_crc@flip-64bpp-yftile-to-32bpp-yftile-upscaling@pipe-a-default-mode:
- shard-iclb: NOTRUN -> [SKIP][41] ([i915#2672]) +5 similar issues
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb2/igt@kms_flip_scaled_crc@flip-64bpp-yftile-to-32bpp-yftile-upscaling@pipe-a-default-mode.html

* igt@kms_force_connector_basic@force-load-detect:
- shard-iclb: NOTRUN -> [SKIP][42] ([fdo#109285])
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb1/igt@[email protected]

* igt@kms_frontbuffer_tracking@psr-2p-primscrn-cur-indfb-draw-mmap-wc:
- shard-iclb: NOTRUN -> [SKIP][43] ([fdo#109280]) +22 similar issues
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb8/igt@kms_frontbuffer_tracking@psr-2p-primscrn-cur-indfb-draw-mmap-wc.html

* igt@kms_hdr@static-toggle:
- shard-iclb: NOTRUN -> [SKIP][44] ([i915#3555]) +5 similar issues
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb8/igt@[email protected]

* igt@kms_plane@plane-panning-bottom-right-suspend@pipe-b-planes:
- shard-apl: [PASS][45] -> [DMESG-WARN][46] ([i915#180])
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-apl7/igt@kms_plane@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-apl8/igt@kms_plane@[email protected]

* igt@kms_plane_multiple@tiling-yf@pipe-a-edp-1:
- shard-iclb: [PASS][47] -> [FAIL][48] ([i915#1888])
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-iclb8/igt@kms_plane_multiple@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb8/igt@kms_plane_multiple@[email protected]

* igt@kms_plane_scaling@plane-downscale-with-rotation-factor-0-25@pipe-c-edp-1:
- shard-iclb: NOTRUN -> [SKIP][49] ([i915#5176]) +5 similar issues
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb8/igt@kms_plane_scaling@[email protected]

* igt@kms_plane_scaling@planes-upscale-factor-0-25-downscale-factor-0-25@pipe-b-edp-1:
- shard-iclb: NOTRUN -> [SKIP][50] ([i915#5235]) +2 similar issues
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb5/igt@kms_plane_scaling@planes-upscale-factor-0-25-downscale-factor-0-25@pipe-b-edp-1.html

* igt@kms_prime@basic-modeset-hybrid:
- shard-iclb: NOTRUN -> [SKIP][51] ([i915#6524])
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb5/igt@[email protected]

* igt@kms_psr2_sf@plane-move-sf-dmg-area:
- shard-apl: NOTRUN -> [SKIP][52] ([fdo#109271] / [i915#658]) +2 similar issues
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-apl3/igt@[email protected]

* igt@kms_psr@psr2_cursor_blt:
- shard-iclb: NOTRUN -> [SKIP][53] ([fdo#109441]) +2 similar issues
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb8/igt@kms_psr@psr2_cursor_blt.html

* igt@kms_psr@psr2_sprite_plane_move:
- shard-iclb: [PASS][54] -> [SKIP][55] ([fdo#109441]) +2 similar issues
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-iclb2/igt@kms_psr@psr2_sprite_plane_move.html
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb5/igt@kms_psr@psr2_sprite_plane_move.html

* igt@kms_psr@psr2_sprite_plane_onoff:
- shard-apl: NOTRUN -> [SKIP][56] ([fdo#109271]) +135 similar issues
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-apl3/igt@kms_psr@psr2_sprite_plane_onoff.html

* igt@kms_scaling_modes@scaling-mode-none@edp-1-pipe-b:
- shard-iclb: NOTRUN -> [SKIP][57] ([i915#5030]) +2 similar issues
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb8/igt@kms_scaling_modes@[email protected]

* igt@kms_vblank@pipe-d-wait-forked:
- shard-iclb: NOTRUN -> [SKIP][58] ([fdo#109278]) +23 similar issues
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb8/igt@[email protected]

* igt@kms_writeback@writeback-invalid-parameters:
- shard-apl: NOTRUN -> [SKIP][59] ([fdo#109271] / [i915#2437]) +1 similar issue
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-apl3/igt@[email protected]

* igt@nouveau_crc@pipe-c-source-outp-inactive:
- shard-iclb: NOTRUN -> [SKIP][60] ([i915#2530]) +2 similar issues
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb1/igt@[email protected]

* igt@prime_nv_pcopy@test3_2:
- shard-iclb: NOTRUN -> [SKIP][61] ([fdo#109291]) +3 similar issues
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb1/igt@prime_nv_pcopy@test3_2.html

* igt@sysfs_clients@pidname:
- shard-apl: NOTRUN -> [SKIP][62] ([fdo#109271] / [i915#2994]) +1 similar issue
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-apl3/igt@[email protected]

#### Possible fixes ####

* igt@gem_eio@kms:
- shard-tglb: [FAIL][63] ([i915#5784]) -> [PASS][64]
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-tglb2/igt@[email protected]
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-tglb3/igt@[email protected]

* igt@gem_exec_fair@basic-none-share@rcs0:
- shard-glk: [FAIL][65] ([i915#2842]) -> [PASS][66]
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-glk7/igt@gem_exec_fair@[email protected]
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-glk6/igt@gem_exec_fair@[email protected]
- shard-iclb: [FAIL][67] ([i915#2842]) -> [PASS][68]
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-iclb1/igt@gem_exec_fair@[email protected]
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb3/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-none-solo@rcs0:
- shard-apl: [FAIL][69] ([i915#2842]) -> [PASS][70] +1 similar issue
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-apl6/igt@gem_exec_fair@[email protected]
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-apl8/igt@gem_exec_fair@[email protected]

* igt@gem_workarounds@suspend-resume:
- shard-apl: [DMESG-WARN][71] ([i915#180]) -> [PASS][72] +3 similar issues
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-apl8/igt@[email protected]
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-apl6/igt@[email protected]

* igt@kms_async_flips@alternate-sync-async-flip@pipe-c-hdmi-a-1:
- shard-glk: [FAIL][73] ([i915#2521]) -> [PASS][74]
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-glk9/igt@kms_async_flips@[email protected]
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-glk3/igt@kms_async_flips@[email protected]

* igt@kms_psr@psr2_primary_blt:
- shard-iclb: [SKIP][75] ([fdo#109441]) -> [PASS][76]
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-iclb3/igt@kms_psr@psr2_primary_blt.html
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb2/igt@kms_psr@psr2_primary_blt.html

#### Warnings ####

* igt@kms_psr2_sf@overlay-plane-move-continuous-exceed-fully-sf:
- shard-iclb: [SKIP][77] ([i915#2920]) -> [SKIP][78] ([i915#658])
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-iclb2/igt@[email protected]
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb7/igt@[email protected]

* igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area:
- shard-iclb: [SKIP][79] ([fdo#111068] / [i915#658]) -> [SKIP][80] ([i915#2920]) +1 similar issue
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-iclb6/igt@[email protected]
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb2/igt@[email protected]

* igt@kms_psr2_sf@plane-move-sf-dmg-area:
- shard-iclb: [SKIP][81] ([i915#2920]) -> [SKIP][82] ([fdo#111068] / [i915#658]) +1 similar issue
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-iclb2/igt@[email protected]
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb7/igt@[email protected]

* igt@kms_psr2_su@page_flip-p010:
- shard-iclb: [SKIP][83] ([fdo#109642] / [fdo#111068] / [i915#658]) -> [FAIL][84] ([i915#5939])
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-iclb7/igt@kms_psr2_su@page_flip-p010.html
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-iclb2/igt@kms_psr2_su@page_flip-p010.html

* igt@runner@aborted:
- shard-apl: ([FAIL][85], [FAIL][86], [FAIL][87], [FAIL][88], [FAIL][89], [FAIL][90]) ([fdo#109271] / [i915#180] / [i915#3002] / [i915#4312]) -> ([FAIL][91], [FAIL][92], [FAIL][93], [FAIL][94]) ([fdo#109271] / [i915#3002] / [i915#4312])
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-apl3/igt@[email protected]
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-apl8/igt@[email protected]
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-apl7/igt@[email protected]
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-apl1/igt@[email protected]
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-apl8/igt@[email protected]
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12168/shard-apl6/igt@[email protected]
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-apl8/igt@[email protected]
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-apl2/igt@[email protected]
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-apl3/igt@[email protected]
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_108914v1/shard-apl2/igt@[email protected]

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
[fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109291]: https://bugs.freedesktop.org/show_bug.cgi?id=109291
[fdo#109300]: https://bugs.freedesktop.org/show_bug.cgi?id=109300
[fdo#109312]: https://bugs.freedesktop.org/show_bug.cgi?id=109312
[fdo#109313]: https://bugs.freedesktop.org/show_bug.cgi?id=109313
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642
[fdo#110723]: https://bugs.freedesktop.org/show_bug.cgi?id=110723
[fdo#110725]: https://bugs.freedesktop.org/show_bug.cgi?id=110725
[fdo#110892]: https://bugs.freedesktop.org/show_bug.cgi?id=110892
[fdo#111066]: https://bugs.freedesktop.org/show_bug.cgi?id=111066
[fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
[fdo#111614]: https://bugs.freedesktop.org/show_bug.cgi?id=111614
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#118]: https://gitlab.freedesktop.org/drm/intel/issues/118
[i915#1319]: https://gitlab.freedesktop.org/drm/intel/issues/1319
[i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
[i915#1888]: https://gitlab.freedesktop.org/drm/intel/issues/1888
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2437]: https://gitlab.freedesktop.org/drm/intel/issues/2437
[i915#2521]: https://gitlab.freedesktop.org/drm/intel/issues/2521
[i915#2530]: https://gitlab.freedesktop.org/drm/intel/issues/2530
[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#2920]: https://gitlab.freedesktop.org/drm/intel/issues/2920
[i915#2994]: https://gitlab.freedesktop.org/drm/intel/issues/2994
[i915#3002]: https://gitlab.freedesktop.org/drm/intel/issues/3002
[i915#3116]: https://gitlab.freedesktop.org/drm/intel/issues/3116
[i915#3297]: https://gitlab.freedesktop.org/drm/intel/issues/3297
[i915#3318]: https://gitlab.freedesktop.org/drm/intel/issues/3318
[i915#3359]: https://gitlab.freedesktop.org/drm/intel/issues/3359
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
[i915#3989]: https://gitlab.freedesktop.org/drm/intel/issues/3989
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#454]: https://gitlab.freedesktop.org/drm/intel/issues/454
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#5030]: https://gitlab.freedesktop.org/drm/intel/issues/5030
[i915#5161]: https://gitlab.freedesktop.org/drm/intel/issues/5161
[i915#5176]: https://gitlab.freedesktop.org/drm/intel/issues/5176
[i915#5235]: https://gitlab.freedesktop.org/drm/intel/issues/5235
[i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
[i915#5566]: https://gitlab.freedesktop.org/drm/intel/issues/5566
[i915#5784]: https://gitlab.freedesktop.org/drm/intel/issues/5784
[i915#5939]: https://gitlab.freedesktop.org/drm/intel/issues/5939
[i915#6524]: https://gitlab.freedesktop.org/drm/intel/issues/6524
[i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
[i915#716]: https://gitlab.freedesktop.org/drm/intel/issues/716
[i915#768]: https://gitlab.freedesktop.org/drm/intel/issues/768
[i915#79]: https://gitlab.freedesktop.org/drm/intel/issues/79

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

* Linux: CI_DRM_12168 -> Patchwork_108914v1

CI-20190529: 20190529
CI_DRM_12168: fea329811a7bc341aac5f51ab66ec41a3d0844af @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6662: dcb1d7a8822e62935f4fe3f2e6a04caaee669369 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_108914v1: fea329811a7bc341aac5f51ab66ec41a3d0844af @ 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_108914v1/index.html

Reviewed-by on v1 1/1
#3 lore raw
In reply to Imre Deak
Quoted 67 lines

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Imre Deak
Sent: Thursday, September 22, 2022 8:22 PM
To: [email protected]
Subject: [Intel-gfx] [PATCH] drm/i915: Fix TypeC mode initialization during system resume

During system resume DP MST requires AUX to be working already before the HW state readout of the given encoder. Since AUX requires the encoder/PHY TypeC mode to be initialized, which atm only happens during HW state readout, these AUX transfers can change the TypeC mode incorrectly (disconnecting the PHY for an enabled encoder) and trigger the state check WARNs in intel_tc_port_sanitize().

Fix this by initializing the TypeC mode earlier both during driver loading and system resume and making sure that the mode can't change until the encoder's state is read out. While at it add the missing DocBook comments and rename intel_tc_port_sanitize()->intel_tc_port_sanitize_mode() for consistency.

---
 drivers/gpu/drm/i915/display/intel_ddi.c |  8 ++-
drivers/gpu/drm/i915/display/intel_tc.c  | 68 ++++++++++++++++++------
drivers/gpu/drm/i915/display/intel_tc.h  |  3 +-
 3 files changed, 61 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/display/intel_ddi.c +1 -1
index 643832d55c282..5ce5e885694c8 100644
@@ -3591,7 +3591,7 @@ static void intel_ddi_sync_state(struct intel_encoder
 *encoder,
 	enum phy phy = intel_port_to_phy(i915, encoder->port);
 
 	if (intel_phy_is_tc(i915, phy))
-		intel_tc_port_sanitize(enc_to_dig_port(encoder));
+		intel_tc_port_sanitize_mode(enc_to_dig_port(encoder));
 
 	if (crtc_state && intel_crtc_has_dp_encoder(crtc_state))

intel_dp_sync_state(encoder, crtc_state); @@ -3789,11
+3789,17 @@ static void intel_ddi_encoder_destroy(struct drm_encoder *encoder)

static void intel_ddi_encoder_reset(struct drm_encoder *encoder) {

drivers/gpu/drm/i915/display/intel_ddi.c +2 -0
+	struct drm_i915_private *i915 = to_i915(encoder->dev);
 	struct intel_dp *intel_dp = enc_to_intel_dp(to_intel_encoder(encoder));
+	struct intel_digital_port *dig_port =

enc_to_dig_port(to_intel_encoder(encoder));

drivers/gpu/drm/i915/display/intel_ddi.c +4 -0
+	enum phy phy = intel_port_to_phy(i915, dig_port->base.port);
 
 	intel_dp->reset_link_params = true;
 
 	intel_pps_encoder_reset(intel_dp);
+
+	if (intel_phy_is_tc(i915, phy))
+		intel_tc_port_init_mode(dig_port);
 }
 
 static const struct drm_encoder_funcs intel_ddi_funcs = { diff --git

a/drivers/gpu/drm/i915/display/intel_tc.c
b/drivers/gpu/drm/i915/display/intel_tc.c
index e5af955b5600f..b0aa1edd83028 100644

drivers/gpu/drm/i915/display/intel_tc.c static void · line 692

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_tc.c +0 -3
@@ -687,18 +687,58 @@ static void
 intel_tc_port_link_init_refcount(struct intel_digital_port *dig_port,
 				 int refcount)
 {
-	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
-
-	drm_WARN_ON(&i915->drm, dig_port->tc_link_refcount);

I was thinking whether we should drop this function or not? This is now reduced as one liner.

Anyway, patch looks ok to me.

Quoted 130 lines
drivers/gpu/drm/i915/display/intel_tc.c +21 -2
 	dig_port->tc_link_refcount = refcount;  }
 
-void intel_tc_port_sanitize(struct intel_digital_port *dig_port)
+/**
+ * intel_tc_port_init_mode: Read out HW state and init the given port's
+TypeC mode
+ * @dig_port: digital port
+ *
+ * Read out the HW state and initialize the TypeC mode of @dig_port.
+The mode
+ * will be locked until intel_tc_port_sanitize_mode() is called.
+ */
+void intel_tc_port_init_mode(struct intel_digital_port *dig_port)
 {
 	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
-	struct intel_encoder *encoder = &dig_port->base;
 	intel_wakeref_t tc_cold_wref;
 	enum intel_display_power_domain domain;
+
+	mutex_lock(&dig_port->tc_lock);
+
+	drm_WARN_ON(&i915->drm, dig_port->tc_mode !=
 TC_PORT_DISCONNECTED);
+	drm_WARN_ON(&i915->drm, dig_port->tc_lock_wakeref);
+	drm_WARN_ON(&i915->drm, dig_port->tc_link_refcount);
+
+	tc_cold_wref = tc_cold_block(dig_port, &domain);
+
+	dig_port->tc_mode = intel_tc_port_get_current_mode(dig_port);
+	/* Prevent changing dig_port->tc_mode until

intel_tc_port_sanitize_mode() is called. */

drivers/gpu/drm/i915/display/intel_tc.c +30 -9
+	intel_tc_port_link_init_refcount(dig_port, 1);
+	dig_port->tc_lock_wakeref = tc_cold_block(dig_port,
+&dig_port->tc_lock_power_domain);
+
+	tc_cold_unblock(dig_port, domain, tc_cold_wref);
+
+	drm_dbg_kms(&i915->drm, "Port %s: init mode (%s)\n",
+		    dig_port->tc_port_name,
+		    tc_port_mode_name(dig_port->tc_mode));
+
+	mutex_unlock(&dig_port->tc_lock);
+}
+
+/**
+ * intel_tc_port_sanitize_mode: Sanitize the given port's TypeC mode
+ * @dig_port: digital port
+ *
+ * Sanitize @dig_port's TypeC mode wrt. the encoder's state right after
+driver
+ * loading and system resume:
+ * If the encoder is enabled keep the TypeC mode/PHY connected state
+locked until
+ * the encoder is disabled.
+ * If the encoder is disabled make sure the PHY is disconnected.
+ */
+void intel_tc_port_sanitize_mode(struct intel_digital_port *dig_port) {
+	struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
+	struct intel_encoder *encoder = &dig_port->base;
 	int active_links = 0;
 
 	mutex_lock(&dig_port->tc_lock);
@@ -708,21 +748,14 @@ void intel_tc_port_sanitize(struct intel_digital_port
 *dig_port)
 	else if (encoder->base.crtc)
 		active_links = to_intel_crtc(encoder->base.crtc)->active;
 
-	drm_WARN_ON(&i915->drm, dig_port->tc_mode !=
 TC_PORT_DISCONNECTED);
-	drm_WARN_ON(&i915->drm, dig_port->tc_lock_wakeref);
+	drm_WARN_ON(&i915->drm, dig_port->tc_link_refcount != 1);
+	intel_tc_port_link_init_refcount(dig_port, active_links);
 
-	tc_cold_wref = tc_cold_block(dig_port, &domain);
-
-	dig_port->tc_mode = intel_tc_port_get_current_mode(dig_port);
 	if (active_links) {
 		if (!icl_tc_phy_is_connected(dig_port))
 			drm_dbg_kms(&i915->drm,
 				    "Port %s: PHY disconnected with %d active
 link(s)\n",
 				    dig_port->tc_port_name, active_links);
-		intel_tc_port_link_init_refcount(dig_port, active_links);
-
-		dig_port->tc_lock_wakeref = tc_cold_block(dig_port,
-							  &dig_port-
Quoted 1 line

tc_lock_power_domain);

drivers/gpu/drm/i915/display/intel_tc.c +0 -0
 	} else {
 		/*
 		 * TBT-alt is the default mode in any case the PHY ownership is

not @@ -736,9 +769,10 @@ void intel_tc_port_sanitize(struct intel_digital_port *dig_port)

drivers/gpu/drm/i915/display/intel_tc.c +5 -2
 				    dig_port->tc_port_name,
 				    tc_port_mode_name(dig_port->tc_mode));
 		icl_tc_phy_disconnect(dig_port);
-	}
 
-	tc_cold_unblock(dig_port, domain, tc_cold_wref);
+		tc_cold_unblock(dig_port, dig_port->tc_lock_power_domain,
+				fetch_and_zero(&dig_port->tc_lock_wakeref));
+	}
 
 	drm_dbg_kms(&i915->drm, "Port %s: sanitize mode (%s)\n",
 		    dig_port->tc_port_name,
@@ -923,4 +957,6 @@ void intel_tc_port_init(struct intel_digital_port
 *dig_port, bool is_legacy)
 	dig_port->tc_mode = TC_PORT_DISCONNECTED;
 	dig_port->tc_link_refcount = 0;
 	tc_port_load_fia_params(i915, dig_port);
+
+	intel_tc_port_init_mode(dig_port);

}

drivers/gpu/drm/i915/display/intel_tc.h +0 -0
index 6b47b29f551c9..d54082e2d5e8d 100644
@@ -24,7 +24,8 @@ int intel_tc_port_fia_max_lane_count(struct

intel_digital_port *dig_port); void intel_tc_port_set_fia_lane_count(struct intel_digital_port *dig_port,

drivers/gpu/drm/i915/display/intel_tc.h +2 -1
 				      int required_lanes);
 
-void intel_tc_port_sanitize(struct intel_digital_port *dig_port);
+void intel_tc_port_init_mode(struct intel_digital_port *dig_port); void
+intel_tc_port_sanitize_mode(struct intel_digital_port *dig_port);
 void intel_tc_port_lock(struct intel_digital_port *dig_port);  void

intel_tc_port_unlock(struct intel_digital_port *dig_port); void intel_tc_port_flush_work(struct intel_digital_port *dig_port); --
2.37.1

author
#4 lore raw
Quoted 60 lines · Mika
Quoted 60 lines

-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Imre Deak
Sent: Thursday, September 22, 2022 8:22 PM
To: [email protected]
Subject: [Intel-gfx] [PATCH] drm/i915: Fix TypeC mode initialization during system resume

During system resume DP MST requires AUX to be working already before the HW state readout of the given encoder. Since AUX requires the encoder/PHY TypeC mode to be initialized, which atm only happens during HW state readout, these AUX transfers can change the TypeC mode incorrectly (disconnecting the PHY for an enabled encoder) and trigger the state check WARNs in intel_tc_port_sanitize().

Fix this by initializing the TypeC mode earlier both during driver loading and system resume and making sure that the mode can't change until the encoder's state is read out. While at it add the missing DocBook comments and rename intel_tc_port_sanitize()->intel_tc_port_sanitize_mode() for consistency.

---
 drivers/gpu/drm/i915/display/intel_ddi.c |  8 ++-
drivers/gpu/drm/i915/display/intel_tc.c  | 68 ++++++++++++++++++------
drivers/gpu/drm/i915/display/intel_tc.h  |  3 +-
 3 files changed, 61 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/display/intel_ddi.c +1 -1
index 643832d55c282..5ce5e885694c8 100644
@@ -3591,7 +3591,7 @@ static void intel_ddi_sync_state(struct intel_encoder
 *encoder,
      enum phy phy = intel_port_to_phy(i915, encoder->port);
 
      if (intel_phy_is_tc(i915, phy))
-             intel_tc_port_sanitize(enc_to_dig_port(encoder));
+             intel_tc_port_sanitize_mode(enc_to_dig_port(encoder));
 
      if (crtc_state && intel_crtc_has_dp_encoder(crtc_state))
              intel_dp_sync_state(encoder, crtc_state); @@ -3789,11

+3789,17 @@ static void intel_ddi_encoder_destroy(struct drm_encoder *encoder)

static void intel_ddi_encoder_reset(struct drm_encoder *encoder) {

drivers/gpu/drm/i915/display/intel_ddi.c +2 -0
+     struct drm_i915_private *i915 = to_i915(encoder->dev);
      struct intel_dp *intel_dp = enc_to_intel_dp(to_intel_encoder(encoder));
+     struct intel_digital_port *dig_port =

enc_to_dig_port(to_intel_encoder(encoder));

drivers/gpu/drm/i915/display/intel_ddi.c +4 -0
+     enum phy phy = intel_port_to_phy(i915, dig_port->base.port);
 
      intel_dp->reset_link_params = true;
 
      intel_pps_encoder_reset(intel_dp);
+
+     if (intel_phy_is_tc(i915, phy))
+             intel_tc_port_init_mode(dig_port);
 }
Quoted 16 lines

drivers/gpu/drm/i915/display/intel_tc.c static void · line 692

Quoted 13 lines

static const struct drm_encoder_funcs intel_ddi_funcs = { diff --git
a/drivers/gpu/drm/i915/display/intel_tc.c b/drivers/gpu/drm/i915/display/intel_tc.c
index e5af955b5600f..b0aa1edd83028 100644

drivers/gpu/drm/i915/display/intel_tc.c +0 -3
@@ -687,18 +687,58 @@ static void
 intel_tc_port_link_init_refcount(struct intel_digital_port *dig_port,
                               int refcount)
 {
-     struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
-
-     drm_WARN_ON(&i915->drm, dig_port->tc_link_refcount);

I was thinking whether we should drop this function or not? This is now reduced as one liner.

The function also meant to document that setting the refcount directly (vs. the usual inc/dec on it) is done only during init time.

Quoted 135 lines

Anyway, patch looks ok to me.

Quoted 130 lines
drivers/gpu/drm/i915/display/intel_tc.c +21 -2
      dig_port->tc_link_refcount = refcount;  }
 
-void intel_tc_port_sanitize(struct intel_digital_port *dig_port)
+/**
+ * intel_tc_port_init_mode: Read out HW state and init the given port's
+TypeC mode
+ * @dig_port: digital port
+ *
+ * Read out the HW state and initialize the TypeC mode of @dig_port.
+The mode
+ * will be locked until intel_tc_port_sanitize_mode() is called.
+ */
+void intel_tc_port_init_mode(struct intel_digital_port *dig_port)
 {
      struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
-     struct intel_encoder *encoder = &dig_port->base;
      intel_wakeref_t tc_cold_wref;
      enum intel_display_power_domain domain;
+
+     mutex_lock(&dig_port->tc_lock);
+
+     drm_WARN_ON(&i915->drm, dig_port->tc_mode !=
 TC_PORT_DISCONNECTED);
+     drm_WARN_ON(&i915->drm, dig_port->tc_lock_wakeref);
+     drm_WARN_ON(&i915->drm, dig_port->tc_link_refcount);
+
+     tc_cold_wref = tc_cold_block(dig_port, &domain);
+
+     dig_port->tc_mode = intel_tc_port_get_current_mode(dig_port);
+     /* Prevent changing dig_port->tc_mode until

intel_tc_port_sanitize_mode() is called. */

drivers/gpu/drm/i915/display/intel_tc.c +30 -9
+     intel_tc_port_link_init_refcount(dig_port, 1);
+     dig_port->tc_lock_wakeref = tc_cold_block(dig_port,
+&dig_port->tc_lock_power_domain);
+
+     tc_cold_unblock(dig_port, domain, tc_cold_wref);
+
+     drm_dbg_kms(&i915->drm, "Port %s: init mode (%s)\n",
+                 dig_port->tc_port_name,
+                 tc_port_mode_name(dig_port->tc_mode));
+
+     mutex_unlock(&dig_port->tc_lock);
+}
+
+/**
+ * intel_tc_port_sanitize_mode: Sanitize the given port's TypeC mode
+ * @dig_port: digital port
+ *
+ * Sanitize @dig_port's TypeC mode wrt. the encoder's state right after
+driver
+ * loading and system resume:
+ * If the encoder is enabled keep the TypeC mode/PHY connected state
+locked until
+ * the encoder is disabled.
+ * If the encoder is disabled make sure the PHY is disconnected.
+ */
+void intel_tc_port_sanitize_mode(struct intel_digital_port *dig_port) {
+     struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
+     struct intel_encoder *encoder = &dig_port->base;
      int active_links = 0;
 
      mutex_lock(&dig_port->tc_lock);
@@ -708,21 +748,14 @@ void intel_tc_port_sanitize(struct intel_digital_port
 *dig_port)
      else if (encoder->base.crtc)
              active_links = to_intel_crtc(encoder->base.crtc)->active;
 
-     drm_WARN_ON(&i915->drm, dig_port->tc_mode !=
 TC_PORT_DISCONNECTED);
-     drm_WARN_ON(&i915->drm, dig_port->tc_lock_wakeref);
+     drm_WARN_ON(&i915->drm, dig_port->tc_link_refcount != 1);
+     intel_tc_port_link_init_refcount(dig_port, active_links);
 
-     tc_cold_wref = tc_cold_block(dig_port, &domain);
-
-     dig_port->tc_mode = intel_tc_port_get_current_mode(dig_port);
      if (active_links) {
              if (!icl_tc_phy_is_connected(dig_port))
                      drm_dbg_kms(&i915->drm,
                                  "Port %s: PHY disconnected with %d active
 link(s)\n",
                                  dig_port->tc_port_name, active_links);
-             intel_tc_port_link_init_refcount(dig_port, active_links);
-
-             dig_port->tc_lock_wakeref = tc_cold_block(dig_port,
-                                                       &dig_port-
Quoted 1 line

tc_lock_power_domain);

      } else {
              /*
               * TBT-alt is the default mode in any case the PHY ownership is
not @@ -736,9 +769,10 @@ void intel_tc_port_sanitize(struct intel_digital_port
*dig_port)
                                  dig_port->tc_port_name,
                                  tc_port_mode_name(dig_port->tc_mode));
              icl_tc_phy_disconnect(dig_port);
drivers/gpu/drm/i915/display/intel_tc.c +5 -2
-     }
 
-     tc_cold_unblock(dig_port, domain, tc_cold_wref);
+             tc_cold_unblock(dig_port, dig_port->tc_lock_power_domain,
+                             fetch_and_zero(&dig_port->tc_lock_wakeref));
+     }
 
      drm_dbg_kms(&i915->drm, "Port %s: sanitize mode (%s)\n",
                  dig_port->tc_port_name,
@@ -923,4 +957,6 @@ void intel_tc_port_init(struct intel_digital_port
 *dig_port, bool is_legacy)
      dig_port->tc_mode = TC_PORT_DISCONNECTED;
      dig_port->tc_link_refcount = 0;
      tc_port_load_fia_params(i915, dig_port);
+
+     intel_tc_port_init_mode(dig_port);

}

drivers/gpu/drm/i915/display/intel_tc.h +0 -0
index 6b47b29f551c9..d54082e2d5e8d 100644
@@ -24,7 +24,8 @@ int intel_tc_port_fia_max_lane_count(struct

intel_digital_port *dig_port); void intel_tc_port_set_fia_lane_count(struct intel_digital_port *dig_port,

                                    int required_lanes);
drivers/gpu/drm/i915/display/intel_tc.h +2 -1
-void intel_tc_port_sanitize(struct intel_digital_port *dig_port);
+void intel_tc_port_init_mode(struct intel_digital_port *dig_port); void
+intel_tc_port_sanitize_mode(struct intel_digital_port *dig_port);
 void intel_tc_port_lock(struct intel_digital_port *dig_port);  void

intel_tc_port_unlock(struct intel_digital_port *dig_port); void intel_tc_port_flush_work(struct intel_digital_port *dig_port); --
2.37.1