Skip to contentSkip to conversation

panic in i915_digport_work_func

drm/i915/3.17 Mike Galbraith 6 participants 8 messages Aug 30, 2014 – Sep 3, 2014

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

Greetings,

My little Toshiba lappy is exploding non-deterministically during boot with master (<= 3.16 work fine). I tried to bisect it, but apparently didn't do quite enough reboots before saying 'good', so ended up...

first bad commit: [5fa9be63a42bd4336448d27cbd1f3b993744dd88]
Merge branch 'msm-fixes-3.17' of git://people.freedesktop.org/~robclark/linux into drm-fixes

...touring bisect lala land. Setting up netconsole, I now have a picture of the little bugger at least.

[    4.881500] [drm] Replacing VGA console driver
[    4.889652] checking generic (d0000000 7ff0000) vs hw (d0000000 10000000)
[    4.897930] fb: switching to inteldrmfb from VESA VGA
[    4.906132] Console: switching to colour dummy device 80x25
[    4.906138] usb 7-1: new full-speed USB device number 2 using uhci_hcd
[    4.928120] i915 0000:00:02.0: irq 29 for MSI/MSI-X
[    4.928156] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    4.928164] [drm] Driver supports precise vblank timestamp query.
[    4.928269] vgaarb: device changed decodes: PCI:0000:00:02.0,olddecodes=io+mem,decodes=io+mem:owns=io+mem
[    5.017563] BUG: unable to handle kernel paging request at ffffc900108c4000
[    5.017586] IP: [<ffffffffa018704d>] gen4_read32+0x3d/0xc0 [i915]
[    5.017649] PGD 13f021067 PUD 13f022067 PMD 1361be067 PTE 0
[    5.017667] Oops: 0000 [#1] SMP 
[    5.017678] Modules linked in: i915(+) drm_kms_helper drm i2c_algo_bit processor video thermal thermal_sys button scsi_dh_rdac scsi_dh_alua scsi_dh_emc scsi_dh_hp_sw scsi_dh netconsole atl1c
[    5.017735] CPU: 0 PID: 54 Comm: kworker/u4:5 Not tainted 3.17.0-master #210
[    5.017743] Hardware name: TOSHIBA SATELLITE T130/SATELLITE T130, BIOS V1.70    09/29/2009
[    5.017788] Workqueue: i915-dp i915_digport_work_func [i915]
[    5.017798] task: ffff8801360de350 ti: ffff8801360e0000 task.ti: ffff8801360e0000
[    5.017805] RIP: 0010:[<ffffffffa018704d>]  [<ffffffffa018704d>] gen4_read32+0x3d/0xc0 [i915]
[    5.017857] RSP: 0018:ffff8801360e3d48  EFLAGS: 00010086
[    5.017863] RAX: 0000000000000297 RBX: ffff880037290000 RCX: 00000000000000da
[    5.017870] RDX: ffffc900108c4000 RSI: ffff8800372993c8 RDI: ffff880037290068
[    5.017877] RBP: ffff8801360e3d70 R08: 0000000000000001 R09: a000000000000000
[    5.017883] R10: dffeab59e7299400 R11: 00000000fffedfee R12: 00000000000c4000
[    5.017890] R13: ffff880037290068 R14: 0000000000000001 R15: 0000000000000001
[    5.017897] FS:  0000000000000000(0000) GS:ffff88013fc00000(0000) knlGS:0000000000000000
[    5.017906] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[    5.017912] CR2: ffffc900108c4000 CR3: 0000000001a15000 CR4: 00000000000407f0
[    5.017918] Stack:
[    5.017923]  0000000000800000 0000000000000011 ffff880037067000 0000000000000001
[    5.017939]  ffff880037dcb000 ffff8801360e3d88 ffffffffa01975c3 ffff880037290000
[    5.017955]  ffff8801360e3dc8 ffffffffa01bd883 ffff880037dcb0e0 ffff880037299400
[    5.017970] Call Trace:
[    5.018020]  [<ffffffffa01975c3>] ibx_digital_port_connected+0x63/0xb0 [i915]
[    5.018071]  [<ffffffffa01bd883>] intel_dp_hpd_pulse+0xc3/0x1f0 [i915]
[    5.018115]  [<ffffffffa0175b0d>] i915_digport_work_func+0x9d/0x120 [i915]
[    5.018128]  [<ffffffff81060b26>] process_one_work+0x186/0x3f0
[    5.018136]  [<ffffffff81060eb1>] worker_thread+0x121/0x480
[    5.018145]  [<ffffffff81060d90>] ? process_one_work+0x3f0/0x3f0
[    5.018154]  [<ffffffff81065689>] kthread+0xc9/0xe0
[    5.018163]  [<ffffffff810655c0>] ? kthread_create_on_node+0x170/0x170
[    5.018173]  [<ffffffff8157edac>] ret_from_fork+0x7c/0xb0
[    5.018182]  [<ffffffff810655c0>] ? kthread_create_on_node+0x170/0x170
[    5.018188] Code: 41 54 49 89 f4 53 48 8d b7 c8 93 00 00 48 89 fb 48 8b 3f 4c 8d 6b 68 e8 f2 f1 ff ff 4c 89 ef e8 3a 79 3f e1 4c 89 e2 48 03 53 60 <44> 8b 32 48 89 c6 4c 89 ef e8 95 75 3f e1 8b 05 c7 0f 08 00 85 
[    5.018329] RIP  [<ffffffffa018704d>] gen4_read32+0x3d/0xc0 [i915]
[    5.018377]  RSP <ffff8801360e3d48>
[    5.018383] CR2: ffffc900108c4000
[    5.018390] ---[ end trace d3d1a2cea94fa73a ]---
[    5.018397] Kernel panic - not syncing: Fatal exception
[    5.018422] Kernel Offset: 0x0 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffff9fffffff)

