All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jean-Louis Dupond <jean-louis@dupond.be>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH] hw/qdev-core: Add compatibility for (non)-transitional devs
Date: Mon, 1 Nov 2021 18:26:02 -0400	[thread overview]
Message-ID: <20211101182532-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20211012082428.16222-1-jean-louis@dupond.be>

On Tue, Oct 12, 2021 at 10:24:28AM +0200, 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>


Jean-Louis, any chance you are going to address the comments
and post a new patch?


> ---
>  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]);
> +        }
>      }
>  }
>  
> -- 
> 2.33.0
> 
> 
> 



  parent reply	other threads:[~2021-11-01 22:40 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12  8:24 [PATCH] hw/qdev-core: Add compatibility for (non)-transitional devs Jean-Louis Dupond
2021-10-12  8:36 ` Jean-Louis Dupond
2021-10-19 10:46   ` Stefan Hajnoczi
2021-10-19 10:59     ` Michael S. Tsirkin
2021-10-19 15:29       ` Eduardo Habkost
2021-10-19 16:13         ` Michael S. Tsirkin
2021-10-19 16:56           ` Eduardo Habkost
2021-10-20  1:31             ` Jason Wang
2021-10-20  5:02               ` Jason Wang
2021-10-20 14:09                 ` Eduardo Habkost
2021-10-20 14:58                   ` Michael S. Tsirkin
2021-10-20 15:46                     ` Eduardo Habkost
2021-10-20  7:00             ` Jean-Louis Dupond
2021-10-20  7:41             ` Michael S. Tsirkin
2021-10-20 13:57               ` Eduardo Habkost
2021-10-20 14:55                 ` Michael S. Tsirkin
2021-10-20 15:01                   ` Eduardo Habkost
2021-10-20 15:16                     ` Michael S. Tsirkin
2021-10-19 15:27 ` Eduardo Habkost
2021-10-20  6:58   ` Jean-Louis Dupond
2021-11-01 22:26 ` Michael S. Tsirkin [this message]
2021-11-03  7:51   ` Jean-Louis Dupond
2021-11-03  7:58     ` Michael S. Tsirkin
  -- strict thread matches above, loose matches on Subject: below --
2021-10-12  7:49 Jean-Louis Dupond

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211101182532-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=jean-louis@dupond.be \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.