1. 31 May, 2023 2 commits
  2. 26 May, 2023 5 commits
  3. 24 May, 2023 7 commits
  4. 23 May, 2023 1 commit
  5. 22 May, 2023 2 commits
  6. 19 May, 2023 10 commits
  7. 18 May, 2023 1 commit
  8. 17 May, 2023 3 commits
  9. 16 May, 2023 9 commits
    • Imre Deak's avatar
      drm/i915/tc: Reset TypeC PHYs left enabled in DP-alt mode after the sink disconnects · c598c335
      Imre Deak authored
      If the output on a DP-alt link with its sink disconnected is kept
      enabled for too long (about 20 sec), then some IOM/TCSS firmware timeout
      will cause havoc on the PCI bus, at least for other GFX devices on it
      which will stop powering up. Since user space is not guaranteed to do a
      disabling modeset in time, switch such disconnected but active links to
      TBT mode - which is without such shortcomings - with a 2 second delay.
      
      If the above condition is detected already during the driver load/system
      resume sanitization step disable the output instead, as at that point no
      user space or kernel client depends on a consistent output state yet and
      because subsequent atomic modeset on such connectors - without the
      actual sink capabilities available - can fail.
      
      An active/disconnected port as above will also block the HPD status of
      other active/disconnected ports to get updated (stuck in the connected
      state), until the former port is disabled, its PHY is disconnected and
      a ~10 ms delay has elapsed. This means the link state for all TypeC
      ports/CRTCs must be rechecked after a CRTC is disabled due to the above
      reason. For this disconnect the PHY synchronously after the CRTC/port is
      disabled and recheck all CRTCs for the above condition whenever such a
      port is disabled.
      
      To account for a race condition during driver loading where the sink is
      disconnected after the above sanitization step and before the HPD
      interrupts get enabled, do an explicit check/link reset if needed from
      the encoder's late_register hook, which is called after the HPD
      interrupts are enabled already.
      
      v2:
      - Handle an active/disconnected port blocking the HPD state update of
        another active/disconnected port.
      - Cancel the delayed work resetting the link also from the encoder
        enable/suspend/shutdown hooks.
      - Rebase on the earlier intel_modeset_lock_ctx_retry() addition,
        fixing here the missed atomic state reset in case of a retry.
      - Fix handling of an error return from intel_atomic_get_crtc_state().
      - Recheck if the port needs to be reset after all the atomic state
        is locked and async commits are waited on.
      
      v3:
      - Add intel_crtc_needs_link_reset(), instead of open-coding it,
        keep intel_crtc_has_encoders(). (Ville)
      - Fix state dumping and use a bitmask to track disabled CRTCs in
        intel_sanitize_all_crtcs(). (Ville)
      - Set internal in intel_atomic_state right after allocating it.
        (Ville)
      - Recheck all CRTCs (not yet force-disabled) after a CRTC is
        force-disabled for any reason (not only due to a link state)
        in intel_sanitize_all_crtcs().
      - Reduce delay after CRTC disabling to 20ms, and use the simpler
        msleep().
      - Clarify code comment about HPD behaviour in
        intel_sanitize_all_crtcs().
      - Move all the TC link reset logic to intel_tc.c .
      - Cancel the link reset work synchronously during system suspend,
        driver unload and shutdown.
      
      v4:
      - Rebased on previous patch, which allows calling the TC port
        suspend/cleanup handlers without modeset locks held; remove the
        display driver suspended assert from the link reset work
        accordingly.
      
      v5: (Ville)
      - Remove reset work canceling from intel_ddi_pre_pll_enable().
      - Track a crtc vs. pipe mask in intel_sanitize_all_crtcs().
      - Add reset_link_commit() to clarify the
        intel_modeset_lock_ctx_retry loop.
      
      Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Tested-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/5860Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230512195513.2699-2-imre.deak@intel.com
      c598c335
    • Imre Deak's avatar
      drm/i915/tc: Call TypeC port flush_work/cleanup without modeset locks held · b61fad5f
      Imre Deak authored
      Call the TypeC port flush_work and cleanup handlers without the modeset
      locks held. These don't require the locks, as the work takes - as it
      should be able to at any point in time - any locks it needs and by the
      time cleanup is called and after cleanup returns the encoder is not in
      use.
      
      This is required by the next patch canceling a TypeC port work
      synchronously during encoder suspend and shutdown, where the work can
      take modeset locks as well, hence the canceling must be done without
      holding the locks.
      
      I also considered moving the modeset locking down to each encoder
      suspend()/shutdown() hook instead, however locking the full modeset
      state for each encoder separately would be odd, and the bigger change -
      affecting all encoders - is beyond the scope of this patchset.
      
      v2:
      - Add a TODO: comment to remove modeset locks if no encoder depends
        on this. (Ville)
      
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230512195513.2699-1-imre.deak@intel.com
      b61fad5f
    • Imre Deak's avatar
      drm/i915: Factor out a helper for handling atomic modeset locks/state · 60ded7cc
      Imre Deak authored
      This patch simplifying the handling of modeset locks and atomic state
      for an atomic commit is based on
      
      https://lore.kernel.org/all/20210715184954.7794-2-ville.syrjala@linux.intel.com/
      
      adding the helper to i915. I find this approach preferrable than
      open-coding the corresponding steps (fixed for me an atomic
      state reset during a DEADLK retry, which I missed in the open-coded
      version) and also better than the existing
      DRM_MODESET_LOCK_ALL_BEGIN/END macros for the reasons described in the
      above original patchset.
      
      This change takes the helper into use only for atomic commits during DDI
      hotplug handling, as a preparation for a follow-up patch adding a
      similar commit started from the same spot. Other places doing a
      driver-internal atomic commit is to be converted by a follow-up
      patchset.
      
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230510103131.1618266-13-imre.deak@intel.com
      60ded7cc
    • Imre Deak's avatar
      drm/i915/dp: Factor out intel_dp_get_active_pipes() · 7e4460c3
      Imre Deak authored
      Factor out a helper used by a follow up patch to reset an active DP
      link.
      
      No functional changes.
      
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230510103131.1618266-12-imre.deak@intel.com
      7e4460c3
    • Imre Deak's avatar
      drm/i915/dp: Prevent link training fallback on disconnected port · f45156ff
      Imre Deak authored
      Prevent downgrading the link training maximum lane count/rate if the
      sink is disconnected - and so the link training failure is expected. In
      such cases modeset failures due to the reduced max link params would be
      just confusing for user space (instead of which the correct thing it
      should act on is the sink disconnect signaled by a hotplug event,
      requiring a disabling modeset).
      
      v2:
      - Check the actual HPD state to handle the forced connector state case.
        (Vinod)
      
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Vinod Govindapillai <vinod.govindapillai@intel.com>
      Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> (v1)
      Reviewed-by: default avatarVinod Govindapillai <vinod.govindapillai@intel.com>
      Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230510103131.1618266-11-imre.deak@intel.com
      f45156ff
    • Imre Deak's avatar
      drm/i915/dp: Convert link training error to debug message on disconnected sink · 9031c6d4
      Imre Deak authored
      If a sink is disconnected it's expected that link training actions will
      fail on it, so downgrade the error messages about such actions to be a
      debug message. Such - expected - link training failures are more
      frequent after a follow up patch, after which an active TypeC link is
      reset after the sink is disconnected which also involves a link
      training.
      
      v2:
      - Check the actual HPD state to handle the forced connector state case.
        (Vinod)
      
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Vinod Govindapillai <vinod.govindapillai@intel.com>
      Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> (v1)
      Reviewed-by: default avatarVinod Govindapillai <vinod.govindapillai@intel.com>
      Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230510103131.1618266-10-imre.deak@intel.com
      9031c6d4
    • Imre Deak's avatar
      drm/i915/dp: Add link training debug and error printing helpers · f48eab29
      Imre Deak authored
      Add functions for printing link training debug and error messages, both
      to prepare for the next patch, which downgrades an error to a debug
      message if the sink is disconnected and to remove some code duplication.
      
      v2: (Ville)
      - Always print the connector prefix.
      - Preserve the drm_dbg_kms() debug category.
      v3:
      - Keep printing the name of functions calling the helpers. (Jani)
      
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> (v2)
      Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230510103131.1618266-9-imre.deak@intel.com
      f48eab29
    • Imre Deak's avatar
      drm/i915: Add support for disabling any CRTCs during HW readout/sanitization · e826839e
      Imre Deak authored
      During HW readout/sanitization CRTCs can be disabled only if they don't
      have an attached encoder (and so the encoder disable hooks don't need to
      be called). An upcoming patch will need to disable CRTCs also with an
      attached encoder, so add support for this.
      
      For bigjoiner configs the encoder disabling hooks require the slave CRTC
      states, so add these too to the atomic state. Since the connector atomic
      state is already up-to-date when the CRTC is disabled the connector
      state needs to be updated (reset) after the CRTC is disabled, make this
      so. Follow the proper order of disabling first all bigjoiner slaves,
      then any port synced CRTC slaves followed by the CRTC originally
      requested to be disabled.
      
      v2:
      - Fix calculating the bigjoiner_masters mask in a port sync config,
        (Ville)
      - Keep _noatomic suffix in intel_crtc_disable_noatomic(). (Ville)
      - Rebase on full CRTC state reset in this patchset, not requiring
        resetting the bigjoiner state separately and (instead) resetting
        the full atomic CRTC and related global state after all linked
        pipes got disabled.
      - Disable portsync slaves before a portsync master.
      - Disable a portsync master if a linked portsync slave is disabled.
      
      v3: (Ville)
      - Use s/u32/u8 for transcoder and pipe masks.
      - Use is_power_of_2() instead of hweight()==1.
      
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230510103131.1618266-8-imre.deak@intel.com
      e826839e
    • Imre Deak's avatar
      drm/i915: Factor out set_encoder_for_connector() · 26281d35
      Imre Deak authored
      Factor out a function setting the encoder and CRTC in the connector
      atomic state, required by a follow up patch.
      
      No functional changes.
      
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230510103131.1618266-7-imre.deak@intel.com
      26281d35