crash> mod -s i915

     MODULE       NAME                      SIZE  OBJECT FILE
ffffffffa01d7760  i915                    935705  /lib/modules/3.17.0-master/kernel/drivers/gpu/drm/i915/i915.ko 

crash> gdb list *gen4_read32+0x3d
0xffffffffa015604d is in gen4_read32 (./arch/x86/include/asm/io.h:56).
51 { asm volatile("mov" size " %0,%1": :reg (val), \
52 "m" (*(volatile type __force *)addr) barrier); }
53

54      build_mmio_read(readb, "b", unsigned char, "=q", :"memory")
55      build_mmio_read(readw, "w", unsigned short, "=r", :"memory")
56      build_mmio_read(readl, "l", unsigned int, "=r", :"memory")
57      
58      build_mmio_read(__readb, "b", unsigned char, "=q", )
59      build_mmio_read(__readw, "w", unsigned short, "=r", )
60      build_mmio_read(__readl, "l", unsigned int, "=r", )

0xffffffffa01665c3 is in ibx_digital_port_connected (drivers/gpu/drm/i915/intel_display.c:1044).
1039 default:
1040 return true;
1041 }
1042 }
1043
1044 return I915_READ(SDEISR) & bit;
1045 }
1046
1047 static const char *state_string(bool enabled)
1048 {
crash> gdb list *intel_dp_hpd_pulse+0xc3/0x1f0
0xffffffffa018c7c0 is in intel_dp_hpd_pulse (drivers/gpu/drm/i915/intel_dp.c:4051).
4046 return;
4047 }
4048

4049    bool
4050    intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
4051    {
4052            struct intel_dp *intel_dp = &intel_dig_port->dp;
4053            struct intel_encoder *intel_encoder = &intel_dig_port->base;
4054            struct drm_device *dev = intel_dig_port->base.base.dev;
4055            struct drm_i915_private *dev_priv = dev->dev_private;

crash> gdb list *i915_digport_work_func+0x9d
0xffffffffa0144b0d is in i915_digport_work_func (drivers/gpu/drm/i915/i915_irq.c:1125).
1120 } else if (short_port_mask & (1 << i))
1121 valid = true;
1122
1123 if (valid) {
1124 ret = intel_dig_port->hpd_pulse(intel_dig_port, long_hpd);
1125 if (ret == true) {
1126 /* if we get true fallback to old school hpd */
1127 old_bits |= (1 << intel_dig_port->base.hpd_pin);
1128 }
1129 }

#1 lore raw

Non-deterministic explosion culprit is the below. The commit says it adds mysterious acronyms to Haswell, so I suspect my little core2 lappy isn't ever supposed to see this code. The ftrace buffer is in fact empty after a successful boot.

commit 0e32b39ceed665bfa4a77a4bc307b6652b991632

Author: Dave Airlie <[email protected]>
Date:   Fri May 2 14:02:48 2014 +1000

drm/i915: add DP 1.2 MST support (v0.7)

This adds DP 1.2 MST support on Haswell systems.

