1. 25 Aug, 2022 5 commits
    • Vivek Kasireddy's avatar
      udmabuf: Set ubuf->sg = NULL if the creation of sg table fails · d9c04a1b
      Vivek Kasireddy authored
      When userspace tries to map the dmabuf and if for some reason
      (e.g. OOM) the creation of the sg table fails, ubuf->sg needs to be
      set to NULL. Otherwise, when the userspace subsequently closes the
      dmabuf fd, we'd try to erroneously free the invalid sg table from
      release_udmabuf resulting in the following crash reported by syzbot:
      
      general protection fault, probably for non-canonical address
      0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN
      KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
      CPU: 0 PID: 3609 Comm: syz-executor487 Not tainted
      5.19.0-syzkaller-13930-g7ebfc85e #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
      Google 07/22/2022
      RIP: 0010:dma_unmap_sgtable include/linux/dma-mapping.h:378 [inline]
      RIP: 0010:put_sg_table drivers/dma-buf/udmabuf.c:89 [inline]
      RIP: 0010:release_udmabuf+0xcb/0x4f0 drivers/dma-buf/udmabuf.c:114
      Code: 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 2b 04 00 00 48 8d 7d 0c 4c
      8b 63 30 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 14
      02 48 89 f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 e2
      RSP: 0018:ffffc900037efd30 EFLAGS: 00010246
      RAX: dffffc0000000000 RBX: ffffffff8cb67800 RCX: 0000000000000000
      RDX: 0000000000000000 RSI: ffffffff84ad27e0 RDI: 0000000000000000
      RBP: fffffffffffffff4 R08: 0000000000000005 R09: 0000000000000000
      R10: 0000000000000000 R11: 000000000008c07c R12: ffff88801fa05000
      R13: ffff888073db07e8 R14: ffff888025c25440 R15: 0000000000000000
      FS:  0000555555fc4300(0000) GS:ffff8880b9a00000(0000)
      knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007fc1c0ce06e4 CR3: 00000000715e6000 CR4: 00000000003506f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       <TASK>
       dma_buf_release+0x157/0x2d0 drivers/dma-buf/dma-buf.c:78
       __dentry_kill+0x42b/0x640 fs/dcache.c:612
       dentry_kill fs/dcache.c:733 [inline]
       dput+0x806/0xdb0 fs/dcache.c:913
       __fput+0x39c/0x9d0 fs/file_table.c:333
       task_work_run+0xdd/0x1a0 kernel/task_work.c:177
       ptrace_notify+0x114/0x140 kernel/signal.c:2353
       ptrace_report_syscall include/linux/ptrace.h:420 [inline]
       ptrace_report_syscall_exit include/linux/ptrace.h:482 [inline]
       syscall_exit_work kernel/entry/common.c:249 [inline]
       syscall_exit_to_user_mode_prepare+0x129/0x280 kernel/entry/common.c:276
       __syscall_exit_to_user_mode_work kernel/entry/common.c:281 [inline]
       syscall_exit_to_user_mode+0x9/0x50 kernel/entry/common.c:294
       do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      RIP: 0033:0x7fc1c0c35b6b
      Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24
      0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00
      f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44
      RSP: 002b:00007ffd78a06090 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
      RAX: 0000000000000000 RBX: 0000000000000007 RCX: 00007fc1c0c35b6b
      RDX: 0000000020000280 RSI: 0000000040086200 RDI: 0000000000000006
      RBP: 0000000000000007 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000293 R12: 000000000000000c
      R13: 0000000000000003 R14: 00007fc1c0cfe4a0 R15: 00007ffd78a06140
       </TASK>
      Modules linked in:
      ---[ end trace 0000000000000000 ]---
      RIP: 0010:dma_unmap_sgtable include/linux/dma-mapping.h:378 [inline]
      RIP: 0010:put_sg_table drivers/dma-buf/udmabuf.c:89 [inline]
      RIP: 0010:release_udmabuf+0xcb/0x4f0 drivers/dma-buf/udmabuf.c:114
      
      Reported-by: syzbot+c80e9ef5d8bb45894db0@syzkaller.appspotmail.com
      Cc: Gerd Hoffmann <kraxel@redhat.com>
      Signed-off-by: default avatarVivek Kasireddy <vivek.kasireddy@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/20220825063522.801264-1-vivek.kasireddy@intel.comSigned-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
      d9c04a1b
    • Danilo Krummrich's avatar
      drm/vc4: hvs: protect drm_print_regset32() · b3be4520
      Danilo Krummrich authored
      In vc4_hvs_dump_state() potentially freed resources are protected from
      being accessed with drm_dev_enter()/drm_dev_exit().
      
      Also include drm_print_regset32() in the protected section, since
      drm_print_regset32() does access memory that is typically mapped via
      devm_* calls.
      
      Fixes: 969cfae1 ("drm/vc4: hvs: Protect device resources after removal")
      Signed-off-by: default avatarDanilo Krummrich <dakr@redhat.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20220824161327.330627-5-dakr@redhat.com
      b3be4520
    • Danilo Krummrich's avatar
      drm/vc4: crtc: protect device resources after removal · e0c95303
      Danilo Krummrich authored
      (Hardware) resources which are bound to the driver and device lifecycle
      must not be accessed after the device and driver are unbound.
      
      However, the DRM device isn't freed as long as the last user closed it,
      hence userspace can still call into the driver.
      
      Therefore protect the critical sections which are accessing those
      resources with drm_dev_enter() and drm_dev_exit().
      
      Fixes: 7cc4214c ("drm/vc4: crtc: Switch to drmm_kzalloc")
      Signed-off-by: default avatarDanilo Krummrich <dakr@redhat.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20220824161327.330627-4-dakr@redhat.com
      e0c95303
    • Danilo Krummrich's avatar
      drm/vc4: plane: protect device resources after removal · 6acb416b
      Danilo Krummrich authored
      (Hardware) resources which are bound to the driver and device lifecycle
      must not be accessed after the device and driver are unbound.
      
      However, the DRM device isn't freed as long as the last user closed it,
      hence userspace can still call into the driver.
      
      Therefore protect the critical sections which are accessing those
      resources with drm_dev_enter() and drm_dev_exit().
      
      Fixes: 9872c7a3 ("drm/vc4: plane: Switch to drmm_universal_plane_alloc()")
      Signed-off-by: default avatarDanilo Krummrich <dakr@redhat.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20220824161327.330627-3-dakr@redhat.com
      6acb416b
    • Danilo Krummrich's avatar
      drm/vc4: hdmi: unlock mutex when device is unplugged · 227295df
      Danilo Krummrich authored
      In vc4_hdmi_encoder_{pre,post}_crtc_enable() commit cd00ed51
      ("drm/vc4: hdmi: Protect device resources after removal") missed to
      unlock the mutex before returning due to drm_dev_enter() indicating the
      device being unplugged.
      
      Fixes: cd00ed51 ("drm/vc4: hdmi: Protect device resources after removal")
      Signed-off-by: default avatarDanilo Krummrich <dakr@redhat.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20220824161327.330627-2-dakr@redhat.com
      227295df
  2. 23 Aug, 2022 20 commits
    • Lyude Paul's avatar
      drm/display/dp_mst: Move all payload info into the atomic state · 4d07b0bc
      Lyude Paul authored
      Now that we've finally gotten rid of the non-atomic MST users leftover in
      the kernel, we can finally get rid of all of the legacy payload code we
      have and move as much as possible into the MST atomic state structs. The
      main purpose of this is to make the MST code a lot less confusing to work
      on, as there's a lot of duplicated logic that doesn't really need to be
      here. As well, this should make introducing features like fallback link
      retraining and DSC support far easier.
      
      Since the old payload code was pretty gnarly and there's a Lot of changes
      here, I expect this might be a bit difficult to review. So to make things
      as easy as possible for reviewers, I'll sum up how both the old and new
      code worked here (it took me a while to figure this out too!).
      
      The old MST code basically worked by maintaining two different payload
      tables - proposed_vcpis, and payloads. proposed_vcpis would hold the
      modified payload we wanted to push to the topology, while payloads held the
      payload table that was currently programmed in hardware. Modifications to
      proposed_vcpis would be handled through drm_dp_allocate_vcpi(),
      drm_dp_mst_deallocate_vcpi(), and drm_dp_mst_reset_vcpi_slots(). Then, they
      would be pushed via drm_dp_mst_update_payload_step1() and
      drm_dp_mst_update_payload_step2().
      
      Furthermore, it's important to note how adding and removing VC payloads
      actually worked with drm_dp_mst_update_payload_step1(). When a VC payload
      is removed from the VC table, all VC payloads which come after the removed
      VC payload's slots must have their time slots shifted towards the start of
      the table. The old code handles this by looping through the entire payload
      table and recomputing the start slot for every payload in the topology from
      scratch. While very much overkill, this ends up doing the right thing
      because we always order the VCPIs for payloads from first to last starting
      timeslot.
      
      It's important to also note that drm_dp_mst_update_payload_step2() isn't
      actually limited to updating a single payload - the driver can use it to
      queue up multiple payload changes so that as many of them can be sent as
      possible before waiting for the ACT. This is -technically- not against
      spec, but as Wayne Lin has pointed out it's not consistently implemented
      correctly in hubs - so it might as well be.
      
      drm_dp_mst_update_payload_step2() is pretty self explanatory and basically
      the same between the old and new code, save for the fact we don't have a
      second step for deleting payloads anymore -and thus rename it to
      drm_dp_mst_add_payload_step2().
      
      The new payload code stores all of the current payload info within the MST
      atomic state and computes as much of the state as possible ahead of time.
      This has the one exception of the starting timeslots for payloads, which
      can't be determined at atomic check time since the starting time slots will
      vary depending on what order CRTCs are enabled in the atomic state - which
      varies from driver to driver. These are still stored in the atomic MST
      state, but are only copied from the old MST state during atomic commit
      time. Likewise, this is when new start slots are determined.
      
      Adding/removing payloads now works much more closely to how things are
      described in the spec. When we delete a payload, we loop through the
      current list of payloads and update the start slots for any payloads whose
      time slots came after the payload we just deleted. Determining the starting
      time slots for new payloads being added is done by simply keeping track of
      where the end of the VC table is in
      drm_dp_mst_topology_mgr->next_start_slot. Additionally, it's worth noting
      that we no longer have a single update_payload() function. Instead, we now
      have drm_dp_mst_add_payload_step1|2() and drm_dp_mst_remove_payload(). As
      such, it's now left it up to the driver to figure out when to add or remove
      payloads. The driver already knows when it's disabling/enabling CRTCs, so
      it also already knows when payloads should be added or removed.
      
      Changes since v1:
      * Refactor around all of the completely dead code changes that are
        happening in amdgpu for some reason when they really shouldn't even be
        there in the first place… :\
      * Remove mention of sending one ACT per series of payload updates. As Wayne
        Lin pointed out, there are apparently hubs on the market that don't work
        correctly with this scheme and require a separate ACT per payload update.
      * Fix accidental drop of mst_mgr.lock - Wayne Lin
      * Remove mentions of allowing multiple ACT updates per payload change,
        mention that this is a result of vendors not consistently supporting this
        part of the spec and requiring a unique ACT for each payload change.
      * Get rid of reference to drm_dp_mst_port in DC - turns out I just got
        myself confused by DC and we don't actually need this.
      Changes since v2:
      * Get rid of fix for not sending payload deallocations if ddps=0 and just
        go back to wayne's fix
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Sean Paul <sean@poorly.run>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-18-lyude@redhat.com
      4d07b0bc
    • Lyude Paul's avatar
      drm/radeon: Drop legacy MST support · 01ad1d9c
      Lyude Paul authored
      Right now, radeon is technically the only non-atomic driver still making
      use of the MST helpers - and thus the final user of all of the legacy MST
      helpers. Originally I was going to look into seeing if we could move legacy
      MST into the radeon driver itself, however:
      
      * SI and CIK both can use amdgpu, which still supports MST
      * It currently doesn't work according to my own testing. I'm sure with some
        troubleshooting we could likely fix it, but that brings me to point #2:
      * It was never actually enabled by default, and is still marked as
        experimental in the module parameter description
      * If people were using it, someone probably would have probably seen a bug
        report about how it is currently not functional by now. That certainly
        doesn't appear to be the case, since before getting access to my own
        hardware I had to go out of my way to try finding someone to help test
        whether this legacy MST code even works - even amongst AMD employees.
      * Getting rid of this code and only having atomic versions of the MST
        helpers to maintain is likely going to be a lot easier in the long run,
        and will make it a lot easier for others contributing to this code to
        follow along with what's happening.
      
      FWIW - if anyone still wants this code to be in the tree and has a good
      idea of how to support this without needing to maintain the legacy MST
      helpers (trying to move them would probably be acceptable), I'm happy to
      suggestions. But my hope is that we can just drop this code and forget
      about it. I've already run this idea by Harry Wentland and Alex Deucher a
      few times as well.
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Sean Paul <sean@poorly.run>
      Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-17-lyude@redhat.com
      01ad1d9c
    • Lyude Paul's avatar
      drm/display/dp_mst: Maintain time slot allocations when deleting payloads · 6366fc70
      Lyude Paul authored
      Currently, we set drm_dp_atomic_payload->time_slots to 0 in order to
      indicate that we're about to delete a payload in the current atomic state.
      Since we're going to be dropping all of the legacy code for handling the
      payload table however, we need to be able to ensure that we still keep
      track of the current time slot allocations for each payload so we can reuse
      this info when asking the root MST hub to delete payloads. We'll also be
      using it to recalculate the start slots of each VC.
      
      So, let's keep track of the intent of a payload in drm_dp_atomic_payload by
      adding ->delete, which we set whenever we're planning on deleting a payload
      during the current atomic commit.
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Sean Paul <sean@poorly.run>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-16-lyude@redhat.com
      6366fc70
    • Lyude Paul's avatar
      drm/display/dp_mst: Drop all ports from topology on CSNs before queueing link address work · 2482fcee
      Lyude Paul authored
      We want to start cutting down on all of the places that we use port
      validation, so that ports may be removed from the topology as quickly as
      possible to minimize the number of errors we run into as a result of being
      out of sync with the current topology status. This isn't a very typical
      scenario and I don't think I've ever even run into it - but since the next
      commit is going to make some changes to payload updates depending on their
      hotplug status I think it's a probably good idea to take precautions.
      
      Let's do this with CSNs by moving some code around so that we only queue
      link address probing work at the end of handling all CSNs - allowing us to
      make sure we drop as many topology references as we can beforehand.
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Sean Paul <sean@poorly.run>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-15-lyude@redhat.com
      2482fcee
    • Lyude Paul's avatar
      drm/display/dp_mst: Add helpers for serializing SST <-> MST transitions · a76eb429
      Lyude Paul authored
      There's another kind of situation where we could potentially race with
      nonblocking modesets and MST, especially if we were to only use the locking
      provided by atomic modesetting:
      
      * Display 1 begins as enabled on DP-1 in SST mode
      * Display 1 switches to MST mode, exposes one sink in MST mode
      * Userspace does non-blocking modeset to disable the SST display
      * Userspace does non-blocking modeset to enable the MST display with a
        different CRTC, but the SST display hasn't been fully taken down yet
      * Execution order between the last two commits isn't guaranteed since they
        share no drm resources
      
      We can fix this however, by ensuring that we always pull in the atomic
      topology state whenever a connector capable of driving an MST display
      performs its atomic check - and then tracking CRTC commits happening on the
      SST connector in the MST topology state. So, let's add some simple helpers
      for doing that and hook them up in various drivers.
      
      v2:
      * Use intel_dp_mst_source_support() to check for MST support in i915, fixes
        CI failures
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Sean Paul <sean@poorly.run>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-14-lyude@redhat.com
      a76eb429
    • Lyude Paul's avatar
      drm/nouveau/kms: Pull mst state in for all modesets · 21167510
      Lyude Paul authored
      Since we're going to be relying on atomic locking for payloads now (and the
      MST mgr needs to track CRTCs), pull in the topology state for all modesets
      in nv50_msto_atomic_check().
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-13-lyude@redhat.com
      21167510
    • Lyude Paul's avatar
      drm/nouveau/kms: Cache DP encoders in nouveau_connector · 11d27389
      Lyude Paul authored
      Post-NV50, the only kind of encoder you'll find for DP connectors on Nvidia
      GPUs are SORs (serial output resources). Because SORs have fixed
      associations with their connectors, we can correctly assume that any DP
      connector on a nvidia GPU will have exactly one SOR encoder routed to it
      for DisplayPort.
      
      Since we're going to need to be able to retrieve this fixed SOR DP encoder
      much more often as a result of hooking up MST helpers for tracking
      SST<->MST transitions in atomic states, let's simply cache this encoder in
      nouveau_connector for any DP connectors on the system to avoid looking it
      up each time. This isn't safe for NV50 since PIORs then come into play,
      however there's no code pre-NV50 that would need to look this up anyhow -
      so it's not really an issue.
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-12-lyude@redhat.com
      11d27389
    • Lyude Paul's avatar
      drm/display/dp_mst: Fix modeset tracking in drm_dp_atomic_release_vcpi_slots() · 083351e9
      Lyude Paul authored
      Currently with the MST helpers we avoid releasing payloads _and_ avoid
      pulling in the MST state if there aren't any actual payload changes. While
      we want to keep the first step, we need to now make sure that we're always
      pulling in the MST state on all modesets that can modify payloads - even if
      the resulting payloads in the atomic state are identical to the previous
      ones.
      
      This is mainly to make it so that if a CRTC is still assigned to a
      connector but is set to DPMS off, the CRTC still holds it's payload
      allocation in the atomic state and still appropriately pulls in the MST
      state for commit tracking. Otherwise, we'll occasionally forget to update
      MST payloads from changes caused by non-atomic DPMS changes. Doing this
      also allows us to track bandwidth limitations in a state correctly even
      between DPMS changes, so that there's no chance of a simple ->active change
      being rejected by the atomic check.
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Sean Paul <sean@poorly.run>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-11-lyude@redhat.com
      083351e9
    • Lyude Paul's avatar
      drm/display/dp_mst: Don't open code modeset checks for releasing time slots · ffac9721
      Lyude Paul authored
      I'm not sure why, but at the time I originally wrote the find/release time
      slot helpers I thought we should avoid keeping modeset tracking out of the
      MST helpers. In retrospect though there's no actual good reason to do
      this, and the logic has ended up being identical across all the drivers
      using the helpers. Also, it needs to be fixed anyway so we don't break
      things when going atomic-only with MST.
      
      So, let's just move this code into drm_dp_atomic_release_time_slots() and
      stop open coding it.
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Sean Paul <sean@poorly.run>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-10-lyude@redhat.com
      ffac9721
    • Lyude Paul's avatar
      drm/display/dp_mst: Add nonblocking helpers for DP MST · a5c2c0d1
      Lyude Paul authored
      As Daniel Vetter pointed out, if we only use the atomic modesetting locks
      with MST it's technically possible for a driver with non-blocking modesets
      to race when it comes to MST displays - as we make the mistake of not doing
      our own CRTC commit tracking in the topology_state object.
      
      This could potentially cause problems if something like this happens:
      
      * User starts non-blocking commit to disable CRTC-1 on MST topology 1
      * User starts non-blocking commit to enable CRTC-2 on MST topology 1
      
      There's no guarantee here that the commit for disabling CRTC-2 will only
      occur after CRTC-1 has finished, since neither commit shares a CRTC - only
      the private modesetting object for MST. Keep in mind this likely isn't a
      problem for blocking modesets, only non-blocking.
      
      So, begin fixing this by keeping track of which CRTCs on a topology have
      changed by keeping track of which CRTCs we release or allocate timeslots
      on. As well, add some helpers for:
      
      * Setting up the drm_crtc_commit structs in the ->commit_setup hook
      * Waiting for any CRTC dependencies from the previous topology state
      
      v2:
      * Use drm_dp_mst_atomic_setup_commit() directly - Jani
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Sean Paul <sean@poorly.run>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-9-lyude@redhat.com
      a5c2c0d1
    • Lyude Paul's avatar
      drm/display/dp_mst: Add helper for finding payloads in atomic MST state · 0b4e477e
      Lyude Paul authored
      We already open-code this quite often, and will be iterating through
      payloads even more once we've moved all of the payload tracking into the
      atomic state. So, let's add a helper for doing this.
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Sean Paul <sean@poorly.run>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-8-lyude@redhat.com
      0b4e477e
    • Lyude Paul's avatar
      drm/display/dp_mst: Add some missing kdocs for atomic MST structs · 0bee2ae2
      Lyude Paul authored
      Since we're about to start adding some stuff here, we may as well fill in
      any missing documentation that we forgot to write.
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Sean Paul <sean@poorly.run>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-7-lyude@redhat.com
      0bee2ae2
    • Lyude Paul's avatar
      drm/display/dp_mst: Fix confusing docs for drm_dp_atomic_release_time_slots() · 946c7014
      Lyude Paul authored
      For some reason we mention returning 0 if "slots have been added back to
      drm_dp_mst_topology_state->avail_slots". This is totally misleading,
      avail_slots is simply for figuring out the total number of slots available
      in total on the topology and has no relation to the current payload
      allocations.
      
      So, let's get rid of that comment.
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Sean Paul <sean@poorly.run>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-6-lyude@redhat.com
      946c7014
    • Lyude Paul's avatar
      drm/display/dp_mst: Call them time slots, not VCPI slots · df78f7f6
      Lyude Paul authored
      VCPI is only sort of the correct term here, originally the majority of this
      code simply referred to timeslots vaguely as "slots" - and since I started
      working on it and adding atomic functionality, the name "VCPI slots" has
      been used to represent time slots.
      
      Now that we actually have consistent access to the DisplayPort spec thanks
      to VESA, I now know this isn't actually the proper term - as the
      specification refers to these as time slots.
      
      Since we're trying to make this code as easy to figure out as possible,
      let's take this opportunity to correct this nomenclature and call them by
      their proper name - timeslots. Likewise, we rename various functions
      appropriately, along with replacing references in the kernel documentation
      and various debugging messages.
      
      It's important to note that this patch series leaves the legacy MST code
      untouched for the most part, which is fine since we'll be removing it soon
      anyhow. There should be no functional changes in this series.
      
      v2:
      * Add note that Wayne Lin from AMD suggested regarding slots being between
        the source DP Tx and the immediate downstream DP Rx
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Sean Paul <sean@poorly.run>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-5-lyude@redhat.com
      df78f7f6
    • Lyude Paul's avatar
      drm/display/dp_mst: Rename drm_dp_mst_vcpi_allocation · 48b6b372
      Lyude Paul authored
      In retrospect, the name I chose for this originally is confusing, as
      there's a lot more info in here then just the VCPI. This really should be
      called a payload. Let's make it more obvious that this is meant to be
      related to the atomic state and is about payloads by renaming it to
      drm_dp_mst_atomic_payload. Also, rename various variables throughout the
      code that use atomic payloads.
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Sean Paul <sean@poorly.run>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-4-lyude@redhat.com
      48b6b372
    • Lyude Paul's avatar
      drm/amdgpu/dm/mst: Rename get_payload_table() · dbaadb3c
      Lyude Paul authored
      This function isn't too confusing if you see the comment around the
      call-site for it, but if you don't then it's not at all obvious this is
      meant to copy DRM's payload table over to DC's internal state structs.
      Seeing this function before finding that comment definitely threw me into a
      loop a few times.
      
      So, let's rename this to make it's purpose more obvious regardless of where
      in the code you are.
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-3-lyude@redhat.com
      dbaadb3c
    • Lyude Paul's avatar
      drm/amdgpu/dc/mst: Rename dp_mst_stream_allocation(_table) · 8c5e9bbb
      Lyude Paul authored
      Just to make this more clear to outside contributors that these are
      DC-specific structs, as this also threw me into a loop a number of times
      before I figured out the purpose of this.
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Cc: Wayne Lin <Wayne.Lin@amd.com>
      Cc: Fangzhi Zuo <Jerry.Zuo@amd.com>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220817193847.557945-2-lyude@redhat.com
      8c5e9bbb
    • Steev Klimaszewski's avatar
      drm/panel-edp: add IVO M133NW4J-R3 panel entry · 0f9fa5f5
      Steev Klimaszewski authored
      Add an eDP panel entry for IVO M133NW4J-R3.
      
      Due to lack of documentation, use the delay_200_500_p2e100 timings for
      now.
      Signed-off-by: default avatarSteev Klimaszewski <steev@kali.org>
      [dianders: fixed typo in commit message]
      Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220720054152.2450-1-steev@kali.org
      0f9fa5f5
    • wangjianli's avatar
    • Beniamin Sandu's avatar
  3. 22 Aug, 2022 12 commits
  4. 19 Aug, 2022 1 commit
  5. 16 Aug, 2022 1 commit
  6. 15 Aug, 2022 1 commit