Fixes for HPD
Subsystems (3)
v6 cover Fixes for HPD
Latest version of:
https://lists.freedesktop.org/archives/intel-gfx/2016-June/098787.html
The only patch that's changed here is 4/4, the rest are just being sent so that they can be in one thread to make things easier for reviewers
Lyude (4):
drm/i915/vlv: Make intel_crt_reset() per-encoder drm/i915/vlv: Reset the ADPA in vlv_display_power_well_init() drm/i915/vlv: Disable HPD in valleyview_crt_detect_hotplug() drm/i915: Enable polling when we don't have hpd
drivers/gpu/drm/i915/i915_drv.c | 3 + drivers/gpu/drm/i915/i915_drv.h | 5 ++ drivers/gpu/drm/i915/intel_crt.c | 28 ++++++-- drivers/gpu/drm/i915/intel_drv.h | 4 +- drivers/gpu/drm/i915/intel_hotplug.c | 117 ++++++++++++++++++++++++++++---- drivers/gpu/drm/i915/intel_runtime_pm.c | 9 +++ 6 files changed, 148 insertions(+), 18 deletions(-)
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v6 1/4 drm/i915/vlv: Make intel_crt_reset() per-encoder
This lets call intel_crt_reset() in contexts where IRQs are disabled and as such, can't hold the locks required to work with the connectors.
--- drivers/gpu/drm/i915/intel_crt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_crt.c +5 -5
@@ -713,11 +713,11 @@ static int intel_crt_set_property(struct drm_connector *connector,return 0 ; } -static void intel_crt_reset (struct drm_connector *connector) +static void intel_crt_reset (struct drm_encoder *encoder) { -struct drm_device *dev = connector->dev; +struct drm_device *dev = encoder->dev;struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_crt *crt =intel_attached_crt (connector); +struct intel_crt *crt =intel_encoder_to_crt (to_intel_encoder (encoder));if (INTEL_INFO (dev)->gen >=5 ) {u32 adpa;
@@ -739,7 +739,6 @@ static void intel_crt_reset(struct drm_connector *connector)*/ static const struct drm_connector_funcs intel_crt_connector_funcs = { - .reset = intel_crt_reset, .dpms = drm_atomic_helper_connector_dpms, .detect = intel_crt_detect, .fill_modes = drm_helper_probe_single_connector_modes,
@@ -757,6 +756,7 @@ static const struct drm_connector_helper_funcs intel_crt_connector_helper_funcs };static const struct drm_encoder_funcs intel_crt_enc_funcs = { + .reset = intel_crt_reset, .destroy = intel_encoder_destroy, };
@@ -901,5 +901,5 @@ void intel_crt_init(struct drm_device *dev) dev_priv->fdi_rx_config =I915_READ (FDI_RX_CTL (PIPE_A )) & fdi_config; } -intel_crt_reset (connector); +intel_crt_reset (&crt->base.base); }
Signature · 6 lines
2.5.5 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v6 2/4 drm/i915/vlv: Reset the ADPA in vlv_display_power_well_init()
In reply to LyudeWhile VGA hotplugging worked(ish) before, it looks like that was mainly because we'd unintentionally enable it in valleyview_crt_detect_hotplug() when we did a force trigger. This doesn't work reliably enough because whenever the display powerwell on vlv gets disabled, the values set in VLV_ADPA get cleared and consequently VGA hotplugging gets disabled. This causes bugs such as one we found on an Intel NUC, where doing the following sequence of hotplugs:
- Disconnect all monitors
- Connect VGA
- Disconnect VGA
- Connect HDMI
Would result in VGA hotplugging becoming disabled, due to the powerwells getting toggled in the process of connecting HDMI.
Changes since v3:
- Expose intel_crt_reset() through intel_drv.h and call that in vlv_display_power_well_init() instead of encoder->base.funcs->reset(&encoder->base);
Changes since v2:
- Use intel_encoder structs instead of drm_encoder structs
Changes since v1:
- Instead of handling the register writes ourself, we just reuse intel_crt_detect()
- Instead of resetting the ADPA during display IRQ installation, we now reset them in vlv_display_power_well_init()
--- drivers/gpu/drm/i915/intel_crt.c | 2 +- drivers/gpu/drm/i915/intel_drv.h | 2 +- drivers/gpu/drm/i915/intel_runtime_pm.c | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_crt.c +1 -1
@@ -713,7 +713,7 @@ static int intel_crt_set_property(struct drm_connector *connector,return 0 ; } -static void intel_crt_reset (struct drm_encoder *encoder) +void intel_crt_reset (struct drm_encoder *encoder) {struct drm_device *dev = encoder->dev;struct drm_i915_private *dev_priv = dev->dev_private;
drivers/gpu/drm/i915/intel_drv.h +1 -1
@@ -1075,7 +1075,7 @@ void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv,/* intel_crt.c */ void intel_crt_init (struct drm_device *dev); - +void intel_crt_reset (struct drm_encoder *encoder);/* intel_ddi.c */ void intel_ddi_clk_select(struct intel_encoder *encoder,
drivers/gpu/drm/i915/intel_runtime_pm.c +7 -0
@@ -1065,6 +1065,7 @@ static void vlv_init_display_clock_gating(struct drm_i915_private *dev_priv)static void vlv_display_power_well_init (struct drm_i915_private *dev_priv) { +struct intel_encoder *encoder;enum pipe pipe;/*
@@ -1100,6 +1101,12 @@ static void vlv_display_power_well_init(struct drm_i915_private *dev_priv)intel_hpd_init (dev_priv); +/* Re-enable the ADPA, if we have one */ +for_each_intel_encoder (dev_priv->dev, encoder) { +if (encoder->type ==INTEL_OUTPUT_ANALOG ) +intel_crt_reset (&encoder->base); + } +i915_redisable_vga_power_on (dev_priv->dev); }
Signature · 6 lines
2.5.5 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v6 3/4 drm/i915/vlv: Disable HPD in valleyview_crt_detect_hotplug()
In reply to LyudeOne of the things preventing us from using polling is the fact that calling valleyview_crt_detect_hotplug() when there's a VGA cable connected results in sending another hotplug. With polling enabled when HPD is disabled, this results in a scenario like this:
- We enable power wells and reset the ADPA
- output_poll_exec does force probe on VGA, triggering a hpd
- HPD handler waits for poll to unlock dev->mode_config.mutex
- output_poll_exec shuts off the ADPA, unlocks dev->mode_config.mutex
- HPD handler runs, resets ADPA and brings us back to the start
This results in an endless irq storm getting sent from the ADPA whenever a VGA connector gets detected in the middle of polling.
Somewhat based off of the "drm/i915: Disable CRT HPD around force trigger" patch Ville Syrjälä sent a while back
--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_crt.c | 18 ++++++++++++++++++ drivers/gpu/drm/i915/intel_hotplug.c | 27 +++++++++++++++++++++++++++ 3 files changed, 47 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -2933,6 +2933,8 @@ void intel_hpd_init(struct drm_i915_private *dev_priv);void intel_hpd_init_work (struct drm_i915_private *dev_priv);void intel_hpd_cancel_work (struct drm_i915_private *dev_priv);bool intel_hpd_pin_to_port (enum hpd_pin pin,enum port *port); +bool intel_hpd_disable (struct drm_i915_private *dev_priv,enum hpd_pin pin); +void intel_hpd_enable (struct drm_i915_private *dev_priv,enum hpd_pin pin);/* i915_irq.c */ void i915_queue_hangcheck (struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/intel_crt.c +18 -0
@@ -327,10 +327,25 @@ static bool valleyview_crt_detect_hotplug(struct drm_connector *connector)struct drm_device *dev = connector->dev;struct intel_crt *crt =intel_attached_crt (connector);struct drm_i915_private *dev_priv = dev->dev_private; +bool reenable_hpd;u32 adpa;bool ret;u32 save_adpa; +/* +* Doing a force trigger causes a hpd interrupt to get sent, which can +* get us stuck in a loop if we're polling: +* - We enable power wells and reset the ADPA +* - output_poll_exec does force probe on VGA, triggering a hpd +* - HPD handler waits for poll to unlock dev->mode_config.mutex +* - output_poll_exec shuts off the ADPA, unlocks +* dev->mode_config.mutex +* - HPD handler runs, resets ADPA and brings us back to the start +* +* Just disable HPD interrupts here to prevent this +*/ + reenable_hpd =intel_hpd_disable (dev_priv, crt->base.hpd_pin); + save_adpa = adpa =I915_READ (crt->adpa_reg);DRM_DEBUG_KMS ("trigger hotplug detect cycle: adpa=0x%x\n" , adpa);
@@ -353,6 +368,9 @@ static bool valleyview_crt_detect_hotplug(struct drm_connector *connector)DRM_DEBUG_KMS ("valleyview hotplug adpa=0x%x, result %d\n" , adpa, ret); +if (reenable_hpd) +intel_hpd_enable (dev_priv, crt->base.hpd_pin); +return ret; }
drivers/gpu/drm/i915/intel_hotplug.c +27 -0
@@ -510,3 +510,30 @@ void intel_hpd_cancel_work(struct drm_i915_private *dev_priv)cancel_work_sync (&dev_priv->hotplug.hotplug_work);cancel_delayed_work_sync (&dev_priv->hotplug.reenable_work); } + +bool intel_hpd_disable (struct drm_i915_private *dev_priv,enum hpd_pin pin) +{ +bool ret = false; + +if (pin ==HPD_NONE ) +return false; + +spin_lock_irq (&dev_priv->irq_lock); +if (dev_priv->hotplug.stats[pin].state ==HPD_ENABLED ) { + dev_priv->hotplug.stats[pin].state =HPD_DISABLED ; + ret = true; + } +spin_unlock_irq (&dev_priv->irq_lock); + +return ret; +} + +void intel_hpd_enable (struct drm_i915_private *dev_priv,enum hpd_pin pin) +{ +if (pin ==HPD_NONE ) +return ; + +spin_lock_irq (&dev_priv->irq_lock); + dev_priv->hotplug.stats[pin].state =HPD_ENABLED ; +spin_unlock_irq (&dev_priv->irq_lock); +}
Signature · 6 lines
2.5.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v6 4/4 drm/i915: Enable polling when we don't have hpd
In reply to LyudeUnfortunately, there's two situations where we lose hpd right now:
- Runtime suspend
- When we've shut off all of the power wells on Valleyview/Cherryview
While it would be nice if this didn't cause issues, this has the ability to get us in some awkward states where a user won't be able to get their display to turn on. For instance; if we boot a Valleyview system without any monitors connected, it won't need any of it's power wells and thus shut them off. Since this causes us to lose HPD, this means that unless the user knows how to ssh into their machine and do a manual reprobe for monitors, none of the monitors they connect after booting will actually work.
Eventually we should come up with a better fix then having to enable polling for this, since this makes rpm a lot less useful, but for now the infrastructure in i915 just isn't there yet to get hpd in these situations.
Changes since v1:
- Add comment explaining the addition of the if (!mode_config->poll_running) in intel_hpd_init()
- Remove unneeded if (!dev->mode_config.poll_enabled) in i915_hpd_poll_init_work()
- Call to drm_helper_hpd_irq_event() after we disable polling
- Add cancel_work_sync() call to intel_hpd_cancel_work()
Changes since v2:
- Apparently dev->mode_config.poll_running doesn't actually reflect whether or not a poll is currently in progress, and is actually used for dynamic module paramter enabling/disabling. So now we instead keep track of our own poll_running variable in dev_priv->hotplug
- Clean i915_hpd_poll_init_work() a little bit
Changes since v3:
- Remove the now-redundant connector loop in intel_hpd_init(), just rely on intel_hpd_poll_enable() for setting connector->polled correctly on each connector
- Get rid of poll_running
- Don't assign enabled in i915_hpd_poll_init_work before we actually lock dev->mode_config.mutex
- Wrap enabled assignment in i915_hpd_poll_init_work() in READ_ONCE() for doc purposes
- Do the same for dev_priv->hotplug.poll_enabled with WRITE_ONCE in intel_hpd_poll_enable()
- Add some comments about racing not mattering in intel_hpd_poll_enable
Changes since v4:
- Rename intel_hpd_poll_enable() to intel_hpd_poll_init()
- Drop the bool argument from intel_hpd_poll_init()
- Remove redundant calls to intel_hpd_poll_init()
- Rename poll_enable_work to poll_init_work
- Add some kerneldoc for intel_hpd_poll_init()
- Cross-reference intel_hpd_poll_init() in intel_hpd_init()
- Just copy the loop from intel_hpd_init() in intel_hpd_poll_init()
Changes since v5:
- Minor kerneldoc nitpicks
--- drivers/gpu/drm/i915/i915_drv.c | 3 ++ drivers/gpu/drm/i915/i915_drv.h | 3 ++ drivers/gpu/drm/i915/intel_drv.h | 2 + drivers/gpu/drm/i915/intel_hotplug.c | 90 ++++++++++++++++++++++++++++----- drivers/gpu/drm/i915/intel_runtime_pm.c | 2 + 5 files changed, 88 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +3 -0
@@ -1612,6 +1612,9 @@ static int intel_runtime_suspend(struct device *device)assert_forcewakes_inactive (dev_priv); +if (!IS_VALLEYVIEW (dev_priv) || !IS_CHERRYVIEW (dev_priv)) +intel_hpd_poll_init (dev_priv); +DRM_DEBUG_KMS ("Device suspended\n" );return 0 ; }
drivers/gpu/drm/i915/i915_drv.h +3 -0
@@ -283,6 +283,9 @@ struct i915_hotplug {u32 short_port_mask;struct work_struct dig_port_work; +struct work_struct poll_init_work; +bool poll_enabled; +/* * if we get a HPD irq from DP and a HPD irq from non-DP * the non-DP HPD could block the workqueue on a mode config
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -1385,6 +1385,8 @@ int intel_dsi_dcs_init_backlight_funcs(struct intel_connector *intel_connector);/* intel_dvo.c */ void intel_dvo_init (struct drm_device *dev); +/* intel_hotplug.c */ +void intel_hpd_poll_init (struct drm_i915_private *dev_priv);/* legacy fbdev emulation in intel_fbdev.c */
drivers/gpu/drm/i915/intel_hotplug.c +78 -12
128 lines not on this page · raw message
drivers/gpu/drm/i915/intel_runtime_pm.c +2 -0
@@ -1120,6 +1120,8 @@ static void vlv_display_power_well_deinit(struct drm_i915_private *dev_priv)synchronize_irq (dev_priv->dev->irq);vlv_power_sequencer_reset (dev_priv); + +intel_hpd_poll_init (dev_priv); } static void vlv_display_power_well_enable(struct drm_i915_private *dev_priv,
Signature · 6 lines
2.5.5 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Ro.CI.BAT: warning for Fixes for HPD (rev3)
In reply to Lyude== Series Details ==
== Series Details ==
Series: Fixes for HPD (rev3)
URL : https://patchwork.freedesktop.org/series/8870/
State : warning
== Summary ==
Series 8870v3 Fixes for HPD
http://patchwork.freedesktop.org/api/1.0/series/8870/revisions/3/mbox
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-a:
skip -> DMESG-WARN (ro-bdw-i7-5557U)
skip -> DMESG-WARN (ro-bdw-i5-5250u)
Subgroup suspend-read-crc-pipe-c:
skip -> DMESG-WARN (ro-bdw-i7-5557U)
skip -> DMESG-WARN (ro-bdw-i5-5250u)fi-skl-i7-6700k total:226 pass:188 dwarn:0 dfail:0 fail:1 skip:37 ro-bdw-i5-5250u total:226 pass:197 dwarn:4 dfail:0 fail:1 skip:24 ro-bdw-i7-5557U total:226 pass:198 dwarn:3 dfail:0 fail:1 skip:24 ro-bdw-i7-5600u total:226 pass:185 dwarn:0 dfail:0 fail:1 skip:40 ro-bsw-n3050 total:226 pass:170 dwarn:1 dfail:0 fail:4 skip:51 ro-byt-n2820 total:226 pass:173 dwarn:0 dfail:0 fail:4 skip:49 ro-hsw-i3-4010u total:226 pass:190 dwarn:0 dfail:0 fail:1 skip:35 ro-hsw-i7-4770r total:226 pass:190 dwarn:0 dfail:0 fail:1 skip:35 ro-ilk-i7-620lm total:226 pass:150 dwarn:0 dfail:0 fail:2 skip:74 ro-ilk1-i5-650 total:221 pass:150 dwarn:0 dfail:0 fail:2 skip:69 ro-ivb-i7-3770 total:226 pass:181 dwarn:0 dfail:0 fail:1 skip:44 ro-ivb2-i7-3770 total:226 pass:185 dwarn:0 dfail:0 fail:1 skip:40 ro-skl3-i5-6260u total:226 pass:201 dwarn:1 dfail:0 fail:1 skip:23 ro-snb-i7-2620M total:226 pass:174 dwarn:0 dfail:0 fail:2 skip:50
fi-hsw-i7-4770k failed to connect after reboot
fi-kbl-qkkr failed to connect after reboot
fi-skl-i5-6260u failed to connect after reboot
fi-snb-i7-2600 failed to connect after reboot
Results at /archive/results/CI_IGT_test/RO_Patchwork_1267/
f1f5a05 drm-intel-nightly: 2016y-06m-22d-10h-45m-32s UTC integration manifest 4f8a723 drm/i915: Enable polling when we don't have hpd
690a832 drm/i915/vlv: Disable HPD in valleyview_crt_detect_hotplug() 990a134 drm/i915/vlv: Reset the ADPA in vlv_display_power_well_init() ae95081 drm/i915/vlv: Make intel_crt_reset() per-encoder
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: ✗ Ro.CI.BAT: warning for Fixes for HPD (rev3)
Quoted 11 lines · Patchwork
== Series Details ==
Series: Fixes for HPD (rev3)
URL : https://patchwork.freedesktop.org/series/8870/
State : warning== Summary ==
Series 8870v3 Fixes for HPD
http://patchwork.freedesktop.org/api/1.0/series/8870/revisions/3/mbox
Quoted 7 lines
Test
kms_pipe_crc_basic:Subgroup suspend-read-crc-pipe-a: skip -> DMESG-WARN (ro-bdw-i7-5557U) skip -> DMESG-WARN (ro-bdw-i5-5250u) Subgroup suspend-read-crc-pipe-c: skip -> DMESG-WARN (ro-bdw-i7-5557U) skip -> DMESG-WARN (ro-bdw-i5-5250u)
Say hello to the bdw link training fail that's happening all over recently:
https://bugs.freedesktop.org/show_bug.cgi?id=96614
Since it's not entirely clear (at least to me) whether the "enabling power well causes hpd" issue is still present that Ville reported, and since these patches seem stuck forever, I went ahead and applied. Lyude can't repro, and afaik Ville said that this spurious hpd is rather sporadic. -Daniel
Quoted 32 lines
fi-skl-i7-6700k total:226 pass:188 dwarn:0 dfail:0 fail:1 skip:37 ro-bdw-i5-5250u total:226 pass:197 dwarn:4 dfail:0 fail:1 skip:24 ro-bdw-i7-5557U total:226 pass:198 dwarn:3 dfail:0 fail:1 skip:24 ro-bdw-i7-5600u total:226 pass:185 dwarn:0 dfail:0 fail:1 skip:40 ro-bsw-n3050 total:226 pass:170 dwarn:1 dfail:0 fail:4 skip:51 ro-byt-n2820 total:226 pass:173 dwarn:0 dfail:0 fail:4 skip:49 ro-hsw-i3-4010u total:226 pass:190 dwarn:0 dfail:0 fail:1 skip:35 ro-hsw-i7-4770r total:226 pass:190 dwarn:0 dfail:0 fail:1 skip:35 ro-ilk-i7-620lm total:226 pass:150 dwarn:0 dfail:0 fail:2 skip:74 ro-ilk1-i5-650 total:221 pass:150 dwarn:0 dfail:0 fail:2 skip:69 ro-ivb-i7-3770 total:226 pass:181 dwarn:0 dfail:0 fail:1 skip:44 ro-ivb2-i7-3770 total:226 pass:185 dwarn:0 dfail:0 fail:1 skip:40 ro-skl3-i5-6260u total:226 pass:201 dwarn:1 dfail:0 fail:1 skip:23 ro-snb-i7-2620M total:226 pass:174 dwarn:0 dfail:0 fail:2 skip:50fi-hsw-i7-4770k failed to connect after reboot
fi-kbl-qkkr failed to connect after reboot
fi-skl-i5-6260u failed to connect after reboot
fi-snb-i7-2600 failed to connect after rebootResults at /archive/results/CI_IGT_test/RO_Patchwork_1267/
f1f5a05 drm-intel-nightly: 2016y-06m-22d-10h-45m-32s UTC integration manifest 4f8a723 drm/i915: Enable polling when we don't have hpd
690a832 drm/i915/vlv: Disable HPD invalleyview_crt_detect_hotplug()990a134 drm/i915/vlv: Reset the ADPA invlv_display_power_well_init()ae95081 drm/i915/vlv: Makeintel_crt_reset()per-encoder_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx