Skip to content

Commit e92e11b

Browse files
committed
Merge tag 'drm-misc-fixes-2025-02-06' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-fixes
A couple of fixes for ivpu to error handling, komeda for format handling, AST DP timeout fix when enabling the output, locking fix for zynqmp DP support, tiled format handling in drm/client, and refcounting fix for bochs Signed-off-by: Dave Airlie <airlied@redhat.com> From: Maxime Ripard <mripard@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250206-encouraging-judicious-quoll-adc1dc@houat
2 parents f2e6f00 + 2c1ed90 commit e92e11b

File tree

7 files changed

+67
-51
lines changed

7 files changed

+67
-51
lines changed

drivers/accel/amdxdna/amdxdna_pci_drv.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121

2222
#define AMDXDNA_AUTOSUSPEND_DELAY 5000 /* milliseconds */
2323

24+
MODULE_FIRMWARE("amdnpu/1502_00/npu.sbin");
25+
MODULE_FIRMWARE("amdnpu/17f0_10/npu.sbin");
26+
MODULE_FIRMWARE("amdnpu/17f0_11/npu.sbin");
27+
MODULE_FIRMWARE("amdnpu/17f0_20/npu.sbin");
28+
2429
/*
2530
* Bind the driver base on (vendor_id, device_id) pair and later use the
2631
* (device_id, rev_id) pair as a key to select the devices. The devices with

drivers/accel/ivpu/ivpu_drv.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,15 +397,19 @@ int ivpu_boot(struct ivpu_device *vdev)
397397
if (ivpu_fw_is_cold_boot(vdev)) {
398398
ret = ivpu_pm_dct_init(vdev);
399399
if (ret)
400-
goto err_diagnose_failure;
400+
goto err_disable_ipc;
401401

402402
ret = ivpu_hw_sched_init(vdev);
403403
if (ret)
404-
goto err_diagnose_failure;
404+
goto err_disable_ipc;
405405
}
406406

407407
return 0;
408408

409+
err_disable_ipc:
410+
ivpu_ipc_disable(vdev);
411+
ivpu_hw_irq_disable(vdev);
412+
disable_irq(vdev->irq);
409413
err_diagnose_failure:
410414
ivpu_hw_diagnose_failure(vdev);
411415
ivpu_mmu_evtq_dump(vdev);

drivers/accel/ivpu/ivpu_pm.c

Lines changed: 47 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -115,41 +115,57 @@ static int ivpu_resume(struct ivpu_device *vdev)
115115
return ret;
116116
}
117117

118-
static void ivpu_pm_recovery_work(struct work_struct *work)
118+
static void ivpu_pm_reset_begin(struct ivpu_device *vdev)
119119
{
120-
struct ivpu_pm_info *pm = container_of(work, struct ivpu_pm_info, recovery_work);
121-
struct ivpu_device *vdev = pm->vdev;
122-
char *evt[2] = {"IVPU_PM_EVENT=IVPU_RECOVER", NULL};
123-
int ret;
124-
125-
ivpu_err(vdev, "Recovering the NPU (reset #%d)\n", atomic_read(&vdev->pm->reset_counter));
126-
127-
ret = pm_runtime_resume_and_get(vdev->drm.dev);
128-
if (ret)
129-
ivpu_err(vdev, "Failed to resume NPU: %d\n", ret);
130-
131-
ivpu_jsm_state_dump(vdev);
132-
ivpu_dev_coredump(vdev);
120+
pm_runtime_disable(vdev->drm.dev);
133121

134122
atomic_inc(&vdev->pm->reset_counter);
135123
atomic_set(&vdev->pm->reset_pending, 1);
136124
down_write(&vdev->pm->reset_lock);
125+
}
126+
127+
static void ivpu_pm_reset_complete(struct ivpu_device *vdev)
128+
{
129+
int ret;
137130

138-
ivpu_suspend(vdev);
139131
ivpu_pm_prepare_cold_boot(vdev);
140132
ivpu_jobs_abort_all(vdev);
141133
ivpu_ms_cleanup_all(vdev);
142134

143135
ret = ivpu_resume(vdev);
144-
if (ret)
136+
if (ret) {
145137
ivpu_err(vdev, "Failed to resume NPU: %d\n", ret);
138+
pm_runtime_set_suspended(vdev->drm.dev);
139+
} else {
140+
pm_runtime_set_active(vdev->drm.dev);
141+
}
146142

147143
up_write(&vdev->pm->reset_lock);
148144
atomic_set(&vdev->pm->reset_pending, 0);
149145

150-
kobject_uevent_env(&vdev->drm.dev->kobj, KOBJ_CHANGE, evt);
151146
pm_runtime_mark_last_busy(vdev->drm.dev);
152-
pm_runtime_put_autosuspend(vdev->drm.dev);
147+
pm_runtime_enable(vdev->drm.dev);
148+
}
149+
150+
static void ivpu_pm_recovery_work(struct work_struct *work)
151+
{
152+
struct ivpu_pm_info *pm = container_of(work, struct ivpu_pm_info, recovery_work);
153+
struct ivpu_device *vdev = pm->vdev;
154+
char *evt[2] = {"IVPU_PM_EVENT=IVPU_RECOVER", NULL};
155+
156+
ivpu_err(vdev, "Recovering the NPU (reset #%d)\n", atomic_read(&vdev->pm->reset_counter));
157+
158+
ivpu_pm_reset_begin(vdev);
159+
160+
if (!pm_runtime_status_suspended(vdev->drm.dev)) {
161+
ivpu_jsm_state_dump(vdev);
162+
ivpu_dev_coredump(vdev);
163+
ivpu_suspend(vdev);
164+
}
165+
166+
ivpu_pm_reset_complete(vdev);
167+
168+
kobject_uevent_env(&vdev->drm.dev->kobj, KOBJ_CHANGE, evt);
153169
}
154170

155171
void ivpu_pm_trigger_recovery(struct ivpu_device *vdev, const char *reason)
@@ -309,7 +325,10 @@ int ivpu_rpm_get(struct ivpu_device *vdev)
309325
int ret;
310326

311327
ret = pm_runtime_resume_and_get(vdev->drm.dev);
312-
drm_WARN_ON(&vdev->drm, ret < 0);
328+
if (ret < 0) {
329+
ivpu_err(vdev, "Failed to resume NPU: %d\n", ret);
330+
pm_runtime_set_suspended(vdev->drm.dev);
331+
}
313332

314333
return ret;
315334
}
@@ -325,35 +344,26 @@ void ivpu_pm_reset_prepare_cb(struct pci_dev *pdev)
325344
struct ivpu_device *vdev = pci_get_drvdata(pdev);
326345

327346
ivpu_dbg(vdev, PM, "Pre-reset..\n");
328-
atomic_inc(&vdev->pm->reset_counter);
329-
atomic_set(&vdev->pm->reset_pending, 1);
330347

331-
pm_runtime_get_sync(vdev->drm.dev);
332-
down_write(&vdev->pm->reset_lock);
333-
ivpu_prepare_for_reset(vdev);
334-
ivpu_hw_reset(vdev);
335-
ivpu_pm_prepare_cold_boot(vdev);
336-
ivpu_jobs_abort_all(vdev);
337-
ivpu_ms_cleanup_all(vdev);
348+
ivpu_pm_reset_begin(vdev);
349+
350+
if (!pm_runtime_status_suspended(vdev->drm.dev)) {
351+
ivpu_prepare_for_reset(vdev);
352+
ivpu_hw_reset(vdev);
353+
}
338354

339355
ivpu_dbg(vdev, PM, "Pre-reset done.\n");
340356
}
341357

342358
void ivpu_pm_reset_done_cb(struct pci_dev *pdev)
343359
{
344360
struct ivpu_device *vdev = pci_get_drvdata(pdev);
345-
int ret;
346361

347362
ivpu_dbg(vdev, PM, "Post-reset..\n");
348-
ret = ivpu_resume(vdev);
349-
if (ret)
350-
ivpu_err(vdev, "Failed to set RESUME state: %d\n", ret);
351-
up_write(&vdev->pm->reset_lock);
352-
atomic_set(&vdev->pm->reset_pending, 0);
353-
ivpu_dbg(vdev, PM, "Post-reset done.\n");
354363

355-
pm_runtime_mark_last_busy(vdev->drm.dev);
356-
pm_runtime_put_autosuspend(vdev->drm.dev);
364+
ivpu_pm_reset_complete(vdev);
365+
366+
ivpu_dbg(vdev, PM, "Post-reset done.\n");
357367
}
358368

359369
void ivpu_pm_init(struct ivpu_device *vdev)

drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms,
160160
formats = komeda_get_layer_fourcc_list(&mdev->fmt_tbl,
161161
kwb_conn->wb_layer->layer_type,
162162
&n_formats);
163+
if (!formats) {
164+
kfree(kwb_conn);
165+
return -ENOMEM;
166+
}
163167

164168
err = drm_writeback_connector_init(&kms->base, wb_conn,
165169
&komeda_wb_connector_funcs,

drivers/gpu/drm/ast/ast_dp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ static bool __ast_dp_wait_enable(struct ast_device *ast, bool enabled)
195195
if (enabled)
196196
vgacrdf_test |= AST_IO_VGACRDF_DP_VIDEO_ENABLE;
197197

198-
for (i = 0; i < 200; ++i) {
198+
for (i = 0; i < 1000; ++i) {
199199
if (i)
200200
mdelay(1);
201201
vgacrdf = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xdf,

drivers/gpu/drm/display/drm_dp_cec.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -311,16 +311,6 @@ void drm_dp_cec_attach(struct drm_dp_aux *aux, u16 source_physical_address)
311311
if (!aux->transfer)
312312
return;
313313

314-
#ifndef CONFIG_MEDIA_CEC_RC
315-
/*
316-
* CEC_CAP_RC is part of CEC_CAP_DEFAULTS, but it is stripped by
317-
* cec_allocate_adapter() if CONFIG_MEDIA_CEC_RC is undefined.
318-
*
319-
* Do this here as well to ensure the tests against cec_caps are
320-
* correct.
321-
*/
322-
cec_caps &= ~CEC_CAP_RC;
323-
#endif
324314
cancel_delayed_work_sync(&aux->cec.unregister_work);
325315

326316
mutex_lock(&aux->cec.lock);
@@ -337,7 +327,9 @@ void drm_dp_cec_attach(struct drm_dp_aux *aux, u16 source_physical_address)
337327
num_las = CEC_MAX_LOG_ADDRS;
338328

339329
if (aux->cec.adap) {
340-
if (aux->cec.adap->capabilities == cec_caps &&
330+
/* Check if the adapter properties have changed */
331+
if ((aux->cec.adap->capabilities & CEC_CAP_MONITOR_ALL) ==
332+
(cec_caps & CEC_CAP_MONITOR_ALL) &&
341333
aux->cec.adap->available_log_addrs == num_las) {
342334
/* Unchanged, so just set the phys addr */
343335
cec_s_phys_addr(aux->cec.adap, source_physical_address, false);

include/drm/drm_print.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <linux/dynamic_debug.h>
3333

3434
#include <drm/drm.h>
35+
#include <drm/drm_device.h>
3536

3637
struct debugfs_regset32;
3738
struct drm_device;

0 commit comments

Comments
 (0)