Bug 105470

Summary: [BISECTED] Failure to boot docked with laptop lid closed
Product: DRI Reporter: Laura Abbott <labbott>
Component: DRM/IntelAssignee: Dhinakaran Pandiyan <dhinakaran.pandiyan>
Status: CLOSED FIXED QA Contact: Intel GFX Bugs mailing list <intel-gfx-bugs>
Severity: major    
Priority: high CC: dhinakaran.pandiyan, intel-gfx-bugs, mzink, sbroz
Version: unspecifiedKeywords: bisected, regression
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=105465
i915 platform: KBL i915 features: power/Other
Description Flags
git bisect log
output with drm.debug=14
Revert none

Description Laura Abbott 2018-03-12 23:16:30 UTC
Created attachment 138048 [details]
git bisect log

Fedora has gotten several reports of 100% failure to boot while docked (see https://bugzilla.redhat.com/show_bug.cgi?id=1549042 for example) as a regression between kernel versions 4.14 and 4.15. I bisected and came up with 

commit 5ea2355a100a3c6304901d058aee06d3a6be69bc (refs/bisect/bad)
Author: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Date:   Tue Oct 3 17:22:11 2017 +0300

    drm/i915/mst: Use MST sideband message transactions for dpms control
    Use the POWER_DOWN_PHY and POWER_UP_PHY sideband message transactions to
    set power states for downstream sinks. Apart from giving us the ability
    to set power state for individual sinks, this fixes the below test for
    $ xrandr --display :0 --output DP-2-2-8 --off
    $ xrandr --display :0 --output DP-2-2-1 --off
    $ xrandr --display :0 --output DP-2-2-8 --auto #Black screen
    $ xrandr --display :0 --output DP-2-2-1 --auto
    v2: Modify and document the dpms and port disable order (Ville)
        Add comment explaining is_mst = !crtc_state equivalence(Ville, Maarten)
    v3 by Jani: rebase
    References: https://bugs.freedesktop.org/show_bug.cgi?id=90963
    References: https://bugs.freedesktop.org/show_bug.cgi?id=88124
    Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Cc: Lyude <lyude@redhat.com>
    Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
    Reviewed-by: Lyude Paul <lyude@redhat.com>
    Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
    Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20171003142211.860-1-jani.nikula@intel.com

Also fails with drm-tip 2018y-03m-12d-22h-06m-53s

I can track down other reporters but my setup was Lenovo T470s with dock to HDMI monitor

00:02.0 VGA compatible controller: Intel Corporation HD Graphics 620 (rev 02)

Happy to provide more information and point other reporters here.
Comment 1 Dhinakaran Pandiyan 2018-03-13 16:51:11 UTC
Interesting, I wrote this as a fix for black screens that I was seeing with my Lenovo x260 + dock. Can you please attach dmesg with drm.debug=14?
Comment 2 Laura Abbott 2018-03-13 21:55:12 UTC
Created attachment 138078 [details]
output with drm.debug=14

The bug prevents the machine from booting all the way so I can't just collect the information normlaly but I did stop at a dracut shell.
Comment 3 Dhinakaran Pandiyan 2018-03-14 04:14:36 UTC
Created attachment 138088 [details] [review]

Can you please check if this patch helps?
Comment 4 Dhinakaran Pandiyan 2018-03-14 05:43:43 UTC
Based on what I see on my laptop + dock:
If the lid was closed and bios sets up the external MST monitor, I see ddi_get_config() reading this hardware state as SST at boot. This results in ddi_post_disable() getting called instead mst_post_disable() when the pipe is disabled. Later mst_pre_enable() is unable to wake up the hub leading to link training failures.
Comment 5 Dhinakaran Pandiyan 2018-03-14 06:04:18 UTC
Created attachment 138089 [details] [review]

Here's the patch I sent upstream https://patchwork.freedesktop.org/patch/210500/

If that doesn't work, let me know if the attached revert does.
Comment 6 Laura Abbott 2018-03-14 19:57:24 UTC
I replied to the thread but yes the fix does work for me.
Comment 7 Dhinakaran Pandiyan 2018-03-14 23:19:35 UTC
Great, thanks for reporting and the bisect.
Comment 8 Jani Nikula 2018-03-19 11:11:20 UTC
Thanks for the report and the fix, closing.

commit ad260ab32a4d94fa974f58262f8000472d34fd5b
Author: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Date:   Tue Mar 13 22:48:25 2018 -0700

    drm/i915/dp: Write to SET_POWER dpcd to enable MST hub.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.