qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: Markus Armbruster <armbru@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH 2/2] virtio-pci: error out when both legacy and modern modes are disabled
Date: Thu, 8 Sep 2016 11:52:15 +0200	[thread overview]
Message-ID: <20160908115215.2ec9e3e3@bahia> (raw)
In-Reply-To: <87a8fiyi9b.fsf@dusky.pond.sub.org>

On Thu, 08 Sep 2016 09:15:28 +0200
Markus Armbruster <armbru@redhat.com> wrote:

> Greg Kurz <groug@kaod.org> writes:
> 
> > From: Greg Kurz <gkurz@linux.vnet.ibm.com>
> >
> > Without presuming if we got there because of a user mistake or some
> > more subtle bug in the tooling, it really does not make sense to
> > implement a non-functional device.
> >
> > Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> > Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
> > Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> > Signed-off-by: Greg Kurz <groug@kaod.org>
> > ---
> >  hw/virtio/virtio-pci.c |    8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> > index 268fd8ebb219..4b6a8a356621 100644
> > --- a/hw/virtio/virtio-pci.c
> > +++ b/hw/virtio/virtio-pci.c
> > @@ -1842,6 +1842,14 @@ static void virtio_pci_dc_realize(DeviceState *qdev, Error **errp)
> >      VirtIOPCIProxy *proxy = VIRTIO_PCI(qdev);
> >      PCIDevice *pci_dev = &proxy->pci_dev;
> >  
> > +    if (!(virtio_pci_modern(proxy) || virtio_pci_legacy(proxy))) {
> > +        error_setg(errp, "device cannot work as neither modern nor legacy mode"
> > +                   " is enabled");
> > +        error_append_hint(errp, "Set either disable-modern or disable-legacy"
> > +                          " to off\n");
> > +        return;
> > +    }
> > +
> >      if (!(proxy->flags & VIRTIO_PCI_FLAG_DISABLE_PCIE) &&
> >          virtio_pci_modern(proxy)) {
> >          pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS;  
> 
> Pardon my ignorance... is this a device-specific restriction, or is it
> the same for more (all?) virtio devices?

Yes this for all virtio devices.

But wait, I now realize that the check isn't done in the right place because
if we don't pass an explicit disable-legacy=on then proxy->disable_legacy gets
its final value in virtio_pci_realize() which gets called after virtio_pci_dc_realize()...

I'll fix that.

Thanks !

--
Greg

      reply	other threads:[~2016-09-08  9:52 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-07 17:19 [Qemu-devel] [PATCH 0/2] virtio: error report fixes in 9P and PCI Greg Kurz
2016-09-07 17:19 ` [Qemu-devel] [PATCH 1/2] virtio-9p: print error message and exit instead of BUG_ON() Greg Kurz
2016-09-08  7:14   ` Markus Armbruster
2016-09-08  9:05     ` Greg Kurz
2016-09-08  8:59   ` Cornelia Huck
2016-09-08  9:12     ` Greg Kurz
2016-09-08 15:00       ` Michael S. Tsirkin
2016-09-08 15:04         ` Cornelia Huck
2016-09-08 15:19           ` Michael S. Tsirkin
2016-09-08 16:26             ` Greg Kurz
2016-09-08 16:55               ` Michael S. Tsirkin
2016-09-09  8:30                 ` Cornelia Huck
2016-09-09  8:46                   ` Greg Kurz
2016-09-09  8:53                     ` Cornelia Huck
2016-09-09  9:26                       ` Greg Kurz
2016-09-09  9:37                         ` Greg Kurz
2016-09-09  6:38               ` Markus Armbruster
2016-09-09  7:30                 ` Greg Kurz
2016-09-09  9:08                   ` Markus Armbruster
2016-09-09  9:54                     ` Greg Kurz
2016-09-07 17:19 ` [Qemu-devel] [PATCH 2/2] virtio-pci: error out when both legacy and modern modes are disabled Greg Kurz
2016-09-08  7:15   ` Markus Armbruster
2016-09-08  9:52     ` Greg Kurz [this message]

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=20160908115215.2ec9e3e3@bahia \
    --to=groug@kaod.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=armbru@redhat.com \
    --cc=mst@redhat.com \
    --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 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).