Skip to content

Commit 49a5fdc

Browse files
committed
Merge tag 'drm-msm-fixes-2025-06-16' of https://gitlab.freedesktop.org/drm/msm into drm-fixes
Fixes for v6.16-rc3 Display: - Fixed DP output on SDM845 - Fixed 10nm DSI PLL init GPU: - SUBMIT ioctl error path leak fixes - drm half of stall-on-fault fixes. Note there is a soft dependency, to get correct mmu fault devcoredumps, on arm-smmu changes which are not in this branch, but have already been merged by Linus. So by the time Linus merges this, everything should be peachy. - a7xx: Missing CP_RESET_CONTEXT_STATE - Skip GPU component bind if GPU is not in the device table. Signed-off-by: Dave Airlie <[email protected]> From: Rob Clark <[email protected]> Link: https://lore.kernel.org/r/CACSVV03=OH74ip8O1xqb8RJWGyM4HFuUnWuR=p3zJR+-ko_AJA@mail.gmail.com
2 parents e04c78d + d3deabe commit 49a5fdc

19 files changed

+217
-67
lines changed

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ static int a2xx_gpummu_unmap(struct msm_mmu *mmu, uint64_t iova, size_t len)
7171
return 0;
7272
}
7373

74-
static void a2xx_gpummu_resume_translation(struct msm_mmu *mmu)
75-
{
76-
}
77-
7874
static void a2xx_gpummu_destroy(struct msm_mmu *mmu)
7975
{
8076
struct a2xx_gpummu *gpummu = to_a2xx_gpummu(mmu);
@@ -90,7 +86,6 @@ static const struct msm_mmu_funcs funcs = {
9086
.map = a2xx_gpummu_map,
9187
.unmap = a2xx_gpummu_unmap,
9288
.destroy = a2xx_gpummu_destroy,
93-
.resume_translation = a2xx_gpummu_resume_translation,
9489
};
9590

9691
struct msm_mmu *a2xx_gpummu_new(struct device *dev, struct msm_gpu *gpu)

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ static void a5xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit)
131131
struct msm_ringbuffer *ring = submit->ring;
132132
unsigned int i, ibs = 0;
133133

134+
adreno_check_and_reenable_stall(adreno_gpu);
135+
134136
if (IS_ENABLED(CONFIG_DRM_MSM_GPU_SUDO) && submit->in_rb) {
135137
ring->cur_ctx_seqno = 0;
136138
a5xx_submit_in_rb(gpu, submit);

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,20 @@ static void a6xx_set_pagetable(struct a6xx_gpu *a6xx_gpu,
130130
OUT_RING(ring, lower_32_bits(rbmemptr(ring, fence)));
131131
OUT_RING(ring, upper_32_bits(rbmemptr(ring, fence)));
132132
OUT_RING(ring, submit->seqno - 1);
133+
134+
OUT_PKT7(ring, CP_THREAD_CONTROL, 1);
135+
OUT_RING(ring, CP_SET_THREAD_BOTH);
136+
137+
/* Reset state used to synchronize BR and BV */
138+
OUT_PKT7(ring, CP_RESET_CONTEXT_STATE, 1);
139+
OUT_RING(ring,
140+
CP_RESET_CONTEXT_STATE_0_CLEAR_ON_CHIP_TS |
141+
CP_RESET_CONTEXT_STATE_0_CLEAR_RESOURCE_TABLE |
142+
CP_RESET_CONTEXT_STATE_0_CLEAR_BV_BR_COUNTER |
143+
CP_RESET_CONTEXT_STATE_0_RESET_GLOBAL_LOCAL_TS);
144+
145+
OUT_PKT7(ring, CP_THREAD_CONTROL, 1);
146+
OUT_RING(ring, CP_SET_THREAD_BR);
133147
}
134148

135149
if (!sysprof) {
@@ -212,6 +226,8 @@ static void a6xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit)
212226
struct msm_ringbuffer *ring = submit->ring;
213227
unsigned int i, ibs = 0;
214228

229+
adreno_check_and_reenable_stall(adreno_gpu);
230+
215231
a6xx_set_pagetable(a6xx_gpu, ring, submit);
216232

217233
get_stats_counter(ring, REG_A6XX_RBBM_PERFCTR_CP(0),
@@ -335,6 +351,8 @@ static void a7xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit)
335351
struct msm_ringbuffer *ring = submit->ring;
336352
unsigned int i, ibs = 0;
337353

354+
adreno_check_and_reenable_stall(adreno_gpu);
355+
338356
/*
339357
* Toggle concurrent binning for pagetable switch and set the thread to
340358
* BR since only it can execute the pagetable switch packets.

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

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,8 @@ struct msm_gpu *adreno_load_gpu(struct drm_device *dev)
137137
return NULL;
138138
}
139139

140-
static int find_chipid(struct device *dev, uint32_t *chipid)
140+
static int find_chipid(struct device_node *node, uint32_t *chipid)
141141
{
142-
struct device_node *node = dev->of_node;
143142
const char *compat;
144143
int ret;
145144

@@ -173,15 +172,36 @@ static int find_chipid(struct device *dev, uint32_t *chipid)
173172
/* and if that fails, fall back to legacy "qcom,chipid" property: */
174173
ret = of_property_read_u32(node, "qcom,chipid", chipid);
175174
if (ret) {
176-
DRM_DEV_ERROR(dev, "could not parse qcom,chipid: %d\n", ret);
175+
DRM_ERROR("%pOF: could not parse qcom,chipid: %d\n",
176+
node, ret);
177177
return ret;
178178
}
179179

180-
dev_warn(dev, "Using legacy qcom,chipid binding!\n");
180+
pr_warn("%pOF: Using legacy qcom,chipid binding!\n", node);
181181

182182
return 0;
183183
}
184184

