Skip to contentSkip to conversation

drm/i915/icl+: Prevent using non-TypeC AUX channels on TypeC ports

PATCH In review Imre Deak 3 participants 7 messages Apr 23, 2020 – Apr 28, 2020

Subsystems (3)
lore
Share & tools
lore

Imre Deak

author
#0 lore raw

PATCH 1/1 drm/i915/icl+: Prevent using non-TypeC AUX channels on TypeC ports

Using an AUX channel which by default belongs to a non-TypeC PHY won't work on a TypeC PHY, since - as a side-effect besides providing an AUX channel - the AUX channel power well affects power manangement specific to the TypeC subsystem. Using a TypeC AUX channel on a non-TypeC PHY would probably also cause problems, so for simplicity prevent both.

This fixes at least an ICL-Y machine in CI, which has a buggy VBT setting AUX-B as an alternative channel for port C.

---
 drivers/gpu/drm/i915/display/intel_bios.c | 84 +++++++++++++++--------
 1 file changed, 57 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/display/intel_bios.c +57 -27
index 839124647202..10d463723d12 100644
@@ -1538,11 +1538,38 @@ static enum port get_port_by_aux_ch(struct drm_i915_private *i915, u8 aux_ch)
 	return PORT_NONE;
 }
 
+static enum aux_ch
+intel_bios_port_info_aux_ch(const struct ddi_vbt_port_info *info)
+{
+	switch (info->alternate_aux_channel) {
+	case DP_AUX_A:
+		return AUX_CH_A;
+	case DP_AUX_B:
+		return AUX_CH_B;
+	case DP_AUX_C:
+		return AUX_CH_C;
+	case DP_AUX_D:
+		return AUX_CH_D;
+	case DP_AUX_E:
+		return AUX_CH_E;
+	case DP_AUX_F:
+		return AUX_CH_F;
+	case DP_AUX_G:
+		return AUX_CH_G;
+	default:
+		MISSING_CASE(info->alternate_aux_channel);
+		return AUX_CH_A;
+	}
+}
+
 static void sanitize_aux_ch(struct drm_i915_private *dev_priv,
 			    enum port port)
 {
 	struct ddi_vbt_port_info *info = &dev_priv->vbt.ddi_port_info[port];
 	enum port p;
+	enum aux_ch aux_ch;
+	bool aux_is_tc;
+	bool phy_is_tc;
 
 	if (!info->alternate_aux_channel)
 		return;
@@ -1571,6 +1598,35 @@ static void sanitize_aux_ch(struct drm_i915_private *dev_priv,
 
 		info->supports_dp = false;
 		info->alternate_aux_channel = 0;
+
+		return;
+	}
+
+	aux_ch = intel_bios_port_info_aux_ch(info);
+	/* The AUX CH -> default port is a 1:1 mapping. */
+	aux_is_tc = intel_phy_is_tc(dev_priv,
+				    intel_port_to_phy(dev_priv,
+						      (enum port)aux_ch));
+	phy_is_tc = intel_phy_is_tc(dev_priv,
+				    intel_port_to_phy(dev_priv, port));
+	if (aux_is_tc != phy_is_tc) {
+		/*
+		 * Using an AUX channel which by default belongs to a TypeC
+		 * PHY can't be used for non-TypeC PHYs and vice-versa. The
+		 * reason is that TypeC AUX power wells can only be enabled in
+		 * the current TypeC mode of the PHY and have an effect on power
+		 * management specific to the TypeC subsystem.
+		 */
+		drm_dbg_kms(&dev_priv->drm,
+			    "Port %c on a %s PHY is trying to use the %s AUX CH %c, "
+			    "disabling DP support on this port.\n",
+			    port_name(port),
+			    phy_is_tc ? "TypeC" : "non-TypeC",
+			    aux_is_tc ? "TypeC" : "non-TypeC",
+			    aux_ch_name(aux_ch));
+
+		info->supports_dp = false;
+		info->alternate_aux_channel = 0;
 	}
 }
 
@@ -2595,33 +2651,7 @@ enum aux_ch intel_bios_port_aux_ch(struct drm_i915_private *dev_priv,
 		return aux_ch;
 	}
 
