drm/virtio: fail init on display-info timeout

virtio_gpu_init() sends GET_DISPLAY_INFO when scanouts are present and
waits for display_info_pending to clear. If the response never arrives,
the wait result is ignored and probe still succeeds.

Return -ETIMEDOUT on display-info timeout. Because this happens after
virtio_device_ready(), reset the device and tear down modesetting before
using the existing vbuf and virtqueue cleanup path.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Link: https://patchwork.freedesktop.org/patch/735301/
[dmitry.osipenko@collabora.com: rebase on misc-next]
This commit is contained in:
Pengpeng Hou 2026-06-25 11:02:02 +08:00 committed by Dmitry Osipenko
parent 127d52f9c6
commit 377939b713

View File

@ -301,18 +301,24 @@ int virtio_gpu_init(struct virtio_device *vdev, struct drm_device *dev)
virtio_gpu_cmd_get_edids(vgdev);
virtio_gpu_cmd_get_display_info(vgdev);
virtio_gpu_notify(vgdev);
wait_event_timeout(vgdev->resp_wq, !vgdev->display_info_pending,
5 * HZ);
if (!wait_event_timeout(vgdev->resp_wq,
!vgdev->display_info_pending,
5 * HZ)) {
DRM_ERROR("timed out waiting for display info\n");
ret = -ETIMEDOUT;
goto err_reset_device;
}
}
vgdev->pm_nb.notifier_call = virtio_gpu_pm_notifier;
ret = register_pm_notifier(&vgdev->pm_nb);
if (ret)
goto err_modeset_fini;
goto err_reset_device;
return 0;
err_modeset_fini:
err_reset_device:
virtio_reset_device(vgdev->vdev);
virtio_gpu_modeset_fini(vgdev);
err_scanouts:
virtio_gpu_free_vbufs(vgdev);