On 6/25/26 06:02, Pengpeng Hou wrote:
> 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 <[email protected]>
> ---
>  drivers/gpu/drm/virtio/virtgpu_kms.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c 
> b/drivers/gpu/drm/virtio/virtgpu_kms.c
> index cfde9f573df6..31209bea97ae 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_kms.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_kms.c
> @@ -262,11 +262,19 @@ 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_ready;
> +             }
>       }
>       return 0;
>  
> +err_ready:
> +     virtio_reset_device(vgdev->vdev);
> +     virtio_gpu_modeset_fini(vgdev);
>  err_scanouts:
>       virtio_gpu_free_vbufs(vgdev);
>  err_vbufs:

Rebased and applied to misc-next, thanks!

-- 
Best regards,
Dmitry

Reply via email to