[    4.251017] **********************************************************
[    4.251018] **   NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE   **
[    4.251019] **                                                      **
[    4.251020] ** trace_printk() being used. Allocating extra memory.  **
[    4.251021] **                                                      **
[    4.251021] ** This means that this is a DEBUG kernel and it is     **
[    4.251022] ** unsafe for produciton use.                           **
[    4.251023] **                                                      **
[    4.251024] ** If you see this message and you are not debugging    **
[    4.251024] ** the kernel, report this immediately to your vendor!  **
[    4.251025] **                                                      **
[    4.251026] **   NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE   **
[    4.251027] **********************************************************
[    4.375162] [drm] Memory usable by graphics device = 2048M
[    4.382963] [drm] Replacing VGA console driver
[    4.390710] checking generic (d0000000 7ff0000) vs hw (d0000000 10000000)
[    4.398617] fb: switching to inteldrmfb from VESA VGA
[    4.406578] Console: switching to colour dummy device 80x25
[    4.432283] i915 0000:00:02.0: irq 29 for MSI/MSI-X
[    4.432327] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    4.432335] [drm] Driver supports precise vblank timestamp query.
[    4.432437] vgaarb: device changed decodes: PCI:0000:00:02.0,olddecodes=io+mem,decodes=io+mem:owns=io+mem
[    4.521746] BUG: unable to handle kernel paging request at ffffc900108c4000
[    4.521781] IP: [<ffffffffa014323d>] gen4_read32+0x3d/0xc0 [i915]
[    4.521843] PGD 13f021067 PUD 13f022067 PMD 136193067 PTE 0
[    4.521860] Oops: 0000 [#1] SMP 
[    4.521872] Dumping ftrace buffer:
[    4.521880] ---------------------------------
[    4.521936]    udevd-120     1d.h. 4672095us : i9xx_hpd_irq_handler: PIN 1 continue
[    4.521987]    udevd-120     1d.h. 4672097us : i9xx_hpd_irq_handler: PIN 2 continue
[    4.522036]    udevd-120     1d.h. 4672098us : i9xx_hpd_irq_handler: PIN 3 continue
[    4.522085]    udevd-120     1d.h. 4672099us : i9xx_hpd_irq_handler: PIN 4 continue
[    4.522134]    udevd-120     1d.h. 4672099us : i9xx_hpd_irq_handler: PIN 5 continue
[    4.522183]    udevd-120     1d.h. 4672100us : i9xx_hpd_irq_handler: PORT 3 PIN 6 continue
[    4.522233]    udevd-120     1d.h. 4672101us : i9xx_hpd_irq_handler: PORT 3 PIN 6 sets queue_dig = true
[    4.522283]    udevd-120     1d.h. 4672102us : i9xx_hpd_irq_handler: QUEUE
[    4.522331]    <...>-6       0.... 4672125us : i915_digport_work_func: WORK
[    4.522339] ---------------------------------
[    4.522345] Modules linked in: i915(+) drm_kms_helper drm i2c_algo_bit thermal video processor thermal_sys button scsi_dh_rdac scsi_dh_alua scsi_dh_emc scsi_dh_hp_sw scsi_dh netconsole atl1c
[    4.522401] CPU: 0 PID: 6 Comm: kworker/u4:0 Not tainted 3.17.0-bisect #222
[    4.522408] Hardware name: TOSHIBA SATELLITE T130/SATELLITE T130, BIOS V1.70    09/29/2009
[    4.522453] Workqueue: i915-dp i915_digport_work_func [i915]
[    4.522462] task: ffff88013f166150 ti: ffff88013f168000 task.ti: ffff88013f168000
[    4.522470] RIP: 0010:[<ffffffffa014323d>]  [<ffffffffa014323d>] gen4_read32+0x3d/0xc0 [i915]
[    4.522520] RSP: 0018:ffff88013f16bd48  EFLAGS: 00010086
[    4.522527] RAX: 0000000000000297 RBX: ffff88013b1f0000 RCX: 00000000000000da
[    4.522533] RDX: ffffc900108c4000 RSI: ffff88013b1f93c8 RDI: ffff88013b1f0068
[    4.522540] RBP: ffff88013f16bd70 R08: 0000000000000001 R09: 0000000000000024
[    4.522547] R10: 00000001167af8eb R11: 0000000000000006 R12: 00000000000c4000
[    4.522553] R13: ffff88013b1f0068 R14: 0000000000000001 R15: 0000000000000001
[    4.522560] FS:  0000000000000000(0000) GS:ffff88013fc00000(0000) knlGS:0000000000000000
[    4.522568] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[    4.522575] CR2: ffffc900108c4000 CR3: 0000000001a15000 CR4: 00000000000407f0
[    4.522581] Stack:
[    4.522586]  0000000000800000 0000000000000011 ffff88013584e000 0000000000000001
[    4.522601]  ffff880036c92000 ffff88013f16bd88 ffffffffa01537b3 ffff88013b1f0000
[    4.522617]  ffff88013f16bdc8 ffffffffa0179a73 ffff880036c920e0 ffff88013b1f9400
[    4.522632] Call Trace:
[    4.522681]  [<ffffffffa01537b3>] ibx_digital_port_connected+0x63/0xb0 [i915]
[    4.522733]  [<ffffffffa0179a73>] intel_dp_hpd_pulse+0xc3/0x1f0 [i915]
[    4.522777]  [<ffffffffa0131d60>] i915_digport_work_func+0xb0/0x130 [i915]
[    4.522789]  [<ffffffff81060b26>] process_one_work+0x186/0x3f0
[    4.522797]  [<ffffffff81060eb1>] worker_thread+0x121/0x480
[    4.522806]  [<ffffffff81060d90>] ? process_one_work+0x3f0/0x3f0
[    4.522815]  [<ffffffff81065689>] kthread+0xc9/0xe0
[    4.522824]  [<ffffffff810655c0>] ? kthread_create_on_node+0x170/0x170
[    4.522834]  [<ffffffff8157edac>] ret_from_fork+0x7c/0xb0
[    4.522843]  [<ffffffff810655c0>] ? kthread_create_on_node+0x170/0x170
[    4.522849] Code: 41 54 49 89 f4 53 48 8d b7 c8 93 00 00 48 89 fb 48 8b 3f 4c 8d 6b 68 e8 f2 f1 ff ff 4c 89 ef e8 4a b7 43 e1 4c 89 e2 48 03 53 60 <44> 8b 32 48 89 c6 4c 89 ef e8 a5 b3 43 e1 8b 05 f7 0d 08 00 85 
[    4.523001] RIP  [<ffffffffa014323d>] gen4_read32+0x3d/0xc0 [i915]
[    4.523050]  RSP <ffff88013f16bd48>
[    4.523055] CR2: ffffc900108c4000
[    4.523064] ---[ end trace 08b04cb79531ee7e ]---
[    4.523070] Kernel panic - not syncing: Fatal exception
[    4.523096] Dumping ftrace buffer:
[    4.523101]    (ftrace buffer empty)
[    4.523109] Kernel Offset: 0x0 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffff9fffffff)
[    4.523118] Rebooting in 10 seconds..
---
 drivers/gpu/drm/i915/i915_drv.c |    2 ++
 drivers/gpu/drm/i915/i915_irq.c |   11 +++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +2 -0
