Re: [PATCH v4] drm/virtio: add drm_driver.release callback.

From: Gerd Hoffmann
Date: Wed Feb 12 2020 - 04:35:55 EST


On Tue, Feb 11, 2020 at 03:27:11PM +0100, Daniel Vetter wrote:
> On Tue, Feb 11, 2020 at 02:58:04PM +0100, Gerd Hoffmann wrote:
> > Split virtio_gpu_deinit(), move the drm shutdown and release to
> > virtio_gpu_release(). Drop vqs_ready variable, instead use
> > drm_dev_{enter,exit,unplug} to avoid touching hardware after
> > device removal. Tidy up here and there.
> >
> > v4: add changelog.
> > v3: use drm_dev_*().
> >
> > Signed-off-by: Gerd Hoffmann <kraxel@xxxxxxxxxx>
>
> Looks reasonable I think.
>
> Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
>
> I didn't review whether you need more drm_dev_enter/exit pairs, virtio is
> a bit more complex for that and I have no idea how exactly it works.

virtio uses two rings to send commands to the device, one to move the
cursor and one for everything else. So pretty much everything ends up
calling either this ...

> > @@ -330,7 +330,14 @@ static void virtio_gpu_queue_ctrl_sgs(struct virtio_gpu_device *vgdev,

... or this ...

> > @@ -460,12 +460,13 @@ static void virtio_gpu_queue_cursor(struct virtio_gpu_device *vgdev,

... to submit some request to the (virtual) hardware. Therefore we
don't need many drm_dev_enter/exit pairs to cover everything ;)

cheers,
Gerd