Skip to contentSkip to conversation

drm/i915: avoid unnecessary call to intel_hpd_pin_to_port

PATCH In review Paulo Zanoni 7 participants 12 messages Oct 5, 2017 – Oct 9, 2017

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

PATCH 1/2 drm/i915: avoid unnecessary call to intel_hpd_pin_to_port

Don't call it when we can do like the other functions and just look at port->port. Also rename the intel_digital_port variable to make it look like the other functions.

My main goal here is to prevent the copy-pasters from propagating the call to other parts of the code.

---
 drivers/gpu/drm/i915/intel_dp.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +3 -6
index ca48bce..6fb90fa 100644
@@ -4614,14 +4614,11 @@ static bool bdw_digital_port_connected(struct drm_i915_private *dev_priv,
 }
 
 static bool bxt_digital_port_connected(struct drm_i915_private *dev_priv,
-				       struct intel_digital_port *intel_dig_port)
+				       struct intel_digital_port *port)
 {
-	struct intel_encoder *intel_encoder = &intel_dig_port->base;
-	enum port port;
 	u32 bit;
 
-	port = intel_hpd_pin_to_port(intel_encoder->hpd_pin);
-	switch (port) {
+	switch (port->port) {
 	case PORT_A:
 		bit = BXT_DE_PORT_HP_DDIA;
 		break;
@@ -4632,7 +4629,7 @@ static bool bxt_digital_port_connected(struct drm_i915_private *dev_priv,
 		bit = BXT_DE_PORT_HP_DDIC;
 		break;
 	default:
-		MISSING_CASE(port);
+		MISSING_CASE(port->port);
 		return false;
 	}
 
Signature · 6 lines
2.9.5

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

PATCH 2/2 drm/i915: avoid division by zero on cnl_calc_wrpll_link

If for some unexpected reason the registers all read zero it's better to WARN and return instead of dividing by zero and completely freezing the machine.

I don't expect this to happen in the wild with the current code, but I accidentally triggered the division by zero while doing some debugging in an unusual environment.

---
 drivers/gpu/drm/i915/intel_ddi.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +3 -0
index f7c91bb..be86eb6 100644
@@ -1220,6 +1220,9 @@ static int cnl_calc_wrpll_link(struct drm_i915_private *dev_priv,
 	dco_freq += (((cfgcr0 & DPLL_CFGCR0_DCO_FRACTION_MASK) >>
 		      DPLL_CFGCR0_DCO_FRACTION_SHIFT) * ref_clock) / 0x8000;
 
+	if (WARN_ON(p0 == 0 || p1 == 0 || p2 == 0))
+		return 0;
+
 	return dco_freq / (p0 * p1 * p2 * 5);
 }
 
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] drm/i915: avoid division by zero on cnl_calc_wrpll_link

Quoted 7 lines · Paulo Zanoni

If for some unexpected reason the registers all read zero it's better to WARN and return instead of dividing by zero and completely freezing the machine.

I don't expect this to happen in the wild with the current code, but I accidentally triggered the division by zero while doing some debugging in an unusual environment.

Good idea

Quoted 24 lines
---
 drivers/gpu/drm/i915/intel_ddi.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +3 -0
index f7c91bb..be86eb6 100644
@@ -1220,6 +1220,9 @@ static int cnl_calc_wrpll_link(struct drm_i915_private *dev_priv,
 	dco_freq += (((cfgcr0 & DPLL_CFGCR0_DCO_FRACTION_MASK) >>
 		      DPLL_CFGCR0_DCO_FRACTION_SHIFT) * ref_clock) / 0x8000;
 
+	if (WARN_ON(p0 == 0 || p1 == 0 || p2 == 0))
+		return 0;
+
 	return dco_freq / (p0 * p1 * p2 * 5);
 }
 
Signature · 1 line
2.9.5

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

maintainer
#3 lore raw
In reply to Paulo Zanoni
Quoted 3 lines · Paulo Zanoni

Don't call it when we can do like the other functions and just look at port->port. Also rename the intel_digital_port variable to make it look like the other functions.

what other functions?

Most of our functions use intel_dig_port. Also dport and less used is port.

$ grep -r "intel_digital_port \*intel_dig_port" drivers/gpu/drm/i915/ | wc -l
93
$ grep -r "intel_digital_port \*port" drivers/gpu/drm/i915/ | wc -l
11
$ grep -r "intel_digital_port \*dport" drivers/gpu/drm/i915/ | wc -l
18
Quoted 46 lines

My main goal here is to prevent the copy-pasters from propagating the call to other parts of the code.

---
 drivers/gpu/drm/i915/intel_dp.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +3 -6
index ca48bce..6fb90fa 100644
@@ -4614,14 +4614,11 @@ static bool bdw_digital_port_connected(struct drm_i915_private *dev_priv,
 }
 
 static bool bxt_digital_port_connected(struct drm_i915_private *dev_priv,
-				       struct intel_digital_port *intel_dig_port)
+				       struct intel_digital_port *port)
 {
-	struct intel_encoder *intel_encoder = &intel_dig_port->base;
-	enum port port;
 	u32 bit;
 
-	port = intel_hpd_pin_to_port(intel_encoder->hpd_pin);
-	switch (port) {
+	switch (port->port) {
 	case PORT_A:
 		bit = BXT_DE_PORT_HP_DDIA;
 		break;
@@ -4632,7 +4629,7 @@ static bool bxt_digital_port_connected(struct drm_i915_private *dev_priv,
 		bit = BXT_DE_PORT_HP_DDIC;
 		break;
 	default:
-		MISSING_CASE(port);
+		MISSING_CASE(port->port);
 		return false;
 	}
 
Signature · 6 lines
2.9.5

_______________________________________________
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

#4 lore raw

Em Qui, 2017-10-05 às 14:49 -0700, Rodrigo Vivi escreveu:

Quoted 7 lines · Paulo Zanoni
Quoted 4 lines

Don't call it when we can do like the other functions and just look at
port->port. Also rename the intel_digital_port variable to make it look like the other functions.

what other functions?

All the _digital_port_connected() functions from intel_dp.c.

Quoted 62 lines

Most of our functions use intel_dig_port. Also dport and less used is port.

$ grep -r "intel_digital_port \*intel_dig_port" drivers/gpu/drm/i915/
| wc -l
93
$ grep -r "intel_digital_port \*port" drivers/gpu/drm/i915/ | wc -l
11
$ grep -r "intel_digital_port \*dport" drivers/gpu/drm/i915/ | wc -l
18
Quoted 50 lines

My main goal here is to prevent the copy-pasters from propagating the
call to other parts of the code.

---
 drivers/gpu/drm/i915/intel_dp.c | 9 +++------

 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index ca48bce..6fb90fa 100644
@@ -4614,14 +4614,11 @@ static bool
 bdw_digital_port_connected(struct drm_i915_private *dev_priv,
  }


 static bool bxt_digital_port_connected(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/intel_dp.c +0 -1
-				       struct intel_digital_port

*intel_dig_port)

drivers/gpu/drm/i915/intel_dp.c +1 -0
+				       struct intel_digital_port

*port)
 {

drivers/gpu/drm/i915/intel_dp.c +0 -1
-	struct intel_encoder *intel_encoder = &intel_dig_port-
Quoted 1 line

base;

drivers/gpu/drm/i915/intel_dp.c +0 -1
-	enum port port;

  u32 bit;

drivers/gpu/drm/i915/intel_dp.c +1 -2
-	port = intel_hpd_pin_to_port(intel_encoder->hpd_pin);
-	switch (port) {
+	switch (port->port) {

  case PORT_A:
  bit = BXT_DE_PORT_HP_DDIA;
  break;

drivers/gpu/drm/i915/intel_dp.c +0 -0
@@ -4632,7 +4629,7 @@ static bool bxt_digital_port_connected(struct
 drm_i915_private *dev_priv,
  		bit = BXT_DE_PORT_HP_DDIC;
  		break;

  default:

drivers/gpu/drm/i915/intel_dp.c +1 -1
-		MISSING_CASE(port);
+		MISSING_CASE(port->port);

  return false;
  }

--
2.9.5

Quoted 9 lines
Quoted 4 lines

_______________________________________________
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

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

maintainer
#5 lore raw
Quoted 10 lines · Paulo Zanoni

Em Qui, 2017-10-05 às 14:49 -0700, Rodrigo Vivi escreveu:

Quoted 7 lines · Paulo Zanoni
Quoted 4 lines

Don't call it when we can do like the other functions and just look at
port->port. Also rename the intel_digital_port variable to make it look like the other functions.

what other functions?

All the _digital_port_connected() functions from intel_dp.c.

Wah, I should read all of the thread before replying...

Anyway, I'd rather move away from port for struct intel_digital_port.

BR,
Jani.

Quoted 76 lines
Quoted 63 lines

Most of our functions use intel_dig_port. Also dport and less used is port.

$ grep -r "intel_digital_port \*intel_dig_port" drivers/gpu/drm/i915/
| wc -l
93
$ grep -r "intel_digital_port \*port" drivers/gpu/drm/i915/ | wc -l
11
$ grep -r "intel_digital_port \*dport" drivers/gpu/drm/i915/ | wc -l
18
Quoted 50 lines

My main goal here is to prevent the copy-pasters from propagating the
call to other parts of the code.

---
 drivers/gpu/drm/i915/intel_dp.c | 9 +++------

 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index ca48bce..6fb90fa 100644
@@ -4614,14 +4614,11 @@ static bool
 bdw_digital_port_connected(struct drm_i915_private *dev_priv,
  }


 static bool bxt_digital_port_connected(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/intel_dp.c +0 -1
-				       struct intel_digital_port

*intel_dig_port)

drivers/gpu/drm/i915/intel_dp.c +1 -0
+				       struct intel_digital_port

*port)
 {

drivers/gpu/drm/i915/intel_dp.c +0 -1
-	struct intel_encoder *intel_encoder = &intel_dig_port-
Quoted 1 line

base;

drivers/gpu/drm/i915/intel_dp.c +0 -1
-	enum port port;

  u32 bit;

drivers/gpu/drm/i915/intel_dp.c +1 -2
-	port = intel_hpd_pin_to_port(intel_encoder->hpd_pin);
-	switch (port) {
+	switch (port->port) {

  case PORT_A:
  bit = BXT_DE_PORT_HP_DDIA;
  break;

drivers/gpu/drm/i915/intel_dp.c +0 -0
@@ -4632,7 +4629,7 @@ static bool bxt_digital_port_connected(struct
 drm_i915_private *dev_priv,
  		bit = BXT_DE_PORT_HP_DDIC;
  		break;

  default:

drivers/gpu/drm/i915/intel_dp.c +1 -1
-		MISSING_CASE(port);
+		MISSING_CASE(port->port);

  return false;
  }

--
2.9.5

Quoted 9 lines
Quoted 4 lines

_______________________________________________
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

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

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

✗ Fi.CI.BAT: warning for series starting with [1/2] drm/i915: avoid unnecessary call to intel_hpd_pin_to_port

In reply to Paulo Zanoni
== Series Details ==

== Series Details ==

Series: series starting with [1/2] drm/i915: avoid unnecessary call to intel_hpd_pin_to_port
URL : https://patchwork.freedesktop.org/series/31459/
State : warning

== Summary ==

Series 31459v1 series starting with [1/2] drm/i915: avoid unnecessary call to intel_hpd_pin_to_port
https://patchwork.freedesktop.org/api/1.0/series/31459/revisions/1/mbox/

Test chamelium:

        Subgroup dp-crc-fast:
                pass       -> FAIL       (fi-kbl-7500u) fdo#102514
Test gem_ctx_switch:
        Subgroup basic-default:
                pass       -> INCOMPLETE (fi-cnl-y) fdo#103027
Test gem_exec_suspend:
        Subgroup basic-s3:
                pass       -> DMESG-WARN (fi-cfl-s) fdo#103026
        Subgroup basic-s4-devices:
                pass       -> DMESG-WARN (fi-kbl-7500u)

fdo#102514 https://bugs.freedesktop.org/show_bug.cgi?id=102514
fdo#103027 https://bugs.freedesktop.org/show_bug.cgi?id=103027
fdo#103026 https://bugs.freedesktop.org/show_bug.cgi?id=103026

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:461s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:467s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:390s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:573s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:288s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:526s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:537s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:538s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:525s
fi-cfl-s         total:289  pass:256  dwarn:1   dfail:0   fail:0   skip:32  time:553s
fi-cnl-y         total:31   pass:21   dwarn:0   dfail:0   fail:0   skip:9  
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:437s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:599s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:439s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:416s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:468s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:508s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:479s
fi-kbl-7500u     total:289  pass:262  dwarn:2   dfail:0   fail:1   skip:24  time:501s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:584s
fi-kbl-7567u     total:289  pass:265  dwarn:4   dfail:0   fail:0   skip:20  time:499s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:598s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:661s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:477s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:663s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:534s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:521s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:473s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:578s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:437s

97c9e99b242fe40bbda48ba2bcaed07c47fba085 drm-tip: 2017y-10m-06d-09h-07m-21s UTC integration manifest d0674fac8e07 drm/i915: avoid division by zero on cnl_calc_wrpll_link
7d8046f85adf drm/i915: avoid unnecessary call to intel_hpd_pin_to_port

== Logs ==

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

#7 lore raw

Re: ✗ Fi.CI.BAT: warning for series starting with [1/2] drm/i915: avoid unnecessary call to intel_hpd_pin_to_port

Em Sex, 2017-10-06 às 10:45 +0000, Patchwork escreveu:

Quoted 14 lines

== Series Details ==

Series: series starting with [1/2] drm/i915: avoid unnecessary call to intel_hpd_pin_to_port
URL   : https://patchwork.freedesktop.org/series/31459/
State : warning

== Summary ==

Series 31459v1 series starting with [1/2] drm/i915: avoid unnecessary call to intel_hpd_pin_to_port
https://patchwork.freedesktop.org/api/1.0/series/31459/revisions/1/mb
ox/

Quoted 11 lines

Test chamelium:
        Subgroup dp-crc-fast:
                pass       -> FAIL       (fi-kbl-7500u) fdo#102514 Test gem_ctx_switch:
        Subgroup basic-default:
                pass       -> INCOMPLETE (fi-cnl-y) fdo#103027 Test gem_exec_suspend:
        Subgroup basic-s3:
                pass       -> DMESG-WARN (fi-cfl-s) fdo#103026 Subgroup basic-s4-devices:
                pass       -> DMESG-WARN (fi-kbl-7500u)

[  242.023771] [drm:intel_dp_aux_ch [i915]] *ERROR* dp aux hw did not signal timeout (has irq: 1)!

I do not believe this is caused by my patches. This test on this machine is failing in many other recent patch series, but with different error messages. Looks very unstable.

Quoted 101 lines

fdo#102514 https://bugs.freedesktop.org/show_bug.cgi?id=102514
fdo#103027 https://bugs.freedesktop.org/show_bug.cgi?id=103027
fdo#103026 https://bugs.freedesktop.org/show_bug.cgi?id=103026

fi-bdw-
5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21 time:461s
fi-bdw-
gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24 time:467s
fi-blb-
e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65 time:390s
fi-bsw-
n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46 time:573s
fi-bwr-
2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:288s
fi-bxt-
dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30 time:526s
fi-bxt-
j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29 time:537s
fi-byt-
j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35 time:538s
fi-byt-
n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39 time:525s
fi-cfl-
s         total:289  pass:256  dwarn:1   dfail:0   fail:0   skip:32 time:553s
fi-cnl-
y         total:31   pass:21   dwarn:0   dfail:0   fail:0   skip:9 fi-elk-
e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60 time:437s
fi-glk-
1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28 time:599s
fi-hsw-
4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27 time:439s
fi-hsw-
4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27 time:416s
fi-ilk-
650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61 time:468s
fi-ivb-
3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29 time:508s
fi-ivb-
3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29 time:479s
fi-kbl-
7500u     total:289  pass:262  dwarn:2   dfail:0   fail:1   skip:24 time:501s
fi-kbl-
7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19 time:584s
fi-kbl-
7567u     total:289  pass:265  dwarn:4   dfail:0   fail:0   skip:20 time:499s
fi-kbl-
r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27 time:598s
fi-pnv-
d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66 time:661s
fi-skl-
6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20 time:477s
fi-skl-
6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26 time:663s
fi-skl-
6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24 time:534s
fi-skl-
6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20 time:521s
fi-skl-
gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23 time:473s
fi-snb-
2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39 time:578s
fi-snb-
2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40 time:437s

97c9e99b242fe40bbda48ba2bcaed07c47fba085 drm-tip: 2017y-10m-06d-09h- 07m-21s UTC integration manifest
d0674fac8e07 drm/i915: avoid division by zero on cnl_calc_wrpll_link 7d8046f85adf drm/i915: avoid unnecessary call to intel_hpd_pin_to_port

Quoted 8 lines

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchw
ork_5919/
_______________________________________________
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

#8 lore raw

Re: ✗ Fi.CI.BAT: warning for series starting with [1/2] drm/i915: avoid unnecessary call to intel_hpd_pin_to_port

Quoted 27 lines · Paulo Zanoni

Em Sex, 2017-10-06 às 10:45 +0000, Patchwork escreveu:

Quoted 14 lines

== Series Details ==

Series: series starting with [1/2] drm/i915: avoid unnecessary call to intel_hpd_pin_to_port
URL   : https://patchwork.freedesktop.org/series/31459/
State : warning

== Summary ==

Series 31459v1 series starting with [1/2] drm/i915: avoid unnecessary call to intel_hpd_pin_to_port
https://patchwork.freedesktop.org/api/1.0/series/31459/revisions/1/mb
ox/

Quoted 11 lines

Test chamelium:
        Subgroup dp-crc-fast:
                pass       -> FAIL       (fi-kbl-7500u) fdo#102514 Test gem_ctx_switch:
        Subgroup basic-default:
                pass       -> INCOMPLETE (fi-cnl-y) fdo#103027 Test gem_exec_suspend:
        Subgroup basic-s3:
                pass       -> DMESG-WARN (fi-cfl-s) fdo#103026 Subgroup basic-s4-devices:
                pass       -> DMESG-WARN (fi-kbl-7500u)

Quoted 8 lines

[  242.023771] [drm:intel_dp_aux_ch [i915]] *ERROR* dp aux hw did not signal timeout (has irq: 1)!

I do not believe this is caused by my patches. This test on this machine is failing in many other recent patch series, but with different error messages. Looks very unstable.

Yes this is the system where we have had these messages due to LSPCON issue recently.

Manasi

Quoted 109 lines
Quoted 101 lines

fdo#102514 https://bugs.freedesktop.org/show_bug.cgi?id=102514
fdo#103027 https://bugs.freedesktop.org/show_bug.cgi?id=103027
fdo#103026 https://bugs.freedesktop.org/show_bug.cgi?id=103026

fi-bdw-
5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21 time:461s
fi-bdw-
gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24 time:467s
fi-blb-
e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65 time:390s
fi-bsw-
n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46 time:573s
fi-bwr-
2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:288s
fi-bxt-
dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30 time:526s
fi-bxt-
j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29 time:537s
fi-byt-
j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35 time:538s
fi-byt-
n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39 time:525s
fi-cfl-
s         total:289  pass:256  dwarn:1   dfail:0   fail:0   skip:32 time:553s
fi-cnl-
y         total:31   pass:21   dwarn:0   dfail:0   fail:0   skip:9 fi-elk-
e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60 time:437s
fi-glk-
1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28 time:599s
fi-hsw-
4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27 time:439s
fi-hsw-
4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27 time:416s
fi-ilk-
650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61 time:468s
fi-ivb-
3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29 time:508s
fi-ivb-
3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29 time:479s
fi-kbl-
7500u     total:289  pass:262  dwarn:2   dfail:0   fail:1   skip:24 time:501s
fi-kbl-
7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19 time:584s
fi-kbl-
7567u     total:289  pass:265  dwarn:4   dfail:0   fail:0   skip:20 time:499s
fi-kbl-
r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27 time:598s
fi-pnv-
d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66 time:661s
fi-skl-
6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20 time:477s
fi-skl-
6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26 time:663s
fi-skl-
6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24 time:534s
fi-skl-
6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20 time:521s
fi-skl-
gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23 time:473s
fi-snb-
2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39 time:578s
fi-snb-
2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40 time:437s

97c9e99b242fe40bbda48ba2bcaed07c47fba085 drm-tip: 2017y-10m-06d-09h- 07m-21s UTC integration manifest
d0674fac8e07 drm/i915: avoid division by zero on cnl_calc_wrpll_link 7d8046f85adf drm/i915: avoid unnecessary call to intel_hpd_pin_to_port

Quoted 8 lines

== Logs ==

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

Quoted 4 lines

_______________________________________________
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

#9 lore raw

Re: ✗ Fi.CI.BAT: warning for series starting with [1/2] drm/i915: avoid unnecessary call to intel_hpd_pin_to_port

In reply to Paulo Zanoni
Quoted 27 lines · Paulo Zanoni

Em Sex, 2017-10-06 às 10:45 +0000, Patchwork escreveu:

Quoted 14 lines

== Series Details ==

Series: series starting with [1/2] drm/i915: avoid unnecessary call to intel_hpd_pin_to_port
URL   : https://patchwork.freedesktop.org/series/31459/
State : warning

== Summary ==

Series 31459v1 series starting with [1/2] drm/i915: avoid unnecessary call to intel_hpd_pin_to_port
https://patchwork.freedesktop.org/api/1.0/series/31459/revisions/1/mb
ox/

Quoted 11 lines

Test chamelium:
        Subgroup dp-crc-fast:
                pass       -> FAIL       (fi-kbl-7500u) fdo#102514
Test gem_ctx_switch:
        Subgroup basic-default:
                pass       -> INCOMPLETE (fi-cnl-y) fdo#103027
Test gem_exec_suspend:
        Subgroup basic-s3:
                pass       -> DMESG-WARN (fi-cfl-s) fdo#103026 Subgroup basic-s4-devices:
                pass       -> DMESG-WARN (fi-kbl-7500u)

Quoted 6 lines

[  242.023771] [drm:intel_dp_aux_ch [i915]] *ERROR* dp aux hw did not signal timeout (has irq: 1)!

I do not believe this is caused by my patches. This test on this machine is failing in many other recent patch series, but with different error messages. Looks very unstable.

Thanks for letting us know! We need more feedback from developers when we get these false positives in pre-merge :)

Marta has been taking over the bug filing for a month now. She will know better what to do than me on this. I've Cc:ed her and will let her handle this.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer
#10 lore raw
In reply to Paulo Zanoni
Quoted 3 lines · Paulo Zanoni

Don't call it when we can do like the other functions and just look at port->port. Also rename the intel_digital_port variable to make it look like the other functions.

I guess the question is, *which* other functions. A quick rough grep gives me:

$ grep -ho "intel_digital_port[ *]*[a-zA-Z0-9_]*" $(git ls-files -- drivers/gpu/drm/i915) | sort | uniq -c | sort -rn

93 intel_digital_port *intel_dig_port
22 intel_digital_port *dig_port
18 intel_digital_port *dport
11 intel_digital_port *port
5 intel_digital_port_connected
5 intel_digital_port
4 intel_digital_port *
1 intel_digital_port *primary
1 intel_digital_port *irq_port
1 intel_digital_port

I think it's more common to use port for enum port. I'm fine with any of the top three for struct intel_dig_port.

BR,
Jani.

Quoted 38 lines

My main goal here is to prevent the copy-pasters from propagating the call to other parts of the code.

---
 drivers/gpu/drm/i915/intel_dp.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +3 -6
index ca48bce..6fb90fa 100644
@@ -4614,14 +4614,11 @@ static bool bdw_digital_port_connected(struct drm_i915_private *dev_priv,
 }
 
 static bool bxt_digital_port_connected(struct drm_i915_private *dev_priv,
-				       struct intel_digital_port *intel_dig_port)
+				       struct intel_digital_port *port)
 {
-	struct intel_encoder *intel_encoder = &intel_dig_port->base;
-	enum port port;
 	u32 bit;
 
-	port = intel_hpd_pin_to_port(intel_encoder->hpd_pin);
-	switch (port) {
+	switch (port->port) {
 	case PORT_A:
 		bit = BXT_DE_PORT_HP_DDIA;
 		break;
@@ -4632,7 +4629,7 @@ static bool bxt_digital_port_connected(struct drm_i915_private *dev_priv,
 		bit = BXT_DE_PORT_HP_DDIC;
 		break;
 	default:
-		MISSING_CASE(port);
+		MISSING_CASE(port->port);
 		return false;
 	}
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw
In reply to Paulo Zanoni
Quoted 20 lines · Paulo Zanoni

Don't call it when we can do like the other functions and just look at port->port. Also rename the intel_digital_port variable to make it look like the other functions.

My main goal here is to prevent the copy-pasters from propagating the call to other parts of the code.

---
 drivers/gpu/drm/i915/intel_dp.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index ca48bce..6fb90fa 100644
@@ -4614,14 +4614,11 @@ static bool bdw_digital_port_connected(struct drm_i915_private *dev_priv,
 }
 
 static bool bxt_digital_port_connected(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/intel_dp.c static bool bdw_digital_port_connected(struct drm_i915_private *dev_priv, · line 4621

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +2 -5
-				       struct intel_digital_port *intel_dig_port)
+				       struct intel_digital_port *port)
 {
-	struct intel_encoder *intel_encoder = &intel_dig_port->base;
-	enum port port;
 	u32 bit;
 
-	port = intel_hpd_pin_to_port(intel_encoder->hpd_pin);
-	switch (port) {
+	switch (port->port) {

Hmm. I'm thinking we might want to go the other way and change everyone else to use hpd_pin instead. IIRC we'll need to start considering mixed hpd_pin<->port mappings with port F. We already had to do this with the BXT A step w/a (though it was just crudely hacked in) which I suppose is the reason the BXT code is still doing this.

Though I see no reason why we would have to call intel_hpd_pin_to_port() here. Instead we could just 's/port->port/encoder->hpd_pin/' everywhere.

Quoted 19 lines
drivers/gpu/drm/i915/intel_dp.c +1 -1
 	case PORT_A:
 		bit = BXT_DE_PORT_HP_DDIA;
 		break;
@@ -4632,7 +4629,7 @@ static bool bxt_digital_port_connected(struct drm_i915_private *dev_priv,
 		bit = BXT_DE_PORT_HP_DDIC;
 		break;
 	default:
-		MISSING_CASE(port);
+		MISSING_CASE(port->port);
 		return false;
 	}
 
Signature · 6 lines
2.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx