1. 24 Oct, 2019 5 commits
    • Lyude Paul's avatar
      drm/dp_mst: Add probe_lock · 14692a36
      Lyude Paul authored
      Currently, MST lacks locking in a lot of places that really should have
      some sort of locking. Hotplugging and link address code paths are some
      of the offenders here, as there is actually nothing preventing us from
      running a link address probe while at the same time handling a
      connection status update request - something that's likely always been
      possible but never seen in the wild because hotplugging has been broken
      for ages now (with the exception of amdgpu, for reasons I don't think
      are worth digging into very far).
      
      Note: I'm going to start using the term "in-memory topology layout" here
      to refer to drm_dp_mst_port->mstb and drm_dp_mst_branch->ports.
      
      Locking in these places is a little tougher then it looks though.
      Generally we protect anything having to do with the in-memory topology
      layout under &mgr->lock. But this becomes nearly impossible to do from
      the context of link address probes due to the fact that &mgr->lock is
      usually grabbed under random various modesetting locks, meaning that
      there's no way we can just invert the &mgr->lock order and keep it
      locked throughout the whole process of updating the topology.
      
      Luckily there are only two workers which can modify the in-memory
      topology layout: drm_dp_mst_up_req_work() and
      drm_dp_mst_link_probe_work(), meaning as long as we prevent these two
      workers from traveling the topology layout in parallel with the intent
      of updating it we don't need to worry about grabbing &mgr->lock in these
      workers for reads. We only need to grab &mgr->lock in these workers for
      writes, so that readers outside these two workers are still protected
      from the topology layout changing beneath them.
      
      So, add the new &mgr->probe_lock and use it in both
      drm_dp_mst_link_probe_work() and drm_dp_mst_up_req_work(). Additionally,
      add some more detailed explanations for how this locking is intended to
      work to drm_dp_mst_port->mstb and drm_dp_mst_branch->ports.
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Reviewed-by: default avatarSean Paul <sean@poorly.run>
      Cc: Juston Li <juston.li@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Harry Wentland <hwentlan@amd.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20191022023641.8026-6-lyude@redhat.com
      14692a36
    • Lyude Paul's avatar
      drm/dp_mst: Handle UP requests asynchronously · 9408cc94
      Lyude Paul authored
      Once upon a time, hotplugging devices on MST branches actually worked in
      DRM. Now, it only works in amdgpu (likely because of how it's hotplug
      handlers are implemented). On both i915 and nouveau, hotplug
      notifications from MST branches are noticed - but trying to respond to
      them causes messaging timeouts and causes the whole topology state to go
      out of sync with reality, usually resulting in the user needing to
      replug the entire topology in hopes that it actually fixes things.
      
      The reason for this is because the way we currently handle UP requests
      in MST is completely bogus. drm_dp_mst_handle_up_req() is called from
      drm_dp_mst_hpd_irq(), which is usually called from the driver's hotplug
      handler. Because we handle sending the hotplug event from this function,
      we actually cause the driver's hotplug handler (and in turn, all
      sideband transactions) to block on
      drm_device->mode_config.connection_mutex. This makes it impossible to
      send any sideband messages from the driver's connector probing
      functions, resulting in the aforementioned sideband message timeout.
      
      There's even more problems with this beyond breaking hotplugging on MST
      branch devices. It also makes it almost impossible to protect
      drm_dp_mst_port struct members under a lock because we then have to
      worry about dealing with all of the lock dependency issues that ensue.
      
      So, let's finally actually fix this issue by handling the processing of
      up requests asyncronously. This way we can send sideband messages from
      most contexts without having to deal with getting blocked if we hold
      connection_mutex. This also fixes MST branch device hotplugging on i915,
      finally!
      
      Cc: Juston Li <juston.li@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Harry Wentland <hwentlan@amd.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: default avatarSean Paul <sean@poorly.run>
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20191022023641.8026-5-lyude@redhat.com
      9408cc94
    • Lyude Paul's avatar
      drm/dp_mst: Refactor pdt setup/teardown, add more locking · c485e2c9
      Lyude Paul authored
      Since we're going to be implementing suspend/resume reprobing very soon,
      we need to make sure we are extra careful to ensure that our locking
      actually protects the topology state where we expect it to. Turns out
      this isn't the case with drm_dp_port_setup_pdt() and
      drm_dp_port_teardown_pdt(), both of which change port->mstb without
      grabbing &mgr->lock.
      
      Additionally, since most callers of these functions are just using it to
      teardown the port's previous PDT and setup a new one we can simplify
      things a bit and combine drm_dp_port_setup_pdt() and
      drm_dp_port_teardown_pdt() into a single function:
      drm_dp_port_set_pdt(). This function also handles actually ensuring that
      we grab the correct locks when we need to modify port->mstb.
      
      Cc: Juston Li <juston.li@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Harry Wentland <hwentlan@amd.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: default avatarSean Paul <sean@poorly.run>
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20191022023641.8026-4-lyude@redhat.com
      c485e2c9
    • Lyude Paul's avatar
      drm/dp_mst: Remove PDT teardown in drm_dp_destroy_port() and refactor · d29333cf
      Lyude Paul authored
      This will allow us to add some locking for port->* members, in
      particular the PDT and ->connector, which can't be done from
      drm_dp_destroy_port() since we don't know what locks the caller might be
      holding.
      
      Note that we already do this in delayed_destroy_work (renamed from
      destroy_connector_work in this patch) for ports, we're just making it so
      mstbs are also destroyed in this worker.
      
      Changes since v2:
      * Clarify commit message
      Changes since v4:
      * Clarify commit message more
      
      Cc: Juston Li <juston.li@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Harry Wentland <hwentlan@amd.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: default avatarSean Paul <sean@poorly.run>
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20191022023641.8026-3-lyude@redhat.com
      d29333cf
    • Lyude Paul's avatar
      drm/dp_mst: Destroy MSTBs asynchronously · 7cb12d48
      Lyude Paul authored
      When reprobing an MST topology during resume, we have to account for the
      fact that while we were suspended it's possible that mstbs may have been
      removed from any ports in the topology. Since iterating downwards in the
      topology requires that we hold &mgr->lock, destroying MSTBs from this
      context would result in attempting to lock &mgr->lock a second time and
      deadlocking.
      
      So, fix this by first moving destruction of MSTBs into
      destroy_connector_work, then rename destroy_connector_work and friends
      to reflect that they now destroy both ports and mstbs.
      
      Note that even though this means that MSTBs will still be accessible for
      a short period of time between their removal from the topology and
      delayed destruction, we are still protected against referencing a MSTB
      with a refcount of 0 since we use kref_get_unless_zero() in most places.
      
      Changes since v1:
      * s/destroy_connector_list/destroy_port_list/
        s/connector_destroy_lock/delayed_destroy_lock/
        s/connector_destroy_work/delayed_destroy_work/
        s/drm_dp_finish_destroy_branch_device/drm_dp_delayed_destroy_mstb/
        s/drm_dp_finish_destroy_port/drm_dp_delayed_destroy_port/
        - danvet
      * Use two loops in drm_dp_delayed_destroy_work() - danvet
      * Better explain why we need to do this - danvet
      * Use cancel_work_sync() instead of flush_work() - flush_work() doesn't
        account for work requeing
      
      Cc: Juston Li <juston.li@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Harry Wentland <hwentlan@amd.com>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Reviewed-by: default avatarSean Paul <sean@poorly.run>
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20191022023641.8026-2-lyude@redhat.com
      7cb12d48
  2. 23 Oct, 2019 1 commit
  3. 22 Oct, 2019 3 commits
    • Dave Airlie's avatar
      Merge tag 'du-next-20191016' of git://linuxtv.org/pinchartl/media into drm-next · f1b4a921
      Dave Airlie authored
      - R-Car DU support for R8A774B1 SoC
      - R-Car DU fixes for H2 ES2.0 and later revisions
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20191015215116.GF19403@pendragon.ideasonboard.com
      f1b4a921
    • Dave Airlie's avatar
      Merge tag 'mediatek-drm-next-5.5' of https://github.com/ckhu-mediatek/linux.git-tags into drm-next · 400e9134
      Dave Airlie authored
      Mediatek DRM next for Linux 5.5
      
      This include mipi_tx, dsi, and partial crtc for MT8183 SoC.
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: CK Hu <ck.hu@mediatek.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/1571103548.4416.6.camel@mtksdaap41
      400e9134
    • Dave Airlie's avatar
      Merge tag 'drm-intel-next-2019-10-21' of git://anongit.freedesktop.org/drm/drm-intel into drm-next · 89910e62
      Dave Airlie authored
      UAPI Changes:
      
      - Introduce a versioning of the i915-perf uapi (Lionel)
      - Add support for perf configuration queries (Lionel)
      
        Allow listing perf configurations with IOCTL in addition
        to sysfs. This is useful in container usecases.
      
      - Allow dynamic reconfiguration of the OA stream (Chris)
      
        Allows the OA stream to be reconfigured between
        batch buffers, giving greater flexibility in sampling.
      
      - Allow holding preemption on filtered perf ctx
      
        Allow CAP_ADMIN to block pre-emption of a context
        to query performance counters without disturbances.
      
        Mesa changes: https://gitlab.freedesktop.org/mesa/mesa/merge_requests/932
      
      Cross-subsystem Changes:
      
      - drm-next backmerge for HDR DP changes
        https://lists.freedesktop.org/archives/dri-devel/2019-September/236453.html
      
      Driver Changes:
      
      - Add DC3CO sleep state for Tigerlake (Anshuman)
      - Tigerlake BCS engine support engine relative MMIO (Daniele)
      - Simplify the Tigerlake LRC register list for !RCS (Daniele)
      - Read SAGV block time from PCODE on Tigerlake (James)
      - Add 12 missing Tigerlake workarounds (Mika)
      - Enable DDI/Port G for Tigerlake (Khaled)
      
      - Avoid hang in tsg,vfe units by keeping l3 clocks ICL+(Mika)
      - Fix Bugzilla #111966: Favor last VBT child device (Ville)
      - Fix blue/black screen on boot due to broken gamma (Swati)
      - Add support of BT.2020 Colorimetry to DP MSA (Gwan-gyeong)
      - Attach colorspace property to DP connector (Gwan-gyeong)
      - Attach HDR metadata property to DP connector (Gwan-gyeong)
      - Base intel_memory_region support prep for local memory (Matt A)
      - Introduce Jasper Lake PCH (Matt R)
      - Support multiple GPUs in PMU (Tvrtko)
      - Fix MST oops due to MSA changes (Ville)
      - Refuse modes with hdisplay==4096 on pre-HSW DP (Ville)
      - Correct the PCH type in irq postinstall for JSP (Vivek)
      - Save Master transcoder in slave's crtc_state for Transcoder Port Sync (Manasi)
      - Enable TRANSCODER PORT SYNC for tiled displays across separate ports (Manasi)
      - HW state readout for transcoder port sync config (Manasi)
      - Enable master-slaves in trans port sync (Manasi)
      - In port sync mode disable slaves first then master (Manasi)
      - Fix port checks for MST support on gen >= 11 (Lucas)
      
      - Flush submission tasklet before waiting/retiring (Chris)
      - Flush tasklet submission before sleeping on i915_request_wait (Chris)
      - Object pin reference counting fixes (Chris, Matt A)
      - Clear semaphore immediately upon ELSP promotion (Chris)
      - Child device size remains unchanged through VBT 229 (Matt R)
      - Restore dropped 'interruptible' flag on retiring requests (Chris)
      - Treat a busy timeline as 'active' while waiting (Chris)
      - Clean up struct_mutex from perf (Chris)
      - Update locking around execlists->active (Chris)
      - Mark up expected execlist state during reset (Chris)
      - Remove cursor use of properties for coordinates (Maarten)
      - Only mark incomplete requests as -EIO on cancelling (Chris)
      - Add an rcu_barrier option to i915_drop_caches (Chris)
      - Replace perf global wakeref tracking with engine-pm (Chris)
      - Prevent merging requests with conflicting flags (Chris)
      - Allow for CS OA configs to be created lazily (Lionel)
      - Implement active wait for noa configurations (Lionel)
      - Execute OA configuration from command stream (Lionel)
      - Prefer using the pinned_ctx for emitting delays on config (Chris)
      - Port C's hotplug interrupt is associated with TC1 bits (Vivek, Matt R)
      - Extend program of VSC Header and DB for Colorimetry Format (Gwan-gyeong)
      - Fine-tune timeslicing of contexts (Chris)
      - Do initial mocs configuration directly (Chris)
      - Fix uninitialized variable on PMU error path (Tvrtko)
      - Don't disable interrupts independently of the locking (Sebastian)
      - Eliminate struct_mutext from GVT (Chris)
      
      - Move perf types to their own header (Lionel)
      - Drop list of perf streams (always size 1) (Lionel)
      - Store the perf associated engine of a stream (Lionel)
      - Make array hw_engine_mask static (Colin)
      - Prefer shortest path to RPM/perf/GT instead of dev_priv (Chris, Tvrtko)
      - Virtual request submission fixes (Chris)
      - Selftest/CI improvements (Chris)
      - Fix Kconfig indentation (Krzysztof)
      - Give engine->kernel_context distinct timeline lock classes (Chris)
      - Fix null pointer deref on selftest error path (Colin)
      - Select DPLL's via mask (Matt R)
      - Introduce and use intel_atomic_crtc_state_for_each_plane_state (Maarten)
      - Use intel_plane_state in prepare and cleanup plane_fb (Maarten)
      - Remove begin/finish_crtc_commit (Maarten)
      - Move SAGV block time to dev_priv (James)
      - Avoid polluting the i915_oa_config with error pointers (Chris)
      - Squelch display kerneldoc warnings (Chris)
      - Assert tasklet is locked for process_csb() (Chris)
      - Switch to using DP_MSA_MISC_* defines (Ville)
      - Stop using drm_atomic_helper_check_planes() (Ville)
      - Make .modeset_calc_cdclk() mandatory (Ville)
      - Use drm_rect_translate_to()/drm_rect_init() (Ville)
      - Refactor timestamping constants update (Ville)
      - Switch intel_legacy_cursor_update() to intel_ types (Ville)
      - Prepare the connector/encoder mask readout for hw vs. uapi state split (Ville)
      - Prepare the mode readout for hw vs. uapi state split (Ville)
      - Move swizzle_bit under i915_ggtt (Chris)
      - Improve microcontrollers documentation (Daniele)
      - Move the cursor rotation handling into intel_cursor_check_surface() (Ville)
      - Cleanups to pipe code (Ville)
      - Shrink eDRAM ways/sets arrays for code size (Ville)
      - Cleanups to HDCP2 timeout code (Ville)
      - Restore full symmetry in i915_driver_modeset_probe/remove (Janusz)
      - Simplify setting of ddi_io_power_domain (Lucas)
      - Add pipe id/name to pipe mismatch logs (Lucas)
      - Prettify MST debug message (Lucas)
      - Extract GT ring management to separate files (Andi)
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20191021180337.GA24338@jlahtine-desk.ger.corp.intel.com
      89910e62
  4. 21 Oct, 2019 2 commits
  5. 20 Oct, 2019 8 commits
  6. 19 Oct, 2019 21 commits