185+
bool adreno_has_gpu(struct device_node *node)
186+
{
187+
const struct adreno_info *info;
188+
uint32_t chip_id;
189+
int ret;
190+
191+
ret = find_chipid(node, &chip_id);
192+
if (ret)
193+
return false;
194+
195+
info = adreno_info(chip_id);
196+
if (!info) {
197+
pr_warn("%pOF: Unknown GPU revision: %"ADRENO_CHIPID_FMT"\n",
198+
node, ADRENO_CHIPID_ARGS(chip_id));
199+
return false;
200+
}
201+
202+
return true;
203+
}
204+
185205
static int adreno_bind(struct device *dev, struct device *master, void *data)
186206
{
187207
static struct adreno_platform_config config = {};
@@ -191,19 +211,18 @@ static int adreno_bind(struct device *dev, struct device *master, void *data)
191211
struct msm_gpu *gpu;
192212
int ret;
193213

194-
ret = find_chipid(dev, &config.chip_id);
195-
if (ret)
214+
ret = find_chipid(dev->of_node, &config.chip_id);
215+
/* We shouldn't have gotten this far if we can't parse the chip_id */
216+
if (WARN_ON(ret))
196217
return ret;
197218

198219
dev->platform_data = &config;
199220
priv->gpu_pdev = to_platform_device(dev);
200221

201222
info = adreno_info(config.chip_id);
202-
if (!info) {
203-
dev_warn(drm->dev, "Unknown GPU revision: %"ADRENO_CHIPID_FMT"\n",
204-
ADRENO_CHIPID_ARGS(config.chip_id));
223+
/* We shouldn't have gotten this far if we don't recognize the GPU: */
224+
if (WARN_ON(!info))
205225
return -ENXIO;
206-
}
207226

208227
config.info = info;
209228

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

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -259,24 +259,54 @@ u64 adreno_private_address_space_size(struct msm_gpu *gpu)
259259
return BIT(ttbr1_cfg->ias) - ADRENO_VM_START;
260260
}
261261

262+
void adreno_check_and_reenable_stall(struct adreno_gpu *adreno_gpu)
263+
{
264+
struct msm_gpu *gpu = &adreno_gpu->base;
265+
struct msm_drm_private *priv = gpu->dev->dev_private;
266+
unsigned long flags;
267+
268+
/*
269+
* Wait until the cooldown period has passed and we would actually
270+
* collect a crashdump to re-enable stall-on-fault.
271+
*/
272+
spin_lock_irqsave(&priv->fault_stall_lock, flags);
273+
if (!priv->stall_enabled &&
274+
ktime_after(ktime_get(), priv->stall_reenable_time) &&
275+
!READ_ONCE(gpu->crashstate)) {
276+
priv->stall_enabled = true;
277+
278+
gpu->aspace->mmu->funcs->set_stall(gpu->aspace->mmu, true);
279+
}
280+
spin_unlock_irqrestore(&priv->fault_stall_lock, flags);
281+
}
282+
262283
#define ARM_SMMU_FSR_TF BIT(1)
263284
#define ARM_SMMU_FSR_PF BIT(3)
264285
#define ARM_SMMU_FSR_EF BIT(4)
286+
#define ARM_SMMU_FSR_SS BIT(30)
265287

