[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] hw/qdev-core: Add compatibility for (non)-transitional devs
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH] hw/qdev-core: Add compatibility for (non)-transitional devs |
Date: |
Tue, 19 Oct 2021 11:46:17 +0100 |
On Tue, Oct 12, 2021 at 10:36:01AM +0200, Jean-Louis Dupond wrote:
> Forgot to CC maintainers.
Also CCing Jason Wang and Michael Tsirkin for VIRTIO.
Stefan
>
> On 12/10/2021 10:24, Jean-Louis Dupond wrote:
> > hw_compat modes only take into account their base name.
> > But if a device is created with (non)-transitional, then the compat
> > values are not used, causing migrating issues.
> >
> > This commit adds their (non)-transitional entries with the same settings
> > as the base entry.
> >
> > Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1999141
> >
> > Signed-off-by: Jean-Louis Dupond <jean-louis@dupond.be>
> > ---
> > include/hw/qdev-core.h | 34 ++++++++++++++++++++++++++++++++++
> > 1 file changed, 34 insertions(+)
> >
> > diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
> > index 4ff19c714b..5726825c2d 100644
> > --- a/include/hw/qdev-core.h
> > +++ b/include/hw/qdev-core.h
> > @@ -293,6 +293,30 @@ typedef struct GlobalProperty {
> > bool optional;
> > } GlobalProperty;
> > +
> > +/**
> > + * Helper to add (non)transitional compat properties
> > + */
> > +static inline void
> > +compat_props_add_transitional(GPtrArray *arr, GlobalProperty *prop)
> > +{
> > + GlobalProperty *transitional = g_new0(typeof(*transitional), 1);
> > + transitional->driver = g_strdup_printf("%s-transitional",
> > prop->driver);
> > + transitional->property = g_strdup(prop->property);
> > + transitional->value = g_strdup(prop->value);
> > + transitional->used = prop->used;
> > + transitional->optional = prop->optional;
> > + g_ptr_array_add(arr, (void *)transitional);
> > +
> > + GlobalProperty *non_transitional = g_new0(typeof(*non_transitional),
> > 1);
> > + non_transitional->driver = g_strdup_printf("%s-non-transitional",
> > prop->driver);
> > + non_transitional->property = g_strdup(prop->property);
> > + non_transitional->value = g_strdup(prop->value);
> > + non_transitional->used = prop->used;
> > + non_transitional->optional = prop->optional;
> > + g_ptr_array_add(arr, (void *)non_transitional);
> > +}
> > +
> > static inline void
> > compat_props_add(GPtrArray *arr,
> > GlobalProperty props[], size_t nelem)
> > @@ -300,6 +324,16 @@ compat_props_add(GPtrArray *arr,
> > int i;
> > for (i = 0; i < nelem; i++) {
> > g_ptr_array_add(arr, (void *)&props[i]);
> > + if (g_str_equal(props[i].driver, "vhost-user-blk-pci") ||
> > + g_str_equal(props[i].driver, "virtio-scsi-pci") ||
> > + g_str_equal(props[i].driver, "virtio-blk-pci") ||
> > + g_str_equal(props[i].driver, "virtio-balloon-pci") ||
> > + g_str_equal(props[i].driver, "virtio-serial-pci") ||
> > + g_str_equal(props[i].driver, "virtio-9p-pci") ||
> > + g_str_equal(props[i].driver, "virtio-net-pci") ||
> > + g_str_equal(props[i].driver, "virtio-rng-pci")) {
> > + compat_props_add_transitional(arr, &props[i]);
> > + }
> > }
> > }
>
signature.asc
Description: PGP signature
- [PATCH] hw/qdev-core: Add compatibility for (non)-transitional devs, Jean-Louis Dupond, 2021/10/12
- [PATCH] hw/qdev-core: Add compatibility for (non)-transitional devs, Jean-Louis Dupond, 2021/10/12
- Re: [PATCH] hw/qdev-core: Add compatibility for (non)-transitional devs, Jean-Louis Dupond, 2021/10/12
- Re: [PATCH] hw/qdev-core: Add compatibility for (non)-transitional devs,
Stefan Hajnoczi <=
- Re: [PATCH] hw/qdev-core: Add compatibility for (non)-transitional devs, Michael S. Tsirkin, 2021/10/19
- Re: [PATCH] hw/qdev-core: Add compatibility for (non)-transitional devs, Eduardo Habkost, 2021/10/19
- Re: [PATCH] hw/qdev-core: Add compatibility for (non)-transitional devs, Michael S. Tsirkin, 2021/10/19
- Re: [PATCH] hw/qdev-core: Add compatibility for (non)-transitional devs, Eduardo Habkost, 2021/10/19
- Re: [PATCH] hw/qdev-core: Add compatibility for (non)-transitional devs, Jason Wang, 2021/10/19
- Re: [PATCH] hw/qdev-core: Add compatibility for (non)-transitional devs, Jason Wang, 2021/10/20
- Re: [PATCH] hw/qdev-core: Add compatibility for (non)-transitional devs, Eduardo Habkost, 2021/10/20
- Re: [PATCH] hw/qdev-core: Add compatibility for (non)-transitional devs, Michael S. Tsirkin, 2021/10/20
- Re: [PATCH] hw/qdev-core: Add compatibility for (non)-transitional devs, Eduardo Habkost, 2021/10/20
- Re: [PATCH] hw/qdev-core: Add compatibility for (non)-transitional devs, Jean-Louis Dupond, 2021/10/20