qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Alexander Graf" <agraf@suse.de>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Eric Blake" <eblake@redhat.com>,
	qemu-ppc@nongnu.org, "Richard Henderson" <rth@twiddle.net>,
	"Andreas Färber" <afaerber@suse.de>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Hervé Poussineau" <hpoussin@reactos.org>
Subject: Re: [Qemu-devel] [PATCH v2 4/6] Warn on obsolete and deprecated devices.
Date: Tue, 6 Nov 2018 09:36:44 -0500	[thread overview]
Message-ID: <20181106093502-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20181106102335.20027-5-kraxel@redhat.com>

On Tue, Nov 06, 2018 at 11:23:33AM +0100, Gerd Hoffmann wrote:
> Print a warning for deprecated and obsolete devices.
> Also add support state to device listing.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Should we also add a runtime flag to block these?
E.g. I can see libvirt doing that and passing
the responsibility for what is reasonably
supported to qemu.

> ---
>  hw/core/qdev.c | 8 +++++++-
>  qdev-monitor.c | 9 +++++++++
>  2 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 6b3cc55b27..6205522c3e 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -133,11 +133,17 @@ DeviceState *qdev_create(BusState *bus, const char *name)
>  
>  DeviceState *qdev_try_create(BusState *bus, const char *type)
>  {
> +    ObjectClass *oc;
>      DeviceState *dev;
>  
> -    if (object_class_by_name(type) == NULL) {
> +    oc = object_class_by_name(type);
> +    if (oc == NULL) {
>          return NULL;
>      }
> +    if (qemu_is_deprecated(oc) ||
> +        qemu_is_obsolete(oc)) {
> +        qemu_warn_support_state("device", type, oc);
> +    }
>      dev = DEVICE(object_new(type));
>      if (!dev) {
>          return NULL;
> diff --git a/qdev-monitor.c b/qdev-monitor.c
> index 802c18a74e..80370372f9 100644
> --- a/qdev-monitor.c
> +++ b/qdev-monitor.c
> @@ -115,6 +115,8 @@ static void out_printf(const char *fmt, ...)
>  
>  static void qdev_print_devinfo(DeviceClass *dc)
>  {
> +    ObjectClass *oc = OBJECT_CLASS(dc);
> +
>      out_printf("name \"%s\"", object_class_get_name(OBJECT_CLASS(dc)));
>      if (dc->bus_type) {
>          out_printf(", bus %s", dc->bus_type);
> @@ -128,6 +130,9 @@ static void qdev_print_devinfo(DeviceClass *dc)
>      if (!dc->user_creatable) {
>          out_printf(", no-user");
>      }
> +    if (oc->supported.state != SUPPORT_STATE_UNSPECIFIED) {
> +        out_printf(", %s", SupportState_str(oc->supported.state));
> +    }
>      out_printf("\n");
>  }
>  
> @@ -579,6 +584,10 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)
>      if (!dc) {
>          return NULL;
>      }
> +    if (qemu_is_deprecated(OBJECT_CLASS(dc)) ||
> +        qemu_is_obsolete(OBJECT_CLASS(dc))) {
> +        qemu_warn_support_state("device", driver, OBJECT_CLASS(dc));
> +    }
>  
>      /* find bus */
>      path = qemu_opt_get(opts, "bus");
> -- 
> 2.9.3

  reply	other threads:[~2018-11-06 14:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06 10:23 [Qemu-devel] [PATCH v2 0/6] Introducing QemuSupportState Gerd Hoffmann
2018-11-06 10:23 ` [Qemu-devel] [PATCH v2 1/6] move ObjectClass to typedefs.h Gerd Hoffmann
2018-11-06 22:45   ` David Gibson
2018-11-07  9:53   ` Philippe Mathieu-Daudé
2018-11-06 10:23 ` [Qemu-devel] [PATCH v2 2/6] add QemuSupportState Gerd Hoffmann
2018-11-06 14:26   ` Eduardo Habkost
2018-11-06 23:12     ` Paolo Bonzini
2018-11-07  8:15       ` Gerd Hoffmann
2018-11-06 10:23 ` [Qemu-devel] [PATCH v2 3/6] Use QemuSupportState for machine types Gerd Hoffmann
2018-11-29 17:48   ` Markus Armbruster
2018-11-06 10:23 ` [Qemu-devel] [PATCH v2 4/6] Warn on obsolete and deprecated devices Gerd Hoffmann
2018-11-06 14:36   ` Michael S. Tsirkin [this message]
2018-11-07  8:06     ` Gerd Hoffmann
2018-11-29 17:56   ` Markus Armbruster
2018-11-06 10:23 ` [Qemu-devel] [PATCH v2 5/6] tag cirrus as obsolete Gerd Hoffmann
2018-11-06 10:23 ` [Qemu-devel] [PATCH v2 6/6] add UsageHints to QemuSupportState Gerd Hoffmann
2018-11-29 19:10   ` Markus Armbruster
2018-11-29 19:14 ` [Qemu-devel] [PATCH v2 0/6] Introducing QemuSupportState Markus Armbruster

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=20181106093502-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=armbru@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=eblake@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=hpoussin@reactos.org \
    --cc=kraxel@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rth@twiddle.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).