Skip to content

Commit b96a225

Browse files
anarsouldakr
authored andcommitted
drm/nouveau: don't attempt to schedule hpd_work on headless cards
If the card doesn't have display hardware, hpd_work and hpd_lock are left uninitialized which causes BUG when attempting to schedule hpd_work on runtime PM resume. Fix it by adding headless flag to DRM and skip any hpd if it's set. Fixes: ae1aadb ("nouveau: don't fail driver load if no display hw present.") Link: https://gitlab.freedesktop.org/drm/nouveau/-/issues/337 Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com> Reviewed-by: Ben Skeggs <bskeggs@nvidia.com> Signed-off-by: Danilo Krummrich <dakr@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240607221032.25918-1-anarsoul@gmail.com
1 parent 31849bf commit b96a225

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

drivers/gpu/drm/nouveau/dispnv04/disp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ nv04_display_fini(struct drm_device *dev, bool runtime, bool suspend)
6868
if (nv_two_heads(dev))
6969
NVWriteCRTC(dev, 1, NV_PCRTC_INTR_EN_0, 0);
7070

71-
if (!runtime)
71+
if (!runtime && !drm->headless)
7272
cancel_work_sync(&drm->hpd_work);
7373

7474
if (!suspend)

drivers/gpu/drm/nouveau/dispnv50/disp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2680,7 +2680,7 @@ nv50_display_fini(struct drm_device *dev, bool runtime, bool suspend)
26802680
nv50_mstm_fini(nouveau_encoder(encoder));
26812681
}
26822682

2683-
if (!runtime)
2683+
if (!runtime && !drm->headless)
26842684
cancel_work_sync(&drm->hpd_work);
26852685
}
26862686

drivers/gpu/drm/nouveau/nouveau_display.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,9 @@ nouveau_display_hpd_resume(struct drm_device *dev)
450450
{
451451
struct nouveau_drm *drm = nouveau_drm(dev);
452452

453+
if (drm->headless)
454+
return;
455+
453456
spin_lock_irq(&drm->hpd_lock);
454457
drm->hpd_pending = ~0;
455458
spin_unlock_irq(&drm->hpd_lock);
@@ -635,7 +638,7 @@ nouveau_display_fini(struct drm_device *dev, bool suspend, bool runtime)
635638
}
636639
drm_connector_list_iter_end(&conn_iter);
637640

638-
if (!runtime)
641+
if (!runtime && !drm->headless)
639642
cancel_work_sync(&drm->hpd_work);
640643

641644
drm_kms_helper_poll_disable(dev);
@@ -729,6 +732,7 @@ nouveau_display_create(struct drm_device *dev)
729732
/* no display hw */
730733
if (ret == -ENODEV) {
731734
ret = 0;
735+
drm->headless = true;
732736
goto disp_create_err;
733737
}
734738

drivers/gpu/drm/nouveau/nouveau_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ struct nouveau_drm {
276276
/* modesetting */
277277
struct nvbios vbios;
278278
struct nouveau_display *display;
279+
bool headless;
279280
struct work_struct hpd_work;
280281
spinlock_t hpd_lock;
281282
u32 hpd_pending;

0 commit comments

Comments
 (0)