Skip to content

Commit 98a71d1

Browse files
committed
Merge tag 'drm-msm-fixes-2022-04-13' of https://gitlab.freedesktop.org/drm/msm into drm-fixes
Some msm fixes for v5.18. kzalloc return checks, display fix, misc locking and scheduler bug, iommu present removal. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Rob Clark <robdclark@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/CAF6AEGvuTwx09MKwK68KWXqi4o7LxDGMUz1=Z7xOS+i=OV84Ug@mail.gmail.com
2 parents 16e0400 + 390d645 commit 98a71d1

12 files changed

Lines changed: 109 additions & 48 deletions

File tree

Documentation/devicetree/bindings/display/msm/dpu-qcm2290.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ examples:
160160
mdss: mdss@5e00000 {
161161
#address-cells = <1>;
162162
#size-cells = <1>;
163-
compatible = "qcom,qcm2290-mdss", "qcom,mdss";
163+
compatible = "qcom,qcm2290-mdss";
164164
reg = <0x05e00000 0x1000>;
165165
reg-names = "mdss";
166166
power-domains = <&dispcc MDSS_GDSC>;
@@ -180,7 +180,7 @@ examples:
180180
<&apps_smmu 0x421 0x0>;
181181
ranges;
182182
183-
mdss_mdp: mdp@5e01000 {
183+
mdss_mdp: display-controller@5e01000 {
184184
compatible = "qcom,qcm2290-dpu";
185185
reg = <0x05e01000 0x8f000>,
186186
<0x05eb0000 0x2008>;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1742,7 +1742,7 @@ a6xx_create_private_address_space(struct msm_gpu *gpu)
17421742
return ERR_CAST(mmu);
17431743

17441744
return msm_gem_address_space_create(mmu,
1745-
"gpu", 0x100000000ULL, 0x1ffffffffULL);
1745+
"gpu", 0x100000000ULL, SZ_4G);
17461746
}
17471747

17481748
static uint32_t a6xx_get_rptr(struct msm_gpu *gpu, struct msm_ringbuffer *ring)

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

Lines changed: 64 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -599,43 +599,91 @@ static const struct of_device_id dt_match[] = {
599599
{}
600600
};
601601

602-
#ifdef CONFIG_PM
603-
static int adreno_resume(struct device *dev)
602+
static int adreno_runtime_resume(struct device *dev)
604603
{
605604
struct msm_gpu *gpu = dev_to_gpu(dev);
606605

607606
return gpu->funcs->pm_resume(gpu);
608607
}
609608

610-
static int active_submits(struct msm_gpu *gpu)
609+
static int adreno_runtime_suspend(struct device *dev)
611610
{
612-
int active_submits;
613-
mutex_lock(&gpu->active_lock);
614-
active_submits = gpu->active_submits;
615-
mutex_unlock(&gpu->active_lock);
616-
return active_submits;
611+
struct msm_gpu *gpu = dev_to_gpu(dev);
612+
613+
/*
614+
* We should be holding a runpm ref, which will prevent
615+
* runtime suspend. In the system suspend path, we've
616+
* already waited for active jobs to complete.
617+
*/
618+
WARN_ON_ONCE(gpu->active_submits);
619+
620+
return gpu->funcs->pm_suspend(gpu);
621+
}
622+
623+
static void suspend_scheduler(struct msm_gpu *gpu)
624+
{
625+
int i;
626+
627+
/*
628+
* Shut down the scheduler before we force suspend, so that
629+
* suspend isn't racing with scheduler kthread feeding us
630+
* more work.
631+
*
632+
* Note, we just want to park the thread, and let any jobs
633+
* that are already on the hw queue complete normally, as
634+
* opposed to the drm_sched_stop() path used for handling
635+
* faulting/timed-out jobs. We can't really cancel any jobs
636+
* already on the hw queue without racing with the GPU.
637+
*/
638+
for (i = 0; i < gpu->nr_rings; i++) {
639+
struct drm_gpu_scheduler *sched = &gpu->rb[i]->sched;
640+
kthread_park(sched->thread);
641+
}
617642
}
618643

619-
static int adreno_suspend(struct device *dev)
644+
static void resume_scheduler(struct msm_gpu *gpu)
645+
{
646+
int i;
647+
648+
for (i = 0; i < gpu->nr_rings; i++) {
649+
struct drm_gpu_scheduler *sched = &gpu->rb[i]->sched;
650+
kthread_unpark(sched->thread);
651+
}
652+
}
653+
654+
static int adreno_system_suspend(struct device *dev)
620655
{
621656
struct msm_gpu *gpu = dev_to_gpu(dev);
622-
int remaining;
657+
int remaining, ret;
658+
659+
suspend_scheduler(gpu);
623660

624661
remaining = wait_event_timeout(gpu->retire_event,
625-
active_submits(gpu) == 0,
662+
gpu->active_submits == 0,
626663
msecs_to_jiffies(1000));
627664
if (remaining == 0) {
628665
dev_err(dev, "Timeout waiting for GPU to suspend\n");
629-
return -EBUSY;
666+
ret = -EBUSY;
667+
goto out;
630668
}
631669

632-
return gpu->funcs->pm_suspend(gpu);
670+
ret = pm_runtime_force_suspend(dev);
671+
out:
672+
if (ret)
673+
resume_scheduler(gpu);
674+
675+
return ret;
676+
}
677+
678+
static int adreno_system_resume(struct device *dev)
679+
{
680+
resume_scheduler(dev_to_gpu(dev));
681+
return pm_runtime_force_resume(dev);
633682
}
634-
#endif
635683

636684
static const struct dev_pm_ops adreno_pm_ops = {
637-
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
638-
SET_RUNTIME_PM_OPS(adreno_suspend, adreno_resume, NULL)
685+
SYSTEM_SLEEP_PM_OPS(adreno_system_suspend, adreno_system_resume)
686+
RUNTIME_PM_OPS(adreno_runtime_suspend, adreno_runtime_resume, NULL)
639687
};
640688

641689
static struct platform_driver adreno_driver = {

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -54,87 +54,87 @@ struct dpu_intr_reg {
5454
* When making changes be sure to sync with dpu_hw_intr_reg
5555
*/
5656
static const struct dpu_intr_reg dpu_intr_set[] = {
57-
{
57+
[MDP_SSPP_TOP0_INTR] = {
5858
MDP_SSPP_TOP0_OFF+INTR_CLEAR,
5959
MDP_SSPP_TOP0_OFF+INTR_EN,
6060
MDP_SSPP_TOP0_OFF+INTR_STATUS
6161
},
62-
{
62+
[MDP_SSPP_TOP0_INTR2] = {
6363
MDP_SSPP_TOP0_OFF+INTR2_CLEAR,
6464
MDP_SSPP_TOP0_OFF+INTR2_EN,
6565
MDP_SSPP_TOP0_OFF+INTR2_STATUS
6666
},
67-
{
67+
[MDP_SSPP_TOP0_HIST_INTR] = {
6868
MDP_SSPP_TOP0_OFF+HIST_INTR_CLEAR,
6969
MDP_SSPP_TOP0_OFF+HIST_INTR_EN,
7070
MDP_SSPP_TOP0_OFF+HIST_INTR_STATUS
7171
},
72-
{
72+
[MDP_INTF0_INTR] = {
7373
MDP_INTF_0_OFF+INTF_INTR_CLEAR,
7474
MDP_INTF_0_OFF+INTF_INTR_EN,
7575
MDP_INTF_0_OFF+INTF_INTR_STATUS
7676
},
77-
{
77+
[MDP_INTF1_INTR] = {
7878
MDP_INTF_1_OFF+INTF_INTR_CLEAR,
7979
MDP_INTF_1_OFF+INTF_INTR_EN,
8080
MDP_INTF_1_OFF+INTF_INTR_STATUS
8181
},
82-
{
82+
[MDP_INTF2_INTR] = {
8383
MDP_INTF_2_OFF+INTF_INTR_CLEAR,
8484
MDP_INTF_2_OFF+INTF_INTR_EN,
8585
MDP_INTF_2_OFF+INTF_INTR_STATUS
8686
},
87-
{
87+
[MDP_INTF3_INTR] = {
8888
MDP_INTF_3_OFF+INTF_INTR_CLEAR,
8989
MDP_INTF_3_OFF+INTF_INTR_EN,
9090
MDP_INTF_3_OFF+INTF_INTR_STATUS
9191
},
92-
{
92+
[MDP_INTF4_INTR] = {
9393
MDP_INTF_4_OFF+INTF_INTR_CLEAR,
9494
MDP_INTF_4_OFF+INTF_INTR_EN,
9595
MDP_INTF_4_OFF+INTF_INTR_STATUS
9696
},
97-
{
97+
[MDP_INTF5_INTR] = {
9898
MDP_INTF_5_OFF+INTF_INTR_CLEAR,
9999
MDP_INTF_5_OFF+INTF_INTR_EN,
100100
MDP_INTF_5_OFF+INTF_INTR_STATUS
101101
},
102-
{
102+
[MDP_AD4_0_INTR] = {
103103
MDP_AD4_0_OFF + MDP_AD4_INTR_CLEAR_OFF,
104104
MDP_AD4_0_OFF + MDP_AD4_INTR_EN_OFF,
105105
MDP_AD4_0_OFF + MDP_AD4_INTR_STATUS_OFF,
106106
},
107-
{
107+
[MDP_AD4_1_INTR] = {
108108
MDP_AD4_1_OFF + MDP_AD4_INTR_CLEAR_OFF,
109109
MDP_AD4_1_OFF + MDP_AD4_INTR_EN_OFF,
110110
MDP_AD4_1_OFF + MDP_AD4_INTR_STATUS_OFF,
111111
},
112-
{
112+
[MDP_INTF0_7xxx_INTR] = {
113113
MDP_INTF_0_OFF_REV_7xxx+INTF_INTR_CLEAR,
114114
MDP_INTF_0_OFF_REV_7xxx+INTF_INTR_EN,
115115
MDP_INTF_0_OFF_REV_7xxx+INTF_INTR_STATUS
116116
},
117-
{
117+
[MDP_INTF1_7xxx_INTR] = {
118118
MDP_INTF_1_OFF_REV_7xxx+INTF_INTR_CLEAR,
119119
MDP_INTF_1_OFF_REV_7xxx+INTF_INTR_EN,
120120
MDP_INTF_1_OFF_REV_7xxx+INTF_INTR_STATUS
121121
},
122-
{
122+
[MDP_INTF2_7xxx_INTR] = {
123123
MDP_INTF_2_OFF_REV_7xxx+INTF_INTR_CLEAR,
124124
MDP_INTF_2_OFF_REV_7xxx+INTF_INTR_EN,
125125
MDP_INTF_2_OFF_REV_7xxx+INTF_INTR_STATUS
126126
},
127-
{
127+
[MDP_INTF3_7xxx_INTR] = {
128128
MDP_INTF_3_OFF_REV_7xxx+INTF_INTR_CLEAR,
129129
MDP_INTF_3_OFF_REV_7xxx+INTF_INTR_EN,
130130
MDP_INTF_3_OFF_REV_7xxx+INTF_INTR_STATUS
131131
},
132-
{
132+
[MDP_INTF4_7xxx_INTR] = {
133133
MDP_INTF_4_OFF_REV_7xxx+INTF_INTR_CLEAR,
134134
MDP_INTF_4_OFF_REV_7xxx+INTF_INTR_EN,
135135
MDP_INTF_4_OFF_REV_7xxx+INTF_INTR_STATUS
136136
},
137-
{
137+
[MDP_INTF5_7xxx_INTR] = {
138138
MDP_INTF_5_OFF_REV_7xxx+INTF_INTR_CLEAR,
139139
MDP_INTF_5_OFF_REV_7xxx+INTF_INTR_EN,
140140
MDP_INTF_5_OFF_REV_7xxx+INTF_INTR_STATUS

drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ static void mdp5_plane_reset(struct drm_plane *plane)
9898
__drm_atomic_helper_plane_destroy_state(plane->state);
9999

100100
kfree(to_mdp5_plane_state(plane->state));
101+
plane->state = NULL;
101102
mdp5_state = kzalloc(sizeof(*mdp5_state), GFP_KERNEL);
103+
if (!mdp5_state)
104+
return;
102105
__drm_atomic_helper_plane_reset(plane, &mdp5_state->base);
103106
}
104107

drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ void msm_disp_snapshot_add_block(struct msm_disp_state *disp_state, u32 len,
176176
va_list va;
177177

178178
new_blk = kzalloc(sizeof(struct msm_disp_state_block), GFP_KERNEL);
179+
if (!new_blk)
180+
return;
179181

180182
va_start(va, fmt);
181183

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,12 @@ static int dp_hpd_plug_handle(struct dp_display_private *dp, u32 data)
580580
dp->dp_display.connector_type, state);
581581
mutex_unlock(&dp->event_mutex);
582582

583+
/*
584+
* add fail safe mode outside event_mutex scope
585+
* to avoid potiential circular lock with drm thread
586+
*/
587+
dp_panel_add_fail_safe_mode(dp->dp_display.connector);
588+
583589
/* uevent will complete connection part */
584590
return 0;
585591
};

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,15 @@ static int dp_panel_update_modes(struct drm_connector *connector,
151151
return rc;
152152
}
153153

154+
void dp_panel_add_fail_safe_mode(struct drm_connector *connector)
155+
{
156+
/* fail safe edid */
157+
mutex_lock(&connector->dev->mode_config.mutex);
158+
if (drm_add_modes_noedid(connector, 640, 480))
159+
drm_set_preferred_mode(connector, 640, 480);
160+
mutex_unlock(&connector->dev->mode_config.mutex);
161+
}
162+
154163
int dp_panel_read_sink_caps(struct dp_panel *dp_panel,
155164
struct drm_connector *connector)
156165
{
@@ -207,16 +216,7 @@ int dp_panel_read_sink_caps(struct dp_panel *dp_panel,
207216
goto end;
208217
}
209218

210-
/* fail safe edid */
211-
mutex_lock(&connector->dev->mode_config.mutex);
212-
if (drm_add_modes_noedid(connector, 640, 480))
213-
drm_set_preferred_mode(connector, 640, 480);
214-
mutex_unlock(&connector->dev->mode_config.mutex);
215-
} else {
216-
/* always add fail-safe mode as backup mode */
217-
mutex_lock(&connector->dev->mode_config.mutex);
218-
drm_add_modes_noedid(connector, 640, 480);
219-
mutex_unlock(&connector->dev->mode_config.mutex);
219+
dp_panel_add_fail_safe_mode(connector);
220220
}
221221

222222
if (panel->aux_cfg_update_done) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ int dp_panel_init_panel_info(struct dp_panel *dp_panel);
5959
int dp_panel_deinit(struct dp_panel *dp_panel);
6060
int dp_panel_timing_cfg(struct dp_panel *dp_panel);
6161
void dp_panel_dump_regs(struct dp_panel *dp_panel);
62+
void dp_panel_add_fail_safe_mode(struct drm_connector *connector);
6263
int dp_panel_read_sink_caps(struct dp_panel *dp_panel,
6364
struct drm_connector *connector);
6465
u32 dp_panel_get_mode_bpp(struct dp_panel *dp_panel, u32 mode_max_bpp,

drivers/gpu/drm/msm/dsi/dsi_manager.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ struct drm_connector *msm_dsi_manager_connector_init(u8 id)
638638
return connector;
639639

640640
fail:
641-
connector->funcs->destroy(msm_dsi->connector);
641+
connector->funcs->destroy(connector);
642642
return ERR_PTR(ret);
643643
}
644644

0 commit comments

Comments
 (0)