@@ -496,6 +496,7 @@ bool i915_semaphore_is_enabled(struct dr
 
 void intel_hpd_cancel_work(struct drm_i915_private *dev_priv)
 {
+	trace_printk("CANCEL\n");
 	spin_lock_irq(&dev_priv->irq_lock);
 
 	dev_priv->long_hpd_port_mask = 0;
@@ -507,6 +508,7 @@ void intel_hpd_cancel_work(struct drm_i9
 	cancel_work_sync(&dev_priv->dig_port_work);
 	cancel_work_sync(&dev_priv->hotplug_work);
 	cancel_delayed_work_sync(&dev_priv->hotplug_reenable_work);
+	trace_printk("CANCEL DONE\n");
 }
 
 static void intel_suspend_encoders(struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/i915_irq.c +9 -2
@@ -1100,6 +1100,7 @@ static void i915_digport_work_func(struc
 	int i, ret;
 	u32 old_bits = 0;
 
+	trace_printk("WORK\n");
 	spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
 	long_port_mask = dev_priv->long_hpd_port_mask;
 	dev_priv->long_hpd_port_mask = 0;
@@ -1757,10 +1758,13 @@ static inline void intel_hpd_irq_handler
 
 	spin_lock(&dev_priv->irq_lock);
 	for (i = 1; i < HPD_NUM_PINS; i++) {
-		if (!(hpd[i] & hotplug_trigger))
+		if (!(hpd[i] & hotplug_trigger)) {
+			trace_printk("PIN %d continue\n", i);
 			continue;
+		}
 
 		port = get_port_from_pin(i);
+		trace_printk("PORT %d PIN %d continue\n", port, i);
 		if (port && dev_priv->hpd_irq_port[port]) {
 			bool long_hpd;
 
@@ -1784,6 +1788,7 @@ static inline void intel_hpd_irq_handler
 				hotplug_trigger &= ~hpd[i];
 			}
 			queue_dig = true;
+			trace_printk("PORT %d PIN %d sets queue_dig = true\n", port, i);
 		}
 	}
 
@@ -1840,8 +1845,10 @@ static inline void intel_hpd_irq_handler
 	 * queue for otherwise the flush_work in the pageflip code will
 	 * deadlock.
 	 */
-	if (queue_dig)
+	if (queue_dig) {
+		trace_printk("QUEUE\n");
 		queue_work(dev_priv->dp_wq, &dev_priv->dig_port_work);
+	}
 	if (queue_hp)
 		schedule_work(&dev_priv->hotplug_work);
 }
maintainer
#2 lore raw
Quoted 4 lines

drm/i915: add DP 1.2 MST support (v0.7)

This adds DP 1.2 MST support on Haswell systems.

I've attached a patch that might fix this, please test and let me know.

Dave.

From d407c946fbf5c48f30160591f5bd71fbe158aeb4 Mon Sep 17 00:00:00 2001
From: Dave Airlie <[email protected]>
Date: Mon, 1 Sep 2014 16:58:12 +1000
Subject: [PATCH] drm/i915: handle G45/GM45 pulse detection connected state.

In the HPD pulse handler we check for long pulses if the port is actually connected, however we do that for IBX, but we use the pulse handling code on GM45 systems as well, so we need to use a diffent check.

This patch refactors the digital port connected check out of the g4x detection path and reuses it in the hpd pulse path.

Should fix:
Message-ID: <[email protected]>

---
 drivers/gpu/drm/i915/intel_dp.c | 55 +++++++++++++++++++++++++++--------------
 1 file changed, 37 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +37 -18
index 67cfed6..81d7681 100644
@@ -3661,24 +3661,12 @@ ironlake_dp_detect(struct intel_dp *intel_dp)
 	return intel_dp_detect_dpcd(intel_dp);
 }
 
-static enum drm_connector_status
-g4x_dp_detect(struct intel_dp *intel_dp)
+static int g4x_digital_port_connected(struct drm_device *dev,
+				       struct intel_digital_port *intel_dig_port)
 {
-	struct drm_device *dev = intel_dp_to_dev(intel_dp);
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
 	uint32_t bit;
 
-	/* Can't disconnect eDP, but you can close the lid... */
-	if (is_edp(intel_dp)) {
-		enum drm_connector_status status;
-
-		status = intel_panel_detect(dev);
-		if (status == connector_status_unknown)
-			status = connector_status_connected;
-		return status;
-	}
-
 	if (IS_VALLEYVIEW(dev)) {
 		switch (intel_dig_port->port) {
 		case PORT_B:
@@ -3691,7 +3679,7 @@ g4x_dp_detect(struct intel_dp *intel_dp)
 			bit = PORTD_HOTPLUG_LIVE_STATUS_VLV;
 			break;
 		default:
-			return connector_status_unknown;
+			return -EINVAL;
 		}
 	} else {
 		switch (intel_dig_port->port) {
@@ -3705,11 +3693,36 @@ g4x_dp_detect(struct intel_dp *intel_dp)
 			bit = PORTD_HOTPLUG_LIVE_STATUS_G4X;
 			break;
 		default:
-			return connector_status_unknown;
+			return -EINVAL;
 		}
 	}
 
 	if ((I915_READ(PORT_HOTPLUG_STAT) & bit) == 0)
+		return 0;
+	return 1;
+}
+
+static enum drm_connector_status
+g4x_dp_detect(struct intel_dp *intel_dp)
+{
+	struct drm_device *dev = intel_dp_to_dev(intel_dp);
+	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
+	int ret;
+
+	/* Can't disconnect eDP, but you can close the lid... */
+	if (is_edp(intel_dp)) {
+		enum drm_connector_status status;
+
+		status = intel_panel_detect(dev);
+		if (status == connector_status_unknown)
+			status = connector_status_connected;
+		return status;
+	}
+
+	ret = g4x_digital_port_connected(dev, intel_dig_port);
+	if (ret == -EINVAL)
+		return connector_status_unknown;
+	else if (ret == 0)
 		return connector_status_disconnected;
 
 	return intel_dp_detect_dpcd(intel_dp);
@@ -4066,8 +4079,14 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
 	intel_display_power_get(dev_priv, power_domain);
 
 	if (long_hpd) {
-		if (!ibx_digital_port_connected(dev_priv, intel_dig_port))
-			goto mst_fail;
+
+		if (HAS_PCH_SPLIT(dev)) {
+			if (!ibx_digital_port_connected(dev_priv, intel_dig_port))
+				goto mst_fail;
+		} else {
+			if (g4x_digital_port_connected(dev, intel_dig_port) != 1)
+				goto mst_fail;
+		}
 
 		if (!intel_dp_get_dpcd(intel_dp)) {
 			goto mst_fail;
Signature · 1 line
1.9.3

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

#3 lore raw
Quoted 5 lines · Dave Airlie
Quoted 4 lines

drm/i915: add DP 1.2 MST support (v0.7)

This adds DP 1.2 MST support on Haswell systems.

I've attached a patch that might fix this, please test and let me know.

Lappy hasn't exploded in 20 boot cycles, which judging by previous behavior should mean all is well (knocks anti-deterministic wood). Thanks.

-Mike

Reviewed-by
#4 lore raw
In reply to Dave Airlie
Quoted 17 lines · Dave Airlie
Quoted 4 lines

drm/i915: add DP 1.2 MST support (v0.7)

This adds DP 1.2 MST support on Haswell systems.

I've attached a patch that might fix this, please test and let me know.

Dave.

From d407c946fbf5c48f30160591f5bd71fbe158aeb4 Mon Sep 17 00:00:00 2001
From: Dave Airlie <[email protected]>
Date: Mon, 1 Sep 2014 16:58:12 +1000
Subject: [PATCH] drm/i915: handle G45/GM45 pulse detection connected state.

In the HPD pulse handler we check for long pulses if the port is actually connected, however we do that for IBX, but we use the pulse handling code on GM45 systems as well, so we need to use a diffent check.

Quoted 8 lines

This patch refactors the digital port connected check out of the g4x detection path and reuses it in the hpd pulse path.

Should fix:
Message-ID: <[email protected]>

Quoted 102 lines
---
 drivers/gpu/drm/i915/intel_dp.c | 55 +++++++++++++++++++++++++++--------------
 1 file changed, 37 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +37 -18
index 67cfed6..81d7681 100644
@@ -3661,24 +3661,12 @@ ironlake_dp_detect(struct intel_dp *intel_dp)
 	return intel_dp_detect_dpcd(intel_dp);
 }
 
-static enum drm_connector_status
-g4x_dp_detect(struct intel_dp *intel_dp)
+static int g4x_digital_port_connected(struct drm_device *dev,
+				       struct intel_digital_port *intel_dig_port)
 {
-	struct drm_device *dev = intel_dp_to_dev(intel_dp);
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
 	uint32_t bit;
 
-	/* Can't disconnect eDP, but you can close the lid... */
-	if (is_edp(intel_dp)) {
-		enum drm_connector_status status;
-
-		status = intel_panel_detect(dev);
-		if (status == connector_status_unknown)
-			status = connector_status_connected;
-		return status;
-	}
-
 	if (IS_VALLEYVIEW(dev)) {
 		switch (intel_dig_port->port) {
 		case PORT_B:
@@ -3691,7 +3679,7 @@ g4x_dp_detect(struct intel_dp *intel_dp)
 			bit = PORTD_HOTPLUG_LIVE_STATUS_VLV;
 			break;
 		default:
-			return connector_status_unknown;
+			return -EINVAL;
 		}
 	} else {
 		switch (intel_dig_port->port) {
@@ -3705,11 +3693,36 @@ g4x_dp_detect(struct intel_dp *intel_dp)
 			bit = PORTD_HOTPLUG_LIVE_STATUS_G4X;
 			break;
 		default:
-			return connector_status_unknown;
+			return -EINVAL;
 		}
 	}
 
 	if ((I915_READ(PORT_HOTPLUG_STAT) & bit) == 0)
+		return 0;
+	return 1;
+}
+
+static enum drm_connector_status
+g4x_dp_detect(struct intel_dp *intel_dp)
+{
+	struct drm_device *dev = intel_dp_to_dev(intel_dp);
+	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
+	int ret;
+
+	/* Can't disconnect eDP, but you can close the lid... */
+	if (is_edp(intel_dp)) {
+		enum drm_connector_status status;
+
+		status = intel_panel_detect(dev);
+		if (status == connector_status_unknown)
+			status = connector_status_connected;
+		return status;
+	}
+
+	ret = g4x_digital_port_connected(dev, intel_dig_port);
+	if (ret == -EINVAL)
+		return connector_status_unknown;
+	else if (ret == 0)
 		return connector_status_disconnected;
 
 	return intel_dp_detect_dpcd(intel_dp);
@@ -4066,8 +4079,14 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
 	intel_display_power_get(dev_priv, power_domain);
 
 	if (long_hpd) {
-		if (!ibx_digital_port_connected(dev_priv, intel_dig_port))
-			goto mst_fail;
+
+		if (HAS_PCH_SPLIT(dev)) {
+			if (!ibx_digital_port_connected(dev_priv, intel_dig_port))
+				goto mst_fail;
+		} else {
+			if (g4x_digital_port_connected(dev, intel_dig_port) != 1)
+				goto mst_fail;
+		}
 
 		if (!intel_dp_get_dpcd(intel_dp)) {
 			goto mst_fail;
Signature · 1 line
1.9.3
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Tested-by
#5 lore raw
Quoted 12 lines · Daniel Vetter
Quoted 12 lines

From d407c946fbf5c48f30160591f5bd71fbe158aeb4 Mon Sep 17 00:00:00 2001
From: Dave Airlie <[email protected]>
Date: Mon, 1 Sep 2014 16:58:12 +1000
Subject: [PATCH] drm/i915: handle G45/GM45 pulse detection connected state.

In the HPD pulse handler we check for long pulses if the port is actually connected, however we do that for IBX, but we use the pulse handling code on GM45 systems as well, so we need to use a diffent check.

This patch refactors the digital port connected check out of the g4x detection path and reuses it in the hpd pulse path.

Quoted 7 lines
Quoted 5 lines

Should fix:
Message-ID: <[email protected]>

I was just about to start bisecting, as my thinkpad x200s with Gen4 chip wouldn't ocassionally boot with -rc3, but this patch seems to be the cure for me as well.

FWIW

Signature · 2 lines
Jiri Kosina
SUSE Labs
Acked-by
#6 lore raw
In reply to Dave Airlie
Quoted 15 lines · Dave Airlie

From: Dave Airlie <[email protected]>
Date: Mon, 1 Sep 2014 16:58:12 +1000
Subject: [PATCH] drm/i915: handle G45/GM45 pulse detection connected state.

In the HPD pulse handler we check for long pulses if the port is actually
connected, however we do that for IBX, but we use the pulse handling code on
GM45 systems as well, so we need to use a diffent check.

This patch refactors the digital port connected check out of the g4x detection
path and reuses it in the hpd pulse path.

Quoted 5 lines

Should fix:
Message-ID: <[email protected]>

Daniel reviewed this already, but Jani asked me to take a look, so:

One thing for the future is to move ibx_digital_port_connected() to intel_dp.c too and make its return value match that of g4x_digital_port_connected().

--Imre

Quoted 103 lines
---
 drivers/gpu/drm/i915/intel_dp.c | 55
+++++++++++++++++++++++++++--------------
 1 file changed, 37 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +2 -14
index 67cfed6..81d7681 100644
@@ -3661,24 +3661,12 @@ ironlake_dp_detect(struct intel_dp *intel_dp)
        return intel_dp_detect_dpcd(intel_dp);
 }
 
-static enum drm_connector_status
-g4x_dp_detect(struct intel_dp *intel_dp)
+static int g4x_digital_port_connected(struct drm_device *dev,
+                                      struct intel_digital_port
 *intel_dig_port)
 {
-       struct drm_device *dev = intel_dp_to_dev(intel_dp);
        struct drm_i915_private *dev_priv = dev->dev_private;
-       struct intel_digital_port *intel_dig_port =
 dp_to_dig_port(intel_dp);
        uint32_t bit;
 
-       /* Can't disconnect eDP, but you can close the lid... */
-       if (is_edp(intel_dp)) {
-               enum drm_connector_status status;
-
-               status = intel_panel_detect(dev);
-               if (status == connector_status_unknown)
-                       status = connector_status_connected;
-               return status;
-       }
-
        if (IS_VALLEYVIEW(dev)) {
                switch (intel_dig_port->port) {
                case PORT_B:
drivers/gpu/drm/i915/intel_dp.c +27 -2
@@ -3691,7 +3679,7 @@ g4x_dp_detect(struct intel_dp *intel_dp)
                        bit = PORTD_HOTPLUG_LIVE_STATUS_VLV;
                        break;
                default:
-                       return connector_status_unknown;
+                       return -EINVAL;
                }
        } else {
                switch (intel_dig_port->port) {
@@ -3705,11 +3693,36 @@ g4x_dp_detect(struct intel_dp *intel_dp)
                        bit = PORTD_HOTPLUG_LIVE_STATUS_G4X;
                        break;
                default:
-                       return connector_status_unknown;
+                       return -EINVAL;
                }
        }
 
        if ((I915_READ(PORT_HOTPLUG_STAT) & bit) == 0)
+               return 0;
+       return 1;
+}
+
+static enum drm_connector_status
+g4x_dp_detect(struct intel_dp *intel_dp)
+{
+       struct drm_device *dev = intel_dp_to_dev(intel_dp);
+       struct intel_digital_port *intel_dig_port =
 dp_to_dig_port(intel_dp);
+       int ret;
+
+       /* Can't disconnect eDP, but you can close the lid... */
+       if (is_edp(intel_dp)) {
+               enum drm_connector_status status;
+
+               status = intel_panel_detect(dev);
+               if (status == connector_status_unknown)
+                       status = connector_status_connected;
+               return status;
+       }
+
+       ret = g4x_digital_port_connected(dev, intel_dig_port);
+       if (ret == -EINVAL)
+               return connector_status_unknown;
+       else if (ret == 0)
                return connector_status_disconnected;
 
        return intel_dp_detect_dpcd(intel_dp);
drivers/gpu/drm/i915/intel_dp.c +6 -2
@@ -4066,8 +4079,14 @@ intel_dp_hpd_pulse(struct intel_digital_port
 *intel_dig_port, bool long_hpd)
        intel_display_power_get(dev_priv, power_domain);
 
        if (long_hpd) {
-               if (!ibx_digital_port_connected(dev_priv,
 intel_dig_port))
-                       goto mst_fail;
+
+               if (HAS_PCH_SPLIT(dev)) {
+                       if (!ibx_digital_port_connected(dev_priv,
 intel_dig_port))
+                               goto mst_fail;
+               } else {
+                       if (g4x_digital_port_connected(dev,

intel_dig_port) != 1)

drivers/gpu/drm/i915/intel_dp.c intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) · line 4092

Quoted 5 lines
drivers/gpu/drm/i915/intel_dp.c +2 -0
+                               goto mst_fail;
+               }
 
                if (!intel_dp_get_dpcd(intel_dp)) {
                        goto mst_fail;

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

#7 lore raw
Quoted 16 lines · Imre Deak
Quoted 15 lines · Dave Airlie

From: Dave Airlie <[email protected]>
Date: Mon, 1 Sep 2014 16:58:12 +1000
Subject: [PATCH] drm/i915: handle G45/GM45 pulse detection connected state.

In the HPD pulse handler we check for long pulses if the port is actually
connected, however we do that for IBX, but we use the pulse handling code on
GM45 systems as well, so we need to use a diffent check.

This patch refactors the digital port connected check out of the g4x detection
path and reuses it in the hpd pulse path.

Quoted 8 lines
Quoted 5 lines

Should fix:
Message-ID: <[email protected]>

Daniel reviewed this already, but Jani asked me to take a look, so:

Pushed to drm-intel-fixes, thanks for the patch, review, and testing.

BR,
Jani.

Quoted 116 lines

One thing for the future is to move ibx_digital_port_connected() to intel_dp.c too and make its return value match that of g4x_digital_port_connected().

--Imre

Quoted 108 lines
---
 drivers/gpu/drm/i915/intel_dp.c | 55
+++++++++++++++++++++++++++--------------
 1 file changed, 37 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +2 -14
index 67cfed6..81d7681 100644
@@ -3661,24 +3661,12 @@ ironlake_dp_detect(struct intel_dp *intel_dp)
        return intel_dp_detect_dpcd(intel_dp);
 }
 
-static enum drm_connector_status
-g4x_dp_detect(struct intel_dp *intel_dp)
+static int g4x_digital_port_connected(struct drm_device *dev,
+                                      struct intel_digital_port
 *intel_dig_port)
 {
-       struct drm_device *dev = intel_dp_to_dev(intel_dp);
        struct drm_i915_private *dev_priv = dev->dev_private;
-       struct intel_digital_port *intel_dig_port =
 dp_to_dig_port(intel_dp);
        uint32_t bit;
 
-       /* Can't disconnect eDP, but you can close the lid... */
-       if (is_edp(intel_dp)) {
-               enum drm_connector_status status;
-
-               status = intel_panel_detect(dev);
-               if (status == connector_status_unknown)
-                       status = connector_status_connected;
-               return status;
-       }
-
        if (IS_VALLEYVIEW(dev)) {
                switch (intel_dig_port->port) {
                case PORT_B:
drivers/gpu/drm/i915/intel_dp.c +27 -2
@@ -3691,7 +3679,7 @@ g4x_dp_detect(struct intel_dp *intel_dp)
                        bit = PORTD_HOTPLUG_LIVE_STATUS_VLV;
                        break;
                default:
-                       return connector_status_unknown;
+                       return -EINVAL;
                }
        } else {
                switch (intel_dig_port->port) {
@@ -3705,11 +3693,36 @@ g4x_dp_detect(struct intel_dp *intel_dp)
                        bit = PORTD_HOTPLUG_LIVE_STATUS_G4X;
                        break;
                default:
-                       return connector_status_unknown;
+                       return -EINVAL;
                }
        }
 
        if ((I915_READ(PORT_HOTPLUG_STAT) & bit) == 0)
+               return 0;
+       return 1;
+}
+
+static enum drm_connector_status
+g4x_dp_detect(struct intel_dp *intel_dp)
+{
+       struct drm_device *dev = intel_dp_to_dev(intel_dp);
+       struct intel_digital_port *intel_dig_port =
 dp_to_dig_port(intel_dp);
+       int ret;
+
+       /* Can't disconnect eDP, but you can close the lid... */
+       if (is_edp(intel_dp)) {
+               enum drm_connector_status status;
+
+               status = intel_panel_detect(dev);
+               if (status == connector_status_unknown)
+                       status = connector_status_connected;
+               return status;
+       }
+
+       ret = g4x_digital_port_connected(dev, intel_dig_port);
+       if (ret == -EINVAL)
+               return connector_status_unknown;
+       else if (ret == 0)
                return connector_status_disconnected;
 
        return intel_dp_detect_dpcd(intel_dp);
drivers/gpu/drm/i915/intel_dp.c +6 -2
@@ -4066,8 +4079,14 @@ intel_dp_hpd_pulse(struct intel_digital_port
 *intel_dig_port, bool long_hpd)
        intel_display_power_get(dev_priv, power_domain);
 
        if (long_hpd) {
-               if (!ibx_digital_port_connected(dev_priv,
 intel_dig_port))
-                       goto mst_fail;
+
+               if (HAS_PCH_SPLIT(dev)) {
+                       if (!ibx_digital_port_connected(dev_priv,
 intel_dig_port))
+                               goto mst_fail;
+               } else {
+                       if (g4x_digital_port_connected(dev,

intel_dig_port) != 1)

drivers/gpu/drm/i915/intel_dp.c +2 -0
+                               goto mst_fail;
+               }
 
                if (!intel_dp_get_dpcd(intel_dp)) {
                        goto mst_fail;
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center