Skip to content

Commit 1e9124d

Browse files
committed
Merge tag 'drm-msm-fixes-2022-06-20' of https://gitlab.freedesktop.org/drm/msm into drm-fixes
Fixes for v5.19-rc4 - Workaround for parade DSI bridge power sequencing - Fix for multi-planar YUV format offsets - Limiting WB modes to max sspp linewidth - Fixing the supported rotations to add 180 back for IGT - Fix to handle pm_runtime_get_sync() errors to avoid unclocked access in the bind() path for dpu driver - Fix the irq_free() without request issue which was a being hit frequently in CI. - Fix to add minimum ICC vote in the msm_mdss pm_resume path to address bootup splats - Fix to avoid dereferencing without checking in WB encoder - Fix to avoid crash during suspend in DP driver by ensuring interrupt mask bits are updated - Remove unused code from dpu_encoder_virt_atomic_check() - Fix to remove redundant init of dsc variable - Fix to ensure mmap offset is initialized to avoid memory corruption from unpin/evict - Fix double runpm disable in probe-defer path - VMA fenced-unpin fixes - Fix for WB max-width - Fix for rare dp resolution change issue Signed-off-by: Dave Airlie <[email protected]> From: Rob Clark <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/CAF6AEGvdsOF1-+WfTWyEyu33XPcvxOCU00G-dz7EF2J+fdyUHg@mail.gmail.com
2 parents 08d27da + a6e2af6 commit 1e9124d

File tree

17 files changed

+106
-69
lines changed

17 files changed

+106
-69
lines changed

drivers/gpu/drm/msm/adreno/adreno_gpu.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -498,10 +498,15 @@ int adreno_hw_init(struct msm_gpu *gpu)
498498

499499
ring->cur = ring->start;
500500
ring->next = ring->start;
501-
502-
/* reset completed fence seqno: */
503-
ring->memptrs->fence = ring->fctx->completed_fence;
504501
ring->memptrs->rptr = 0;
502+
503+
/* Detect and clean up an impossible fence, ie. if GPU managed
504+
* to scribble something invalid, we don't want that to confuse
505+
* us into mistakingly believing that submits have completed.
506+
*/
507+
if (fence_before(ring->fctx->last_fence, ring->memptrs->fence)) {
508+
ring->memptrs->fence = ring->fctx->last_fence;
509+
}
505510
}
506511

507512
return 0;
@@ -1057,7 +1062,8 @@ void adreno_gpu_cleanup(struct adreno_gpu *adreno_gpu)
10571062
for (i = 0; i < ARRAY_SIZE(adreno_gpu->info->fw); i++)
10581063
release_firmware(adreno_gpu->fw[i]);
10591064

1060-
pm_runtime_disable(&priv->gpu_pdev->dev);
1065+
if (pm_runtime_enabled(&priv->gpu_pdev->dev))
1066+
pm_runtime_disable(&priv->gpu_pdev->dev);
10611067

10621068
msm_gpu_cleanup(&adreno_gpu->base);
10631069
}

drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@ static int dpu_wb_conn_get_modes(struct drm_connector *connector)
1111
struct msm_drm_private *priv = dev->dev_private;
1212
struct dpu_kms *dpu_kms = to_dpu_kms(priv->kms);
1313

14-
return drm_add_modes_noedid(connector, dpu_kms->catalog->caps->max_linewidth,
14+
/*
15+
* We should ideally be limiting the modes only to the maxlinewidth but
16+
* on some chipsets this will allow even 4k modes to be added which will
17+
* fail the per SSPP bandwidth checks. So, till we have dual-SSPP support
18+
* and source split support added lets limit the modes based on max_mixer_width
19+
* as 4K modes can then be supported.
20+
*/
21+
return drm_add_modes_noedid(connector, dpu_kms->catalog->caps->max_mixer_width,
1522
dev->mode_config.max_height);
1623
}
1724

drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ static int mdp4_modeset_init_intf(struct mdp4_kms *mdp4_kms,
216216
encoder = mdp4_lcdc_encoder_init(dev, panel_node);
217217
if (IS_ERR(encoder)) {
218218
DRM_DEV_ERROR(dev->dev, "failed to construct LCDC encoder\n");
219+
of_node_put(panel_node);
219220
return PTR_ERR(encoder);
220221
}
221222

@@ -225,6 +226,7 @@ static int mdp4_modeset_init_intf(struct mdp4_kms *mdp4_kms,
225226
connector = mdp4_lvds_connector_init(dev, panel_node, encoder);
226227
if (IS_ERR(connector)) {
227228
DRM_DEV_ERROR(dev->dev, "failed to initialize LVDS connector\n");
229+
of_node_put(panel_node);
228230
return PTR_ERR(connector);
229231
}
230232

drivers/gpu/drm/msm/dp/dp_ctrl.c

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,6 +1534,8 @@ static int dp_ctrl_link_maintenance(struct dp_ctrl_private *ctrl)
15341534
return ret;
15351535
}
15361536

1537+
static int dp_ctrl_on_stream_phy_test_report(struct dp_ctrl *dp_ctrl);
1538+
15371539
static int dp_ctrl_process_phy_test_request(struct dp_ctrl_private *ctrl)
15381540
{
15391541
int ret = 0;
@@ -1557,7 +1559,7 @@ static int dp_ctrl_process_phy_test_request(struct dp_ctrl_private *ctrl)
15571559

15581560
ret = dp_ctrl_on_link(&ctrl->dp_ctrl);
15591561
if (!ret)
1560-
ret = dp_ctrl_on_stream(&ctrl->dp_ctrl);
1562+
ret = dp_ctrl_on_stream_phy_test_report(&ctrl->dp_ctrl);
15611563
else
15621564
DRM_ERROR("failed to enable DP link controller\n");
15631565

@@ -1813,7 +1815,27 @@ static int dp_ctrl_link_retrain(struct dp_ctrl_private *ctrl)
18131815
return dp_ctrl_setup_main_link(ctrl, &training_step);
18141816
}
18151817

1816-
int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl)
1818+
static int dp_ctrl_on_stream_phy_test_report(struct dp_ctrl *dp_ctrl)
1819+
{
1820+
int ret;
1821+
struct dp_ctrl_private *ctrl;
1822+
1823+
ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl);
1824+
1825+
ctrl->dp_ctrl.pixel_rate = ctrl->panel->dp_mode.drm_mode.clock;
1826+
1827+
ret = dp_ctrl_enable_stream_clocks(ctrl);
1828+
if (ret) {
1829+
DRM_ERROR("Failed to start pixel clocks. ret=%d\n", ret);
1830+
return ret;
1831+
}
1832+
1833+
dp_ctrl_send_phy_test_pattern(ctrl);
1834+
1835+
return 0;
1836+
}
1837+
1838+
int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl, bool force_link_train)
18171839
{
18181840
int ret = 0;
18191841
bool mainlink_ready = false;
@@ -1849,12 +1871,7 @@ int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl)
18491871
goto end;
18501872
}
18511873

1852-
if (ctrl->link->sink_request & DP_TEST_LINK_PHY_TEST_PATTERN) {
1853-
dp_ctrl_send_phy_test_pattern(ctrl);
1854-
return 0;
1855-
}
1856-
1857-
if (!dp_ctrl_channel_eq_ok(ctrl))
1874+
if (force_link_train || !dp_ctrl_channel_eq_ok(ctrl))
18581875
dp_ctrl_link_retrain(ctrl);
18591876

18601877
/* stop txing train pattern to end link training */

drivers/gpu/drm/msm/dp/dp_ctrl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct dp_ctrl {
2121
};
2222

2323
int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl);
24-
int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl);
24+
int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl, bool force_link_train);
2525
int dp_ctrl_off_link_stream(struct dp_ctrl *dp_ctrl);
2626
int dp_ctrl_off_link(struct dp_ctrl *dp_ctrl);
2727
int dp_ctrl_off(struct dp_ctrl *dp_ctrl);

drivers/gpu/drm/msm/dp/dp_display.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,8 @@ static void dp_display_unbind(struct device *dev, struct device *master,
309309
struct msm_drm_private *priv = dev_get_drvdata(master);
310310

311311
/* disable all HPD interrupts */
312-
dp_catalog_hpd_config_intr(dp->catalog, DP_DP_HPD_INT_MASK, false);
312+
if (dp->core_initialized)
313+
dp_catalog_hpd_config_intr(dp->catalog, DP_DP_HPD_INT_MASK, false);
313314

314315
kthread_stop(dp->ev_tsk);
315316

@@ -872,7 +873,7 @@ static int dp_display_enable(struct dp_display_private *dp, u32 data)
872873
return 0;
873874
}
874875

875-
rc = dp_ctrl_on_stream(dp->ctrl);
876+
rc = dp_ctrl_on_stream(dp->ctrl, data);
876877
if (!rc)
877878
dp_display->power_on = true;
878879

@@ -1659,6 +1660,7 @@ void dp_bridge_enable(struct drm_bridge *drm_bridge)
16591660
int rc = 0;
16601661
struct dp_display_private *dp_display;
16611662
u32 state;
1663+
bool force_link_train = false;
16621664

