Hi On Fri, Sep 23, 2022 at 3:45 PM Antonio Caggiano < antonio.caggi...@collabora.com> wrote:
> Implement an unrealize function for virtio gpu device. > > Signed-off-by: Antonio Caggiano <antonio.caggi...@collabora.com> > --- > hw/display/virtio-gpu.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c > index 20cc703dcc..412f0fb7ec 100644 > --- a/hw/display/virtio-gpu.c > +++ b/hw/display/virtio-gpu.c > @@ -1345,6 +1345,15 @@ void virtio_gpu_device_realize(DeviceState *qdev, > Error **errp) > QTAILQ_INIT(&g->fenceq); > } > > +void virtio_gpu_device_unrealize(DeviceState *qdev) > +{ > + VirtIODevice *vdev = VIRTIO_DEVICE(qdev); > + VirtIOGPU *g = VIRTIO_GPU(qdev); > + > + qemu_bh_delete(g->cursor_bh); > + qemu_bh_delete(g->ctrl_bh); > It also needs to call virtio_gpu_base_device_unrealize() (or save the function in class_init, as shown in https://www.qemu.org/docs/master/devel/qom.html?highlight=parent_do_something#id5 - although I find it cumbersome) Otherwise, lgtm +} > + > void virtio_gpu_reset(VirtIODevice *vdev) > { > VirtIOGPU *g = VIRTIO_GPU(vdev); > @@ -1440,6 +1449,7 @@ static void virtio_gpu_class_init(ObjectClass > *klass, void *data) > vgbc->gl_flushed = virtio_gpu_handle_gl_flushed; > > vdc->realize = virtio_gpu_device_realize; > + vdc->unrealize = virtio_gpu_device_unrealize; > vdc->reset = virtio_gpu_reset; > vdc->get_config = virtio_gpu_get_config; > vdc->set_config = virtio_gpu_set_config; > -- > 2.34.1 > > > -- Marc-André Lureau