-	switch (info->alternate_aux_channel) {
-	case DP_AUX_A:
-		aux_ch = AUX_CH_A;
-		break;
-	case DP_AUX_B:
-		aux_ch = AUX_CH_B;
-		break;
-	case DP_AUX_C:
-		aux_ch = AUX_CH_C;
-		break;
-	case DP_AUX_D:
-		aux_ch = AUX_CH_D;
-		break;
-	case DP_AUX_E:
-		aux_ch = AUX_CH_E;
-		break;
-	case DP_AUX_F:
-		aux_ch = AUX_CH_F;
-		break;
-	case DP_AUX_G:
-		aux_ch = AUX_CH_G;
-		break;
-	default:
-		MISSING_CASE(info->alternate_aux_channel);
-		aux_ch = AUX_CH_A;
-		break;
-	}
+	aux_ch = intel_bios_port_info_aux_ch(info);
 
 	drm_dbg_kms(&dev_priv->drm, "using AUX %c for port %c (VBT)\n",
 		    aux_ch_name(aux_ch), port_name(port));
Signature · 6 lines
2.23.1

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

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/icl+: Prevent using non-TypeC AUX channels on TypeC ports

== Series Details ==

== Series Details ==

Series: drm/i915/icl+: Prevent using non-TypeC AUX channels on TypeC ports
URL : https://patchwork.freedesktop.org/series/76405/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_8354 -> Patchwork_17444
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

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

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

### IGT changes ###

#### Issues hit ####

