All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	qemu-devel@nongnu.org, anderson@redhat.com,
	"Igor Mammedov" <imammedo@redhat.com>,
	pbonzini@redhat.com, lersek@redhat.com,
	"Richard Henderson" <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH] RFC: vmcoreinfo device
Date: Tue, 25 Apr 2017 23:35:23 +0300	[thread overview]
Message-ID: <20170425233318-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20170425202920.GQ3482@thinpad.lan.raisama.net>

On Tue, Apr 25, 2017 at 05:29:20PM -0300, Eduardo Habkost wrote:
> On Mon, Apr 24, 2017 at 05:03:55PM +0400, Marc-André Lureau wrote:
> [...]
> > diff --git a/include/hw/compat.h b/include/hw/compat.h
> > index 5d5be91daf..d0c9b71902 100644
> > --- a/include/hw/compat.h
> > +++ b/include/hw/compat.h
> > @@ -135,6 +135,10 @@
> >          .driver   = "vmgenid",\
> >          .property = "x-write-pointer-available",\
> >          .value    = "off",\
> > +    },{\
> > +        .driver   = "vmcoreinfo",\
> > +        .property = "x-write-pointer-available",\
> > +        .value    = "off",\
> >      },
> 
> My first reaction to this was "we don't need this compat property, because the
> device didn't even exist in QEMU 2.4".
> 
> But then I read commit f2a1ae45d8ec5ad494e66a9234499a2e0fbf4b40 and now I see
> why this is required: this is a compat property whose sole function is to
> prevent the device from being instantiated.
> 
> Instead of requiring an extra compat property, I suggest just checking if
> fw_cfg has DMA enabled. e.g.:
> 
>  static void vmgenid_realize(DeviceState *dev, Error **errp)
>  {
>      VmGenIdState *vms = VMGENID(dev);
> +    FWCfgState *fw_cfg = FW_CFG(object_resolve_path_type("", TYPE_FW_CFG, NULL));
> 
> -    if (!vms->write_pointer_available) {
> +    if (!fw_cfg || !fw_cfg_dma_enabled(fw_cfg)) {
>          error_setg(errp, "%s requires DMA write support in fw_cfg, "
>                     "which this machine type does not provide", VMGENID_DEVICE);
>          return;
> 
> 
> This has the additional benefit of handling other cases properly, like:
> 
>   $ qemu-system-x86_64 -device vmgenid -machine none
>   qemu-system-x86_64: -device vmgenid: vmgenid requires DMA write support in fw_cfg, which this machine type does not provide
>   $ qemu-system-x86_64 -device vmgenid -machine pc-i440fx-2.9 -global fw_cfg.dma_enabled=off
>   qemu-system-x86_64: -device vmgenid: vmgenid requires DMA write support in fw_cfg, which this machine type does not provide
>   $ qemu-system-x86_64 -device vmgenid -machine pc-i440fx-2.6 -global fw_cfg.dma_enabled=on
>   [boots normally]
>   $

It's quite ugly to make it poke at fw cfg internals though,
it shouldn't know how is write pointer implemented.
We need some kind of API that it can share with vm gen id.

> -- 
> Eduardo

  reply	other threads:[~2017-04-25 20:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-24 13:03 [Qemu-devel] [PATCH] RFC: vmcoreinfo device Marc-André Lureau
2017-04-25 20:29 ` Eduardo Habkost
2017-04-25 20:35   ` Michael S. Tsirkin [this message]
2017-04-25 22:55     ` Eduardo Habkost
2017-06-01 10:16       ` Marc-André Lureau
2017-06-02 17:08         ` Eduardo Habkost
2017-04-28 14:11 ` Ladi Prosek
2017-04-28 14:28   ` Marc-André Lureau
2017-04-28 15:47     ` Ladi Prosek
2017-05-02  7:17     ` Igor Mammedov
2017-05-02 19:03       ` Marc-André Lureau
2017-05-04 13:41         ` Igor Mammedov
2017-05-26 13:59           ` Marc-André Lureau
2017-05-29 12:44             ` Igor Mammedov
2017-06-14 10:46               ` Marc-André Lureau
2017-06-15 10:08                 ` Igor Mammedov

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=20170425233318-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=anderson@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=lersek@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@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 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.