[PATCH-for-8.2? 1/6] hw/virtio: Add VirtioPCIDeviceTypeInfo::instance_finalize field

Philippe Mathieu-Daudé posted 6 patches 1 year ago
Maintainers: Peter Maydell <peter.maydell@linaro.org>, Alistair Francis <alistair@alistair23.me>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, "Michael S. Tsirkin" <mst@redhat.com>, Eric Auger <eric.auger@redhat.com>
[PATCH-for-8.2? 1/6] hw/virtio: Add VirtioPCIDeviceTypeInfo::instance_finalize field
Posted by Philippe Mathieu-Daudé 1 year ago
The VirtioPCIDeviceTypeInfo structure, added in commit a4ee4c8baa
("virtio: Helper for registering virtio device types") got extended
in commit 8ea90ee690 ("virtio: add class_size") with the @class_size
field. Do similarly with the @instance_finalize field.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/virtio/virtio-pci.h | 1 +
 hw/virtio/virtio-pci.c         | 1 +
 2 files changed, 2 insertions(+)

diff --git a/include/hw/virtio/virtio-pci.h b/include/hw/virtio/virtio-pci.h
index 5a3f182f99..59d88018c1 100644
--- a/include/hw/virtio/virtio-pci.h
+++ b/include/hw/virtio/virtio-pci.h
@@ -246,6 +246,7 @@ typedef struct VirtioPCIDeviceTypeInfo {
     size_t instance_size;
     size_t class_size;
     void (*instance_init)(Object *obj);
+    void (*instance_finalize)(Object *obj);
     void (*class_init)(ObjectClass *klass, void *data);
     InterfaceInfo *interfaces;
 } VirtioPCIDeviceTypeInfo;
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 205dbf24fb..e433879542 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -2391,6 +2391,7 @@ void virtio_pci_types_register(const VirtioPCIDeviceTypeInfo *t)
         .parent        = t->parent ? t->parent : TYPE_VIRTIO_PCI,
         .instance_size = t->instance_size,
         .instance_init = t->instance_init,
+        .instance_finalize = t->instance_finalize,
         .class_size    = t->class_size,
         .abstract      = true,
         .interfaces    = t->interfaces,
-- 
2.41.0


Re: [PATCH-for-8.2? 1/6] hw/virtio: Add VirtioPCIDeviceTypeInfo::instance_finalize field
Posted by Michael Tokarev 12 months ago
21.11.2023 20:40, Philippe Mathieu-Daudé:
> The VirtioPCIDeviceTypeInfo structure, added in commit a4ee4c8baa
> ("virtio: Helper for registering virtio device types") got extended
> in commit 8ea90ee690 ("virtio: add class_size") with the @class_size
> field. Do similarly with the @instance_finalize field.

Since other patches in this series are Cc'ed to qemu-stable, and all
uses this new field, it smells like this patch should also be picked
up for -stable (doing that now).

/mjt

> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/hw/virtio/virtio-pci.h | 1 +
>   hw/virtio/virtio-pci.c         | 1 +
>   2 files changed, 2 insertions(+)
> 
> diff --git a/include/hw/virtio/virtio-pci.h b/include/hw/virtio/virtio-pci.h
> index 5a3f182f99..59d88018c1 100644
> --- a/include/hw/virtio/virtio-pci.h
> +++ b/include/hw/virtio/virtio-pci.h
> @@ -246,6 +246,7 @@ typedef struct VirtioPCIDeviceTypeInfo {
>       size_t instance_size;
>       size_t class_size;
>       void (*instance_init)(Object *obj);
> +    void (*instance_finalize)(Object *obj);
>       void (*class_init)(ObjectClass *klass, void *data);
>       InterfaceInfo *interfaces;
>   } VirtioPCIDeviceTypeInfo;
> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> index 205dbf24fb..e433879542 100644
> --- a/hw/virtio/virtio-pci.c
> +++ b/hw/virtio/virtio-pci.c
> @@ -2391,6 +2391,7 @@ void virtio_pci_types_register(const VirtioPCIDeviceTypeInfo *t)
>           .parent        = t->parent ? t->parent : TYPE_VIRTIO_PCI,
>           .instance_size = t->instance_size,
>           .instance_init = t->instance_init,
> +        .instance_finalize = t->instance_finalize,
>           .class_size    = t->class_size,
>           .abstract      = true,
>           .interfaces    = t->interfaces,