* igt@kms_chamelium@dp-edid-read:
- fi-kbl-7500u: [PASS][1] -> [FAIL][2] ([i915#976])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8354/fi-kbl-7500u/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17444/fi-kbl-7500u/igt@[email protected]

[i915#976]: https://gitlab.freedesktop.org/drm/intel/issues/976

Participating hosts (48 -> 44)
------------------------------

Additional (2): fi-kbl-7560u fi-bwr-2160
Missing (6): fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper fi-bdw-samus

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

* CI: CI-20190529 -> None
* Linux: CI_DRM_8354 -> Patchwork_17444

CI-20190529: 20190529
CI_DRM_8354: 6ec6eeeda39e1733777f9115ba813a992a47b5fe @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5608: e7bcaf1dd251d454706c7cd64282f531aec50183 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_17444: bf5e56c5f4fe0da1b56e14c0b6247fefe501fec2 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

bf5e56c5f4fe drm/i915/icl+: Prevent using non-TypeC AUX channels on TypeC ports

== Logs ==

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

#2 lore raw

[Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915/icl+: Prevent using non-TypeC AUX channels on TypeC ports

In reply to Imre Deak
== Series Details ==

== Series Details ==

Series: drm/i915/icl+: Prevent using non-TypeC AUX channels on TypeC ports
URL : https://patchwork.freedesktop.org/series/76405/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_8354_full -> Patchwork_17444_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_workarounds@suspend-resume-context:
- shard-iclb: [PASS][1] -> [INCOMPLETE][2] ([i915#1185])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8354/shard-iclb2/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17444/shard-iclb3/igt@[email protected]

* igt@i915_suspend@fence-restore-tiled2untiled:
- shard-skl: [PASS][3] -> [INCOMPLETE][4] ([i915#69])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8354/shard-skl2/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17444/shard-skl5/igt@[email protected]

* igt@kms_cursor_crc@pipe-a-cursor-128x128-offscreen:
- shard-apl: [PASS][5] -> [FAIL][6] ([i915#54] / [i915#95])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8354/shard-apl2/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17444/shard-apl4/igt@[email protected]

* igt@kms_cursor_crc@pipe-c-cursor-suspend:
- shard-skl: [PASS][7] -> [INCOMPLETE][8] ([i915#300])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8354/shard-skl6/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17444/shard-skl5/igt@[email protected]

* igt@kms_cursor_legacy@2x-long-flip-vs-cursor-legacy:
- shard-glk: [PASS][9] -> [FAIL][10] ([i915#72])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8354/shard-glk9/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17444/shard-glk7/igt@[email protected]

* igt@kms_draw_crc@draw-method-rgb565-blt-xtiled:
- shard-glk: [PASS][11] -> [FAIL][12] ([i915#52] / [i915#54])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8354/shard-glk8/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17444/shard-glk6/igt@[email protected]

* igt@kms_hdr@bpc-switch-dpms:
- shard-skl: [PASS][13] -> [FAIL][14] ([i915#1188])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8354/shard-skl8/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17444/shard-skl4/igt@[email protected]

* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes:
- shard-apl: [PASS][15] -> [DMESG-WARN][16] ([i915#180]) +1 similar issue
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8354/shard-apl3/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17444/shard-apl6/igt@[email protected]
- shard-kbl: [PASS][17] -> [DMESG-WARN][18] ([i915#180])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8354/shard-kbl2/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17444/shard-kbl1/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-b-coverage-7efc:
- shard-skl: [PASS][19] -> [FAIL][20] ([fdo#108145] / [i915#265])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8354/shard-skl2/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17444/shard-skl5/igt@[email protected]

#### Possible fixes ####

* {igt@kms_flip@flip-vs-expired-vblank@b-edp1}:
- shard-skl: [FAIL][21] ([i915#79]) -> [PASS][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8354/shard-skl10/igt@kms_flip@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17444/shard-skl9/igt@kms_flip@[email protected]

* {igt@kms_flip@flip-vs-suspend-interruptible@c-dp1}:
- shard-apl: [DMESG-WARN][23] ([i915#180]) -> [PASS][24] +1 similar issue
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8354/shard-apl8/igt@kms_flip@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17444/shard-apl3/igt@kms_flip@[email protected]

* igt@kms_hdr@bpc-switch-suspend:
- shard-skl: [FAIL][25] ([i915#1188]) -> [PASS][26] +1 similar issue
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8354/shard-skl9/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17444/shard-skl7/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-b-constant-alpha-min:
- shard-skl: [FAIL][27] ([fdo#108145] / [i915#265]) -> [PASS][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8354/shard-skl8/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17444/shard-skl1/igt@[email protected]

* igt@kms_psr@psr2_sprite_mmap_cpu:
- shard-iclb: [SKIP][29] ([fdo#109441]) -> [PASS][30] +1 similar issue
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8354/shard-iclb1/igt@kms_psr@psr2_sprite_mmap_cpu.html
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17444/shard-iclb2/igt@kms_psr@psr2_sprite_mmap_cpu.html

* igt@kms_setmode@basic:
- shard-apl: [FAIL][31] ([i915#31]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8354/shard-apl6/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17444/shard-apl7/igt@[email protected]

* {igt@perf@blocking-parameterized}:
- shard-iclb: [FAIL][33] ([i915#1542]) -> [PASS][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8354/shard-iclb7/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17444/shard-iclb3/igt@[email protected]

* {igt@perf@polling-parameterized}:
- shard-hsw: [FAIL][35] ([i915#1542]) -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8354/shard-hsw2/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17444/shard-hsw2/igt@[email protected]

#### Warnings ####

* igt@i915_pm_rpm@dpms-mode-unset-lpsp:
- shard-snb: [INCOMPLETE][37] ([i915#82]) -> [SKIP][38] ([fdo#109271]) +1 similar issue
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8354/shard-snb2/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17444/shard-snb6/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-blt:
- shard-apl: [FAIL][39] ([i915#49] / [i915#95]) -> [FAIL][40] ([i915#49])
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8354/shard-apl2/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17444/shard-apl4/igt@[email protected]

* igt@kms_psr2_su@page_flip:
- shard-iclb: [SKIP][41] ([fdo#109642] / [fdo#111068]) -> [FAIL][42] ([i915#608])
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8354/shard-iclb1/igt@kms_psr2_su@page_flip.html
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17444/shard-iclb2/igt@kms_psr2_su@page_flip.html

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

[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642
[fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
[i915#1185]: https://gitlab.freedesktop.org/drm/intel/issues/1185
[i915#1188]: https://gitlab.freedesktop.org/drm/intel/issues/1188
[i915#1542]: https://gitlab.freedesktop.org/drm/intel/issues/1542
[i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
[i915#265]: https://gitlab.freedesktop.org/drm/intel/issues/265
[i915#300]: https://gitlab.freedesktop.org/drm/intel/issues/300
[i915#31]: https://gitlab.freedesktop.org/drm/intel/issues/31
[i915#49]: https://gitlab.freedesktop.org/drm/intel/issues/49
[i915#52]: https://gitlab.freedesktop.org/drm/intel/issues/52
[i915#54]: https://gitlab.freedesktop.org/drm/intel/issues/54
[i915#608]: https://gitlab.freedesktop.org/drm/intel/issues/608
[i915#69]: https://gitlab.freedesktop.org/drm/intel/issues/69
[i915#72]: https://gitlab.freedesktop.org/drm/intel/issues/72
[i915#79]: https://gitlab.freedesktop.org/drm/intel/issues/79
[i915#82]: https://gitlab.freedesktop.org/drm/intel/issues/82
[i915#95]: https://gitlab.freedesktop.org/drm/intel/issues/95

Participating hosts (10 -> 10)
------------------------------

No changes in participating hosts

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

* CI: CI-20190529 -> None
* Linux: CI_DRM_8354 -> Patchwork_17444

CI-20190529: 20190529
CI_DRM_8354: 6ec6eeeda39e1733777f9115ba813a992a47b5fe @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5608: e7bcaf1dd251d454706c7cd64282f531aec50183 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_17444: bf5e56c5f4fe0da1b56e14c0b6247fefe501fec2 @ 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_17444/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer
#3 lore raw
In reply to Imre Deak
Quoted 8 lines · Imre Deak

Using an AUX channel which by default belongs to a non-TypeC PHY won't work on a TypeC PHY, since - as a side-effect besides providing an AUX channel - the AUX channel power well affects power manangement specific to the TypeC subsystem. Using a TypeC AUX channel on a non-TypeC PHY would probably also cause problems, so for simplicity prevent both.

This fixes at least an ICL-Y machine in CI, which has a buggy VBT setting AUX-B as an alternative channel for port C.

Is it a production machine? Not happy about adding stuff for pre-pro machines with buggy VBT. It'll bite us later. It always has.

Also, hate to see VBT code call into intel_display.c (intel_phy_is_tc).

BR,
Jani.

Quoted 120 lines
---
 drivers/gpu/drm/i915/display/intel_bios.c | 84 +++++++++++++++--------
 1 file changed, 57 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/display/intel_bios.c +57 -27
index 839124647202..10d463723d12 100644
@@ -1538,11 +1538,38 @@ static enum port get_port_by_aux_ch(struct drm_i915_private *i915, u8 aux_ch)
 	return PORT_NONE;
 }
 
+static enum aux_ch
+intel_bios_port_info_aux_ch(const struct ddi_vbt_port_info *info)
+{
+	switch (info->alternate_aux_channel) {
+	case DP_AUX_A:
+		return AUX_CH_A;
+	case DP_AUX_B:
+		return AUX_CH_B;
+	case DP_AUX_C:
+		return AUX_CH_C;
+	case DP_AUX_D:
+		return AUX_CH_D;
+	case DP_AUX_E:
+		return AUX_CH_E;
+	case DP_AUX_F:
+		return AUX_CH_F;
+	case DP_AUX_G:
+		return AUX_CH_G;
+	default:
+		MISSING_CASE(info->alternate_aux_channel);
+		return AUX_CH_A;
+	}
+}
+
 static void sanitize_aux_ch(struct drm_i915_private *dev_priv,
 			    enum port port)
 {
 	struct ddi_vbt_port_info *info = &dev_priv->vbt.ddi_port_info[port];
 	enum port p;
+	enum aux_ch aux_ch;
+	bool aux_is_tc;
+	bool phy_is_tc;
 
 	if (!info->alternate_aux_channel)
 		return;
@@ -1571,6 +1598,35 @@ static void sanitize_aux_ch(struct drm_i915_private *dev_priv,
 
 		info->supports_dp = false;
 		info->alternate_aux_channel = 0;
+
+		return;
+	}
+
+	aux_ch = intel_bios_port_info_aux_ch(info);
+	/* The AUX CH -> default port is a 1:1 mapping. */
+	aux_is_tc = intel_phy_is_tc(dev_priv,
+				    intel_port_to_phy(dev_priv,
+						      (enum port)aux_ch));
+	phy_is_tc = intel_phy_is_tc(dev_priv,
+				    intel_port_to_phy(dev_priv, port));
+	if (aux_is_tc != phy_is_tc) {
+		/*
+		 * Using an AUX channel which by default belongs to a TypeC
+		 * PHY can't be used for non-TypeC PHYs and vice-versa. The
+		 * reason is that TypeC AUX power wells can only be enabled in
+		 * the current TypeC mode of the PHY and have an effect on power
+		 * management specific to the TypeC subsystem.
+		 */
+		drm_dbg_kms(&dev_priv->drm,
+			    "Port %c on a %s PHY is trying to use the %s AUX CH %c, "
+			    "disabling DP support on this port.\n",
+			    port_name(port),
+			    phy_is_tc ? "TypeC" : "non-TypeC",
+			    aux_is_tc ? "TypeC" : "non-TypeC",
+			    aux_ch_name(aux_ch));
+
+		info->supports_dp = false;
+		info->alternate_aux_channel = 0;
 	}
 }
 
@@ -2595,33 +2651,7 @@ enum aux_ch intel_bios_port_aux_ch(struct drm_i915_private *dev_priv,
 		return aux_ch;
 	}
 
-	switch (info->alternate_aux_channel) {
-	case DP_AUX_A:
-		aux_ch = AUX_CH_A;
-		break;
-	case DP_AUX_B:
-		aux_ch = AUX_CH_B;
-		break;
-	case DP_AUX_C:
-		aux_ch = AUX_CH_C;
-		break;
-	case DP_AUX_D:
-		aux_ch = AUX_CH_D;
-		break;
-	case DP_AUX_E:
-		aux_ch = AUX_CH_E;
-		break;
-	case DP_AUX_F:
-		aux_ch = AUX_CH_F;
-		break;
-	case DP_AUX_G:
-		aux_ch = AUX_CH_G;
-		break;
-	default:
-		MISSING_CASE(info->alternate_aux_channel);
-		aux_ch = AUX_CH_A;
-		break;
-	}
+	aux_ch = intel_bios_port_info_aux_ch(info);
 
 	drm_dbg_kms(&dev_priv->drm, "using AUX %c for port %c (VBT)\n",
 		    aux_ch_name(aux_ch), port_name(port));
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#4 lore raw
Quoted 11 lines · Jani Nikula
Quoted 8 lines · Imre Deak

Using an AUX channel which by default belongs to a non-TypeC PHY won't work on a TypeC PHY, since - as a side-effect besides providing an AUX channel - the AUX channel power well affects power manangement specific to the TypeC subsystem. Using a TypeC AUX channel on a non-TypeC PHY would probably also cause problems, so for simplicity prevent both.

This fixes at least an ICL-Y machine in CI, which has a buggy VBT setting AUX-B as an alternative channel for port C.

Is it a production machine?

Yes.

Quoted 2 lines

Not happy about adding stuff for pre-pro machines with buggy VBT. It'll bite us later. It always has.

If there is a buggy VBT with this issue it will cause a problem somewhere down the pipeline which is difficult to track down, power well timeouts, machine hangs etc. I would like to catch this early and avoid having to spend time debugging these other issues.

Quoted 1 line

Also, hate to see VBT code call into intel_display.c (intel_phy_is_tc).

That's the way to determine if a port/PHY is TypeC on a platform or not.

--Imre

Quoted 123 lines

BR,
Jani.

Quoted 118 lines
---
 drivers/gpu/drm/i915/display/intel_bios.c | 84 +++++++++++++++--------
 1 file changed, 57 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/display/intel_bios.c +57 -27
index 839124647202..10d463723d12 100644
@@ -1538,11 +1538,38 @@ static enum port get_port_by_aux_ch(struct drm_i915_private *i915, u8 aux_ch)
 	return PORT_NONE;
 }
 
+static enum aux_ch
+intel_bios_port_info_aux_ch(const struct ddi_vbt_port_info *info)
+{
+	switch (info->alternate_aux_channel) {
+	case DP_AUX_A:
+		return AUX_CH_A;
+	case DP_AUX_B:
+		return AUX_CH_B;
+	case DP_AUX_C:
+		return AUX_CH_C;
+	case DP_AUX_D:
+		return AUX_CH_D;
+	case DP_AUX_E:
+		return AUX_CH_E;
+	case DP_AUX_F:
+		return AUX_CH_F;
+	case DP_AUX_G:
+		return AUX_CH_G;
+	default:
+		MISSING_CASE(info->alternate_aux_channel);
+		return AUX_CH_A;
+	}
+}
+
 static void sanitize_aux_ch(struct drm_i915_private *dev_priv,
 			    enum port port)
 {
 	struct ddi_vbt_port_info *info = &dev_priv->vbt.ddi_port_info[port];
 	enum port p;
+	enum aux_ch aux_ch;
+	bool aux_is_tc;
+	bool phy_is_tc;
 
 	if (!info->alternate_aux_channel)
 		return;
@@ -1571,6 +1598,35 @@ static void sanitize_aux_ch(struct drm_i915_private *dev_priv,
 
 		info->supports_dp = false;
 		info->alternate_aux_channel = 0;
+
+		return;
+	}
+
+	aux_ch = intel_bios_port_info_aux_ch(info);
+	/* The AUX CH -> default port is a 1:1 mapping. */
+	aux_is_tc = intel_phy_is_tc(dev_priv,
+				    intel_port_to_phy(dev_priv,
+						      (enum port)aux_ch));
+	phy_is_tc = intel_phy_is_tc(dev_priv,
+				    intel_port_to_phy(dev_priv, port));
+	if (aux_is_tc != phy_is_tc) {
+		/*
+		 * Using an AUX channel which by default belongs to a TypeC
+		 * PHY can't be used for non-TypeC PHYs and vice-versa. The
+		 * reason is that TypeC AUX power wells can only be enabled in
+		 * the current TypeC mode of the PHY and have an effect on power
+		 * management specific to the TypeC subsystem.
+		 */
+		drm_dbg_kms(&dev_priv->drm,
+			    "Port %c on a %s PHY is trying to use the %s AUX CH %c, "
+			    "disabling DP support on this port.\n",
+			    port_name(port),
+			    phy_is_tc ? "TypeC" : "non-TypeC",
+			    aux_is_tc ? "TypeC" : "non-TypeC",
+			    aux_ch_name(aux_ch));
+
+		info->supports_dp = false;
+		info->alternate_aux_channel = 0;
 	}
 }
 
@@ -2595,33 +2651,7 @@ enum aux_ch intel_bios_port_aux_ch(struct drm_i915_private *dev_priv,
 		return aux_ch;
 	}
 
-	switch (info->alternate_aux_channel) {
-	case DP_AUX_A:
-		aux_ch = AUX_CH_A;
-		break;
-	case DP_AUX_B:
-		aux_ch = AUX_CH_B;
-		break;
-	case DP_AUX_C:
-		aux_ch = AUX_CH_C;
-		break;
-	case DP_AUX_D:
-		aux_ch = AUX_CH_D;
-		break;
-	case DP_AUX_E:
-		aux_ch = AUX_CH_E;
-		break;
-	case DP_AUX_F:
-		aux_ch = AUX_CH_F;
-		break;
-	case DP_AUX_G:
-		aux_ch = AUX_CH_G;
-		break;
-	default:
-		MISSING_CASE(info->alternate_aux_channel);
-		aux_ch = AUX_CH_A;
-		break;
-	}
+	aux_ch = intel_bios_port_info_aux_ch(info);
 
Quoted 5 lines
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_bios.c +0 -0
 	drm_dbg_kms(&dev_priv->drm, "using AUX %c for port %c (VBT)\n",
 		    aux_ch_name(aux_ch), port_name(port));
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center

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

maintainer
#5 lore raw
Quoted 8 lines · Imre Deak
Quoted 7 lines · Jani Nikula
Quoted 6 lines · Imre Deak

Using an AUX channel which by default belongs to a non-TypeC PHY won't work on a TypeC PHY, since - as a side-effect besides providing an AUX channel - the AUX channel power well affects power manangement specific to the TypeC subsystem. Using a TypeC AUX channel on a non-TypeC PHY would probably also cause problems, so for simplicity prevent both.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

This fixes at least an ICL-Y machine in CI, which has a buggy VBT setting AUX-B as an alternative channel for port C.

Is it a production machine?

Yes.

*sigh*

Yeah I guess that settles it, we'll need this. :/

Ack.

BR,
Jani.

Quoted 143 lines
Quoted 3 lines

Not happy about adding stuff for pre-pro machines with buggy VBT. It'll bite us later. It always has.

If there is a buggy VBT with this issue it will cause a problem somewhere down the pipeline which is difficult to track down, power well timeouts, machine hangs etc. I would like to catch this early and avoid having to spend time debugging these other issues.

Quoted 1 line

Also, hate to see VBT code call into intel_display.c (intel_phy_is_tc).

That's the way to determine if a port/PHY is TypeC on a platform or not.

--Imre

Quoted 128 lines

BR,
Jani.

Quoted 120 lines
---
 drivers/gpu/drm/i915/display/intel_bios.c | 84 +++++++++++++++--------
 1 file changed, 57 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/display/intel_bios.c +57 -27
index 839124647202..10d463723d12 100644
@@ -1538,11 +1538,38 @@ static enum port get_port_by_aux_ch(struct drm_i915_private *i915, u8 aux_ch)
 	return PORT_NONE;
 }
 
+static enum aux_ch
+intel_bios_port_info_aux_ch(const struct ddi_vbt_port_info *info)
+{
+	switch (info->alternate_aux_channel) {
+	case DP_AUX_A:
+		return AUX_CH_A;
+	case DP_AUX_B:
+		return AUX_CH_B;
+	case DP_AUX_C:
+		return AUX_CH_C;
+	case DP_AUX_D:
+		return AUX_CH_D;
+	case DP_AUX_E:
+		return AUX_CH_E;
+	case DP_AUX_F:
+		return AUX_CH_F;
+	case DP_AUX_G:
+		return AUX_CH_G;
+	default:
+		MISSING_CASE(info->alternate_aux_channel);
+		return AUX_CH_A;
+	}
+}
+
 static void sanitize_aux_ch(struct drm_i915_private *dev_priv,
 			    enum port port)
 {
 	struct ddi_vbt_port_info *info = &dev_priv->vbt.ddi_port_info[port];
 	enum port p;
+	enum aux_ch aux_ch;
+	bool aux_is_tc;
+	bool phy_is_tc;
 
 	if (!info->alternate_aux_channel)
 		return;
@@ -1571,6 +1598,35 @@ static void sanitize_aux_ch(struct drm_i915_private *dev_priv,
 
 		info->supports_dp = false;
 		info->alternate_aux_channel = 0;
+
+		return;
+	}
+
+	aux_ch = intel_bios_port_info_aux_ch(info);
+	/* The AUX CH -> default port is a 1:1 mapping. */
+	aux_is_tc = intel_phy_is_tc(dev_priv,
+				    intel_port_to_phy(dev_priv,
+						      (enum port)aux_ch));
+	phy_is_tc = intel_phy_is_tc(dev_priv,
+				    intel_port_to_phy(dev_priv, port));
+	if (aux_is_tc != phy_is_tc) {
+		/*
+		 * Using an AUX channel which by default belongs to a TypeC
+		 * PHY can't be used for non-TypeC PHYs and vice-versa. The
+		 * reason is that TypeC AUX power wells can only be enabled in
+		 * the current TypeC mode of the PHY and have an effect on power
+		 * management specific to the TypeC subsystem.
+		 */
+		drm_dbg_kms(&dev_priv->drm,
+			    "Port %c on a %s PHY is trying to use the %s AUX CH %c, "
+			    "disabling DP support on this port.\n",
+			    port_name(port),
+			    phy_is_tc ? "TypeC" : "non-TypeC",
+			    aux_is_tc ? "TypeC" : "non-TypeC",
+			    aux_ch_name(aux_ch));
+
+		info->supports_dp = false;
+		info->alternate_aux_channel = 0;
 	}
 }
 
@@ -2595,33 +2651,7 @@ enum aux_ch intel_bios_port_aux_ch(struct drm_i915_private *dev_priv,
 		return aux_ch;
 	}
 
-	switch (info->alternate_aux_channel) {
-	case DP_AUX_A:
-		aux_ch = AUX_CH_A;
-		break;
-	case DP_AUX_B:
-		aux_ch = AUX_CH_B;
-		break;
-	case DP_AUX_C:
-		aux_ch = AUX_CH_C;
-		break;
-	case DP_AUX_D:
-		aux_ch = AUX_CH_D;
-		break;
-	case DP_AUX_E:
-		aux_ch = AUX_CH_E;
-		break;
-	case DP_AUX_F:
-		aux_ch = AUX_CH_F;
-		break;
-	case DP_AUX_G:
-		aux_ch = AUX_CH_G;
-		break;
-	default:
-		MISSING_CASE(info->alternate_aux_channel);
-		aux_ch = AUX_CH_A;
-		break;
-	}
+	aux_ch = intel_bios_port_info_aux_ch(info);
 
 	drm_dbg_kms(&dev_priv->drm, "using AUX %c for port %c (VBT)\n",
 		    aux_ch_name(aux_ch), port_name(port));
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#6 lore raw
Quoted 9 lines · Jani Nikula
Quoted 8 lines · Imre Deak
Quoted 7 lines · Jani Nikula
Quoted 6 lines · Imre Deak

Using an AUX channel which by default belongs to a non-TypeC PHY won't work on a TypeC PHY, since - as a side-effect besides providing an AUX channel - the AUX channel power well affects power manangement specific to the TypeC subsystem. Using a TypeC AUX channel on a non-TypeC PHY would probably also cause problems, so for simplicity prevent both.

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

This fixes at least an ICL-Y machine in CI, which has a buggy VBT setting AUX-B as an alternative channel for port C.

Is it a production machine?

Yes.

Err, I meant to say it's a pre-production machine icl-dsi. However, the problem is not specific to whether the machine is pre-pro or not. A VBT with this problem on a production machine would cause the same problem.

Quoted 143 lines

*sigh*

Yeah I guess that settles it, we'll need this. :/

Ack.

Quoted 137 lines
Quoted 2 lines

Not happy about adding stuff for pre-pro machines with buggy VBT. It'll bite us later. It always has.

If there is a buggy VBT with this issue it will cause a problem somewhere down the pipeline which is difficult to track down, power well timeouts, machine hangs etc. I would like to catch this early and avoid having to spend time debugging these other issues.

Quoted 1 line

Also, hate to see VBT code call into intel_display.c (intel_phy_is_tc).

That's the way to determine if a port/PHY is TypeC on a platform or not.

--Imre

Quoted 123 lines

BR,
Jani.

Quoted 118 lines
---
 drivers/gpu/drm/i915/display/intel_bios.c | 84 +++++++++++++++--------
 1 file changed, 57 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/display/intel_bios.c +57 -27
index 839124647202..10d463723d12 100644
@@ -1538,11 +1538,38 @@ static enum port get_port_by_aux_ch(struct drm_i915_private *i915, u8 aux_ch)
 	return PORT_NONE;
 }
 
+static enum aux_ch
+intel_bios_port_info_aux_ch(const struct ddi_vbt_port_info *info)
+{
+	switch (info->alternate_aux_channel) {
+	case DP_AUX_A:
+		return AUX_CH_A;
+	case DP_AUX_B:
+		return AUX_CH_B;
+	case DP_AUX_C:
+		return AUX_CH_C;
+	case DP_AUX_D:
+		return AUX_CH_D;
+	case DP_AUX_E:
+		return AUX_CH_E;
+	case DP_AUX_F:
+		return AUX_CH_F;
+	case DP_AUX_G:
+		return AUX_CH_G;
+	default:
+		MISSING_CASE(info->alternate_aux_channel);
+		return AUX_CH_A;
+	}
+}
+
 static void sanitize_aux_ch(struct drm_i915_private *dev_priv,
 			    enum port port)
 {
 	struct ddi_vbt_port_info *info = &dev_priv->vbt.ddi_port_info[port];
 	enum port p;
+	enum aux_ch aux_ch;
+	bool aux_is_tc;
+	bool phy_is_tc;
 
 	if (!info->alternate_aux_channel)
 		return;
@@ -1571,6 +1598,35 @@ static void sanitize_aux_ch(struct drm_i915_private *dev_priv,
 
 		info->supports_dp = false;
 		info->alternate_aux_channel = 0;
+
+		return;
+	}
+
+	aux_ch = intel_bios_port_info_aux_ch(info);
+	/* The AUX CH -> default port is a 1:1 mapping. */
+	aux_is_tc = intel_phy_is_tc(dev_priv,
+				    intel_port_to_phy(dev_priv,
+						      (enum port)aux_ch));
+	phy_is_tc = intel_phy_is_tc(dev_priv,
+				    intel_port_to_phy(dev_priv, port));
+	if (aux_is_tc != phy_is_tc) {
+		/*
+		 * Using an AUX channel which by default belongs to a TypeC
+		 * PHY can't be used for non-TypeC PHYs and vice-versa. The
+		 * reason is that TypeC AUX power wells can only be enabled in
+		 * the current TypeC mode of the PHY and have an effect on power
+		 * management specific to the TypeC subsystem.
+		 */
+		drm_dbg_kms(&dev_priv->drm,
+			    "Port %c on a %s PHY is trying to use the %s AUX CH %c, "
+			    "disabling DP support on this port.\n",
+			    port_name(port),
+			    phy_is_tc ? "TypeC" : "non-TypeC",
+			    aux_is_tc ? "TypeC" : "non-TypeC",
+			    aux_ch_name(aux_ch));
+
+		info->supports_dp = false;
+		info->alternate_aux_channel = 0;
 	}
 }
 
@@ -2595,33 +2651,7 @@ enum aux_ch intel_bios_port_aux_ch(struct drm_i915_private *dev_priv,
 		return aux_ch;
 	}
 
-	switch (info->alternate_aux_channel) {
-	case DP_AUX_A:
-		aux_ch = AUX_CH_A;
-		break;
-	case DP_AUX_B:
-		aux_ch = AUX_CH_B;
-		break;
-	case DP_AUX_C:
-		aux_ch = AUX_CH_C;
-		break;
-	case DP_AUX_D:
-		aux_ch = AUX_CH_D;
-		break;
-	case DP_AUX_E:
-		aux_ch = AUX_CH_E;
-		break;
-	case DP_AUX_F:
-		aux_ch = AUX_CH_F;
-		break;
-	case DP_AUX_G:
-		aux_ch = AUX_CH_G;
-		break;
-	default:
-		MISSING_CASE(info->alternate_aux_channel);
-		aux_ch = AUX_CH_A;
-		break;
-	}
+	aux_ch = intel_bios_port_info_aux_ch(info);
 
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_bios.c +0 -0
 	drm_dbg_kms(&dev_priv->drm, "using AUX %c for port %c (VBT)\n",
 		    aux_ch_name(aux_ch), port_name(port));
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center

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