266288
int adreno_fault_handler(struct msm_gpu *gpu, unsigned long iova, int flags,
267289
struct adreno_smmu_fault_info *info, const char *block,
268290
u32 scratch[4])
269291
{
292+
struct msm_drm_private *priv = gpu->dev->dev_private;
270293
const char *type = "UNKNOWN";
271-
bool do_devcoredump = info && !READ_ONCE(gpu->crashstate);
294+
bool do_devcoredump = info && (info->fsr & ARM_SMMU_FSR_SS) &&
295+
!READ_ONCE(gpu->crashstate);
296+
unsigned long irq_flags;
272297

273298
/*
274-
* If we aren't going to be resuming later from fault_worker, then do
275-
* it now.
299+
* In case there is a subsequent storm of pagefaults, disable
300+
* stall-on-fault for at least half a second.
276301
*/
277-
if (!do_devcoredump) {
278-
gpu->aspace->mmu->funcs->resume_translation(gpu->aspace->mmu);
302+
spin_lock_irqsave(&priv->fault_stall_lock, irq_flags);
303+
if (priv->stall_enabled) {
304+
priv->stall_enabled = false;
305+
306+
gpu->aspace->mmu->funcs->set_stall(gpu->aspace->mmu, false);
279307
}
308+
priv->stall_reenable_time = ktime_add_ms(ktime_get(), 500);
309+
spin_unlock_irqrestore(&priv->fault_stall_lock, irq_flags);
280310

281311
/*
282312
* Print a default message if we couldn't get the data from the
@@ -304,16 +334,18 @@ int adreno_fault_handler(struct msm_gpu *gpu, unsigned long iova, int flags,
304334
scratch[0], scratch[1], scratch[2], scratch[3]);
305335

306336
if (do_devcoredump) {
337+
struct msm_gpu_fault_info fault_info = {};
338+
307339
/* Turn off the hangcheck timer to keep it from bothering us */
308340
timer_delete(&gpu->hangcheck_timer);
309341

310-
gpu->fault_info.ttbr0 = info->ttbr0;
311-
gpu->fault_info.iova = iova;
312-
gpu->fault_info.flags = flags;
313-
gpu->fault_info.type = type;
314-
gpu->fault_info.block = block;
342+
fault_info.ttbr0 = info->ttbr0;
343+
fault_info.iova = iova;
344+
fault_info.flags = flags;
345+
fault_info.type = type;
346+
fault_info.block = block;
315347

316-
kthread_queue_work(gpu->worker, &gpu->fault_work);
348+
msm_gpu_fault_crashstate_capture(gpu, &fault_info);
317349
}
318350

319351
return 0;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,8 @@ int adreno_fault_handler(struct msm_gpu *gpu, unsigned long iova, int flags,
636636
struct adreno_smmu_fault_info *info, const char *block,
637637
u32 scratch[4]);
638638

639+
void adreno_check_and_reenable_stall(struct adreno_gpu *gpu);
640+
639641
int adreno_read_speedbin(struct device *dev, u32 *speedbin);
640642

641643
/*

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,21 @@ static void drm_mode_to_intf_timing_params(
9494
timing->vsync_polarity = 0;
9595
}
9696

97-
/* for DP/EDP, Shift timings to align it to bottom right */
98-
if (phys_enc->hw_intf->cap->type == INTF_DP) {
97+
timing->wide_bus_en = dpu_encoder_is_widebus_enabled(phys_enc->parent);
98+
timing->compression_en = dpu_encoder_is_dsc_enabled(phys_enc->parent);
99+
100+
/*
101+
* For DP/EDP, Shift timings to align it to bottom right.
102+
* wide_bus_en is set for everything excluding SDM845 &
103+
* porch changes cause DisplayPort failure and HDMI tearing.
104+
*/
105+
if (phys_enc->hw_intf->cap->type == INTF_DP && timing->wide_bus_en) {
99106
timing->h_back_porch += timing->h_front_porch;
100107
timing->h_front_porch = 0;
101108
timing->v_back_porch += timing->v_front_porch;
102109
timing->v_front_porch = 0;
103110
}
104111

105-
timing->wide_bus_en = dpu_encoder_is_widebus_enabled(phys_enc->parent);
106-
timing->compression_en = dpu_encoder_is_dsc_enabled(phys_enc->parent);
107-
108112
/*
109113
* for DP, divide the horizonal parameters by 2 when
110114
* widebus is enabled

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ static const struct msm_dp_desc msm_dp_desc_sa8775p[] = {
128128
{}
129129
};
130130

131+
static const struct msm_dp_desc msm_dp_desc_sdm845[] = {
132+
{ .io_start = 0x0ae90000, .id = MSM_DP_CONTROLLER_0 },
133+
{}
134+
};
135+
131136
static const struct msm_dp_desc msm_dp_desc_sc7180[] = {
132137
{ .io_start = 0x0ae90000, .id = MSM_DP_CONTROLLER_0, .wide_bus_supported = true },
133138
{}
@@ -180,7 +185,7 @@ static const struct of_device_id msm_dp_dt_match[] = {
180185
{ .compatible = "qcom,sc8180x-edp", .data = &msm_dp_desc_sc8180x },
181186
{ .compatible = "qcom,sc8280xp-dp", .data = &msm_dp_desc_sc8280xp },
182187
{ .compatible = "qcom,sc8280xp-edp", .data = &msm_dp_desc_sc8280xp },
183-
{ .compatible = "qcom,sdm845-dp", .data = &msm_dp_desc_sc7180 },
188+
{ .compatible = "qcom,sdm845-dp", .data = &msm_dp_desc_sdm845 },
184189
{ .compatible = "qcom,sm8350-dp", .data = &msm_dp_desc_sc7180 },
185190
{ .compatible = "qcom,sm8650-dp", .data = &msm_dp_desc_sm8650 },
186191
{ .compatible = "qcom,x1e80100-dp", .data = &msm_dp_desc_x1e80100 },

drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,13 @@ static int dsi_pll_10nm_init(struct msm_dsi_phy *phy)
704704
/* TODO: Remove this when we have proper display handover support */
705705
msm_dsi_phy_pll_save_state(phy);
706706

707+
/*
708+
* Store also proper vco_current_rate, because its value will be used in
709+
* dsi_10nm_pll_restore_state().
710+
*/
711+
if (!dsi_pll_10nm_vco_recalc_rate(&pll_10nm->clk_hw, VCO_REF_CLK_RATE))
712+
pll_10nm->vco_current_rate = pll_10nm->phy->cfg->min_pll_rate;
713+
707714
return 0;
708715
}
709716

drivers/gpu/drm/msm/msm_debugfs.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,35 @@ DEFINE_DEBUGFS_ATTRIBUTE(shrink_fops,
208208
shrink_get, shrink_set,
209209
"0x%08llx\n");
210210

211+
/*
212+
* Return the number of microseconds to wait until stall-on-fault is
213+
* re-enabled. If 0 then it is already enabled or will be re-enabled on the
214+
* next submit (unless there's a leftover devcoredump). This is useful for
215+
* kernel tests that intentionally produce a fault and check the devcoredump to
216+
* wait until the cooldown period is over.
217+
*/
218+
219+
static int
220+
stall_reenable_time_get(void *data, u64 *val)
221+
{
222+
struct msm_drm_private *priv = data;
223+
unsigned long irq_flags;
224+
225+
spin_lock_irqsave(&priv->fault_stall_lock, irq_flags);
226+
227+
if (priv->stall_enabled)
228+
*val = 0;
229+
else
230+
*val = max(ktime_us_delta(priv->stall_reenable_time, ktime_get()), 0);
231+
232+
spin_unlock_irqrestore(&priv->fault_stall_lock, irq_flags);
233+
234+
return 0;
235+
}
236+
237+
DEFINE_DEBUGFS_ATTRIBUTE(stall_reenable_time_fops,
238+
stall_reenable_time_get, NULL,
239+
"%lld\n");
211240

212241
static int msm_gem_show(struct seq_file *m, void *arg)
213242
{
@@ -319,6 +348,9 @@ static void msm_debugfs_gpu_init(struct drm_minor *minor)
319348
debugfs_create_bool("disable_err_irq", 0600, minor->debugfs_root,
320349
&priv->disable_err_irq);
321350

351+
debugfs_create_file("stall_reenable_time_us", 0400, minor->debugfs_root,
352+
priv, &stall_reenable_time_fops);
353+
322354
gpu_devfreq = debugfs_create_dir("devfreq", minor->debugfs_root);
323355

324356
debugfs_create_bool("idle_clamp",0600, gpu_devfreq,

0 commit comments

Comments
 (0)