1. 19 Apr, 2022 1 commit
    • Dmitry Baryshkov's avatar
      drm/msm: Revert "drm/msm: Stop using iommu_present()" · 0371870b
      Dmitry Baryshkov authored
      This reverts commit e2a88eab. The commit
      in question makes msm_use_mmu() check whether the DRM 'component master'
      device is translated by the IOMMU. At this moment it is the 'mdss'
      device.
      However on platforms using the MDP5 driver (e.g. MSM8916/APQ8016,
      MSM8996/APQ8096) it's the mdp5 device, which has the iommus property
      (and thus is "translated by the IOMMU"). This results in these devices
      being broken with the following lines in the dmesg.
      
      [drm] Initialized msm 1.9.0 20130625 for 1a00000.mdss on minor 0
      msm 1a00000.mdss: [drm:adreno_request_fw] loaded qcom/a300_pm4.fw from new location
      msm 1a00000.mdss: [drm:adreno_request_fw] loaded qcom/a300_pfp.fw from new location
      msm 1a00000.mdss: [drm:get_pages] *ERROR* could not get pages: -28
      msm 1a00000.mdss: could not allocate stolen bo
      msm 1a00000.mdss: [drm:get_pages] *ERROR* could not get pages: -28
      msm 1a00000.mdss: [drm:msm_alloc_stolen_fb] *ERROR* failed to allocate buffer object
      msm 1a00000.mdss: [drm:msm_fbdev_create] *ERROR* failed to allocate fb
      
      Getting the mdp5 device pointer from this function is not that easy at
      this moment. Thus this patch is reverted till the MDSS rework [1] lands.
      It will make the mdp5/dpu1 device component master and the check will be
      legit.
      
      [1] https://patchwork.freedesktop.org/series/98525/
      
      Fixes: e2a88eab ("drm/msm: Stop using iommu_present()")
      Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Link: https://lore.kernel.org/r/20220419130422.1033699-1-dmitry.baryshkov@linaro.orgSigned-off-by: default avatarRob Clark <robdclark@chromium.org>
      0371870b
  2. 12 Apr, 2022 1 commit
    • Nathan Chancellor's avatar
      drm/msm/gpu: Avoid -Wunused-function with !CONFIG_PM_SLEEP · 390d6458
      Nathan Chancellor authored
      When building with CONFIG_PM=y and CONFIG_PM_SLEEP=n (such as ARCH=riscv
      allmodconfig), the following warnings/errors occur:
      
        drivers/gpu/drm/msm/adreno/adreno_device.c:679:12: error: 'adreno_system_resume' defined but not used [-Werror=unused-function]
          679 | static int adreno_system_resume(struct device *dev)
              |            ^~~~~~~~~~~~~~~~~~~~
        drivers/gpu/drm/msm/adreno/adreno_device.c:655:12: error: 'adreno_system_suspend' defined but not used [-Werror=unused-function]
          655 | static int adreno_system_suspend(struct device *dev)
              |            ^~~~~~~~~~~~~~~~~~~~~
        cc1: all warnings being treated as errors
      
      These functions are only used in SET_SYSTEM_SLEEP_PM_OPS(), which
      evaluates to empty when CONFIG_PM_SLEEP is not set, making these
      functions unused.
      
      To resolve this, use the SYSTEM_SLEEP_PM_OPS() and RUNTIME_PM_OPS()
      macros, which were introduced in commit 1a3c7bb0 ("PM: core: Add new
      *_PM_OPS macros, deprecate old ones"). They are designed to avoid these
      compiler warnings while still guarding their use on
      CONFIG_PM{,_SLEEP}=y.
      
      Fixes: 7e4167c9 ("drm/msm/gpu: Park scheduler threads for system suspend")
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Link: https://lore.kernel.org/r/20220411181249.2758344-1-nathan@kernel.orgSigned-off-by: default avatarRob Clark <robdclark@chromium.org>
      390d6458
  3. 11 Apr, 2022 5 commits
    • Kuogee Hsieh's avatar
      drm/msm/dp: add fail safe mode outside of event_mutex context · 8b2c181e
      Kuogee Hsieh authored
      There is possible circular locking dependency detected on event_mutex
      (see below logs). This is due to set fail safe mode is done at
      dp_panel_read_sink_caps() within event_mutex scope. To break this
      possible circular locking, this patch move setting fail safe mode
      out of event_mutex scope.
      
      [   23.958078] ======================================================
      [   23.964430] WARNING: possible circular locking dependency detected
      [   23.970777] 5.17.0-rc2-lockdep-00088-g05241de1 #148 Not tainted
      [   23.977219] ------------------------------------------------------
      [   23.983570] DrmThread/1574 is trying to acquire lock:
      [   23.988763] ffffff808423aab0 (&dp->event_mutex){+.+.}-{3:3}, at: msm_dp_displ                                                                             ay_enable+0x58/0x164
      [   23.997895]
      [   23.997895] but task is already holding lock:
      [   24.003895] ffffff808420b280 (&kms->commit_lock[i]/1){+.+.}-{3:3}, at: lock_c                                                                             rtcs+0x80/0x8c
      [   24.012495]
      [   24.012495] which lock already depends on the new lock.
      [   24.012495]
      [   24.020886]
      [   24.020886] the existing dependency chain (in reverse order) is:
      [   24.028570]
      [   24.028570] -> #5 (&kms->commit_lock[i]/1){+.+.}-{3:3}:
      [   24.035472]        __mutex_lock+0xc8/0x384
      [   24.039695]        mutex_lock_nested+0x54/0x74
      [   24.044272]        lock_crtcs+0x80/0x8c
      [   24.048222]        msm_atomic_commit_tail+0x1e8/0x3d0
      [   24.053413]        commit_tail+0x7c/0xfc
      [   24.057452]        drm_atomic_helper_commit+0x158/0x15c
      [   24.062826]        drm_atomic_commit+0x60/0x74
      [   24.067403]        drm_mode_atomic_ioctl+0x6b0/0x908
      [   24.072508]        drm_ioctl_kernel+0xe8/0x168
      [   24.077086]        drm_ioctl+0x320/0x370
      [   24.081123]        drm_compat_ioctl+0x40/0xdc
      [   24.085602]        __arm64_compat_sys_ioctl+0xe0/0x150
      [   24.090895]        invoke_syscall+0x80/0x114
      [   24.095294]        el0_svc_common.constprop.3+0xc4/0xf8
      [   24.100668]        do_el0_svc_compat+0x2c/0x54
      [   24.105242]        el0_svc_compat+0x4c/0xe4
      [   24.109548]        el0t_32_sync_handler+0xc4/0xf4
      [   24.114381]        el0t_32_sync+0x178
      [   24.118688]
      [   24.118688] -> #4 (&kms->commit_lock[i]){+.+.}-{3:3}:
      [   24.125408]        __mutex_lock+0xc8/0x384
      [   24.129628]        mutex_lock_nested+0x54/0x74
      [   24.134204]        lock_crtcs+0x80/0x8c
      [   24.138155]        msm_atomic_commit_tail+0x1e8/0x3d0
      [   24.143345]        commit_tail+0x7c/0xfc
      [   24.147382]        drm_atomic_helper_commit+0x158/0x15c
      [   24.152755]        drm_atomic_commit+0x60/0x74
      [   24.157323]        drm_atomic_helper_set_config+0x68/0x90
      [   24.162869]        drm_mode_setcrtc+0x394/0x648
      [   24.167535]        drm_ioctl_kernel+0xe8/0x168
      [   24.172102]        drm_ioctl+0x320/0x370
      [   24.176135]        drm_compat_ioctl+0x40/0xdc
      [   24.180621]        __arm64_compat_sys_ioctl+0xe0/0x150
      [   24.185904]        invoke_syscall+0x80/0x114
      [   24.190302]        el0_svc_common.constprop.3+0xc4/0xf8
      [   24.195673]        do_el0_svc_compat+0x2c/0x54
      [   24.200241]        el0_svc_compat+0x4c/0xe4
      [   24.204544]        el0t_32_sync_handler+0xc4/0xf4
      [   24.209378]        el0t_32_sync+0x174/0x178
      [   24.213680] -> #3 (crtc_ww_class_mutex){+.+.}-{3:3}:
      [   24.220308]        __ww_mutex_lock.constprop.20+0xe8/0x878
      [   24.225951]        ww_mutex_lock+0x60/0xd0
      [   24.230166]        modeset_lock+0x190/0x19c
      [   24.234467]        drm_modeset_lock+0x34/0x54
      [   24.238953]        drmm_mode_config_init+0x550/0x764
      [   24.244065]        msm_drm_bind+0x170/0x59c
      [   24.248374]        try_to_bring_up_master+0x244/0x294
      [   24.253572]        __component_add+0xf4/0x14c
      [   24.258057]        component_add+0x2c/0x38
      [   24.262273]        dsi_dev_attach+0x2c/0x38
      [   24.266575]        dsi_host_attach+0xc4/0x120
      [   24.271060]        mipi_dsi_attach+0x34/0x48
      [   24.275456]        devm_mipi_dsi_attach+0x28/0x68
      [   24.280298]        ti_sn_bridge_probe+0x2b4/0x2dc
      [   24.285137]        auxiliary_bus_probe+0x78/0x90
      [   24.289893]        really_probe+0x1e4/0x3d8
      [   24.294194]        __driver_probe_device+0x14c/0x164
      [   24.299298]        driver_probe_device+0x54/0xf8
      [   24.304043]        __device_attach_driver+0xb4/0x118
      [   24.309145]        bus_for_each_drv+0xb0/0xd4
      [   24.313628]        __device_attach+0xcc/0x158
      [   24.318112]        device_initial_probe+0x24/0x30
      [   24.322954]        bus_probe_device+0x38/0x9c
      [   24.327439]        deferred_probe_work_func+0xd4/0xf0
      [   24.332628]        process_one_work+0x2f0/0x498
      [   24.337289]        process_scheduled_works+0x44/0x48
      [   24.342391]        worker_thread+0x1e4/0x26c
      [   24.346788]        kthread+0xe4/0xf4
      [   24.350470]        ret_from_fork+0x10/0x20
      [   24.354683]
      [   24.354683]
      [   24.354683] -> #2 (crtc_ww_class_acquire){+.+.}-{0:0}:
      [   24.361489]        drm_modeset_acquire_init+0xe4/0x138
      [   24.366777]        drm_helper_probe_detect_ctx+0x44/0x114
      [   24.372327]        check_connector_changed+0xbc/0x198
      [   24.377517]        drm_helper_hpd_irq_event+0xcc/0x11c
      [   24.382804]        dsi_hpd_worker+0x24/0x30
      [   24.387104]        process_one_work+0x2f0/0x498
      [   24.391762]        worker_thread+0x1d0/0x26c
      [   24.396158]        kthread+0xe4/0xf4
      [   24.399840]        ret_from_fork+0x10/0x20
      [   24.404053]
      [   24.404053] -> #1 (&dev->mode_config.mutex){+.+.}-{3:3}:
      [   24.411032]        __mutex_lock+0xc8/0x384
      [   24.415247]        mutex_lock_nested+0x54/0x74
      [   24.419819]        dp_panel_read_sink_caps+0x23c/0x26c
      [   24.425108]        dp_display_process_hpd_high+0x34/0xd4
      [   24.430570]        dp_display_usbpd_configure_cb+0x30/0x3c
      [   24.436205]        hpd_event_thread+0x2ac/0x550
      [   24.440864]        kthread+0xe4/0xf4
      [   24.444544]        ret_from_fork+0x10/0x20
      [   24.448757]
      [   24.448757] -> #0 (&dp->event_mutex){+.+.}-{3:3}:
      [   24.455116]        __lock_acquire+0xe2c/0x10d8
      [   24.459690]        lock_acquire+0x1ac/0x2d0
      [   24.463988]        __mutex_lock+0xc8/0x384
      [   24.468201]        mutex_lock_nested+0x54/0x74
      [   24.472773]        msm_dp_display_enable+0x58/0x164
      [   24.477789]        dp_bridge_enable+0x24/0x30
      [   24.482273]        drm_atomic_bridge_chain_enable+0x78/0x9c
      [   24.488006]        drm_atomic_helper_commit_modeset_enables+0x1bc/0x244
      [   24.494801]        msm_atomic_commit_tail+0x248/0x3d0
      [   24.499992]        commit_tail+0x7c/0xfc
      [   24.504031]        drm_atomic_helper_commit+0x158/0x15c
      [   24.509404]        drm_atomic_commit+0x60/0x74
      [   24.513976]        drm_mode_atomic_ioctl+0x6b0/0x908
      [   24.519079]        drm_ioctl_kernel+0xe8/0x168
      [   24.523650]        drm_ioctl+0x320/0x370
      [   24.527689]        drm_compat_ioctl+0x40/0xdc
      [   24.532175]        __arm64_compat_sys_ioctl+0xe0/0x150
      [   24.537463]        invoke_syscall+0x80/0x114
      [   24.541861]        el0_svc_common.constprop.3+0xc4/0xf8
      [   24.547235]        do_el0_svc_compat+0x2c/0x54
      [   24.551806]        el0_svc_compat+0x4c/0xe4
      [   24.556106]        el0t_32_sync_handler+0xc4/0xf4
      [   24.560948]        el0t_32_sync+0x174/0x178
      
      Changes in v2:
      -- add circular lockiing trace
      
      Fixes: d4aca422 ("drm/msm/dp:  always add fail-safe mode into connector mode list")
      Signed-off-by: default avatarKuogee Hsieh <quic_khsieh@quicinc.com>
      Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Patchwork: https://patchwork.freedesktop.org/patch/481396/
      Link: https://lore.kernel.org/r/1649451894-554-1-git-send-email-quic_khsieh@quicinc.comSigned-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
      8b2c181e
    • Stephen Boyd's avatar
      drm/msm/dsi: Use connector directly in msm_dsi_manager_connector_init() · 47b7de6b
      Stephen Boyd authored
      The member 'msm_dsi->connector' isn't assigned until
      msm_dsi_manager_connector_init() returns (see msm_dsi_modeset_init() and
      how it assigns the return value). Therefore this pointer is going to be
      NULL here. Let's use 'connector' which is what was intended.
      
      Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Cc: Sean Paul <seanpaul@chromium.org>
      Fixes: 6d5e7840 ("drm/msm/dsi: Move dsi panel init into modeset init path")
      Signed-off-by: default avatarStephen Boyd <swboyd@chromium.org>
      Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Patchwork: https://patchwork.freedesktop.org/patch/478693/
      Link: https://lore.kernel.org/r/20220318000731.2823718-1-swboyd@chromium.orgSigned-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
      47b7de6b
    • Robin Murphy's avatar
      drm/msm: Stop using iommu_present() · e2a88eab
      Robin Murphy authored
      Even if some IOMMU has registered itself on the platform "bus", that
      doesn't necessarily mean it provides translation for the device we
      care about. Replace iommu_present() with a more appropriate check.
      Signed-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Reviewed-by: default avatarRob Clark <robdclark@gmail.com>
      Patchwork: https://patchwork.freedesktop.org/patch/480707/
      Link: https://lore.kernel.org/r/5ab4f4574d7f3e042261da702d493ee40d003356.1649168268.git.robin.murphy@arm.comSigned-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
      e2a88eab
    • Xiaoke Wang's avatar
      drm/msm/mdp5: check the return of kzalloc() · 047ae665
      Xiaoke Wang authored
      kzalloc() is a memory allocation function which can return NULL when
      some internal memory errors happen. So it is better to check it to
      prevent potential wrong memory access.
      
      Besides, since mdp5_plane_reset() is void type, so we should better
      set `plane-state` to NULL after releasing it.
      Signed-off-by: default avatarXiaoke Wang <xkernel.wang@foxmail.com>
      Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Patchwork: https://patchwork.freedesktop.org/patch/481055/
      Link: https://lore.kernel.org/r/tencent_8E2A1C78140EE1784AB2FF4B2088CC0AB908@qq.comSigned-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
      Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
      047ae665
    • Rob Clark's avatar
      drm/msm: Fix range size vs end confusion · 537fef80
      Rob Clark authored
      The fourth param is size, rather than range_end.
      
      Note that we could increase the address space size if we had a way to
      prevent buffers from spanning a 4G split, mostly just to avoid fw bugs
      with 64b math.
      
      Fixes: 84c31ee1 ("drm/msm/a6xx: Add support for per-instance pagetables")
      Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
      Link: https://lore.kernel.org/r/20220407202836.1211268-1-robdclark@gmail.comSigned-off-by: default avatarRob Clark <robdclark@chromium.org>
      537fef80
  4. 06 Apr, 2022 2 commits
  5. 24 Mar, 2022 5 commits
  6. 08 Mar, 2022 2 commits
  7. 07 Mar, 2022 1 commit
  8. 05 Mar, 2022 2 commits
  9. 04 Mar, 2022 4 commits
  10. 03 Mar, 2022 1 commit
  11. 02 Mar, 2022 1 commit
  12. 25 Feb, 2022 5 commits
  13. 23 Feb, 2022 7 commits
  14. 20 Feb, 2022 2 commits
  15. 19 Feb, 2022 1 commit