16631665
dp_display = container_of(dp, struct dp_display_private, dp_display);
16641666
if (!dp_display->dp_mode.drm_mode.clock) {
@@ -1693,10 +1695,12 @@ void dp_bridge_enable(struct drm_bridge *drm_bridge)
16931695

16941696
state = dp_display->hpd_state;
16951697

1696-
if (state == ST_DISPLAY_OFF)
1698+
if (state == ST_DISPLAY_OFF) {
16971699
dp_display_host_phy_init(dp_display);
1700+
force_link_train = true;
1701+
}
16981702

1699-
dp_display_enable(dp_display, 0);
1703+
dp_display_enable(dp_display, force_link_train);
17001704

17011705
rc = dp_display_post_enable(dp);
17021706
if (rc) {
@@ -1705,10 +1709,6 @@ void dp_bridge_enable(struct drm_bridge *drm_bridge)
17051709
dp_display_unprepare(dp);
17061710
}
17071711

1708-
/* manual kick off plug event to train link */
1709-
if (state == ST_DISPLAY_OFF)
1710-
dp_add_event(dp_display, EV_IRQ_HPD_INT, 0, 0);
1711-
17121712
/* completed connection */
17131713
dp_display->hpd_state = ST_CONNECTED;
17141714

drivers/gpu/drm/msm/msm_drv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ static const struct drm_driver msm_driver = {
964964
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
965965
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
966966
.gem_prime_import_sg_table = msm_gem_prime_import_sg_table,
967-
.gem_prime_mmap = drm_gem_prime_mmap,
967+
.gem_prime_mmap = msm_gem_prime_mmap,
968968
#ifdef CONFIG_DEBUG_FS
969969
.debugfs_init = msm_debugfs_init,
970970
#endif

drivers/gpu/drm/msm/msm_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ unsigned long msm_gem_shrinker_shrink(struct drm_device *dev, unsigned long nr_t
246246
void msm_gem_shrinker_init(struct drm_device *dev);
247247
void msm_gem_shrinker_cleanup(struct drm_device *dev);
248248

249+
int msm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma);
249250
struct sg_table *msm_gem_prime_get_sg_table(struct drm_gem_object *obj);
250251
int msm_gem_prime_vmap(struct drm_gem_object *obj, struct iosys_map *map);
251252
void msm_gem_prime_vunmap(struct drm_gem_object *obj, struct iosys_map *map);

drivers/gpu/drm/msm/msm_fence.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ bool msm_fence_completed(struct msm_fence_context *fctx, uint32_t fence)
4646
(int32_t)(*fctx->fenceptr - fence) >= 0;
4747
}
4848

49-
/* called from workqueue */
49+
/* called from irq handler and workqueue (in recover path) */
5050
void msm_update_fence(struct msm_fence_context *fctx, uint32_t fence)
5151
{
52-
spin_lock(&fctx->spinlock);
52+
unsigned long flags;
53+
54+
spin_lock_irqsave(&fctx->spinlock, flags);
5355
fctx->completed_fence = max(fence, fctx->completed_fence);
54-
spin_unlock(&fctx->spinlock);
56+
spin_unlock_irqrestore(&fctx->spinlock, flags);
5557
}
5658

5759
struct msm_fence {

drivers/gpu/drm/msm/msm_gem.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,14 +439,12 @@ int msm_gem_pin_vma_locked(struct drm_gem_object *obj, struct msm_gem_vma *vma)
439439
return ret;
440440
}
441441

442-
void msm_gem_unpin_vma_locked(struct drm_gem_object *obj, struct msm_gem_vma *vma)
442+
void msm_gem_unpin_locked(struct drm_gem_object *obj)
443443
{
444444
struct msm_gem_object *msm_obj = to_msm_bo(obj);
445445

446446
GEM_WARN_ON(!msm_gem_is_locked(obj));
447447

448-
msm_gem_unpin_vma(vma);
449-
450448
msm_obj->pin_count--;
451449
GEM_WARN_ON(msm_obj->pin_count < 0);
452450

@@ -586,7 +584,8 @@ void msm_gem_unpin_iova(struct drm_gem_object *obj,
586584
msm_gem_lock(obj);
587585
vma = lookup_vma(obj, aspace);
588586
if (!GEM_WARN_ON(!vma)) {
589-
msm_gem_unpin_vma_locked(obj, vma);
587+
msm_gem_unpin_vma(vma);
588+
msm_gem_unpin_locked(obj);
590589
}
591590
msm_gem_unlock(obj);
592591
}

0 commit comments

Comments
 (0)