qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Andrea Bolognani <abologna@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org
Cc: Gonglei <arei.gonglei@huawei.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Amit Shah" <amit@kernel.org>, "Cleber Rosa" <crosa@redhat.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Fam Zheng" <famz@redhat.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Kevin Wolf" <kwolf@redhat.com>, "Max Reitz" <mreitz@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	libvir-list@redhat.com, "Markus Armbruster" <armbru@redhat.com>,
	"Laine Stump" <laine@redhat.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Caio Carrara" <ccarrara@redhat.com>
Subject: Re: [Qemu-devel] [PATCH for-4.0 v2] virtio: Provide version-specific variants of virtio PCI devices
Date: Thu, 15 Nov 2018 17:29:24 +0100	[thread overview]
Message-ID: <c1b4a0ee39dfddeb19f1be46710c10cbefd3f07a.camel@redhat.com> (raw)
In-Reply-To: <20181114233831.10374-1-ehabkost@redhat.com>

On Wed, 2018-11-14 at 21:38 -0200, Eduardo Habkost wrote:
> Many of the current virtio-*-pci device types actually represent
> 3 different types of devices:
> * virtio 1.0 non-transitional devices
> * virtio 1.0 transitional devices
> * virtio 0.9 ("legacy device" in virtio 1.0 terminology)
> 
> That would be just an annoyance if it didn't break our device/bus
> compatibility QMP interfaces.  With this multi-purpose device
> type, there's no way to tell management software that
> transitional devices and legacy devices require a Conventional
> PCI bus.
> 
> The multi-purpose device types would also prevent us from telling
> management software what's the PCI vendor/device ID for them,
> because their PCI IDs change at runtime depending on the bus
> where they were plugged.
> 
> This patch adds separate device types for each of those virtio
> device flavors:
> 
> - virtio-*-pci: the existing multi-purpose device types
>   - Configurable using `disable-legacy` and `disable-modern`
>     properties
>   - Legacy driver support is automatically enabled/disabled
>     depending on the bus where it is plugged
>   - Supports Conventional PCI and PCI Express buses
>     (but Conventional PCI is incompatible with
>     disable-legacy=off)
>   - Changes PCI vendor/device IDs at runtime
> - virtio-*-pci-transitional: virtio-1.0 device supporting legacy drivers
>   - Supports Conventional PCI buses only, because
>     it has a PIO BAR
> - virtio-*-pci-non-transitional: modern-only
>   - Supports both Conventional PCI and PCI Express buses

So, my understanding was that transitional devices would be suitable
for both PCI and PCIe slots and non-transitional devices could only
work in PCIe slots, but based on the above it looks like I got it
pretty much completely wrong? I'm not too surprised that would be
the case, to be honest: keeping this stuff straight in my head has
always been a bit of a challenge, so I can't possibly not welcome a
proposal like this, which will spell it out a bit more :)

Let me try to map the interactions out:

  * virtio-*-pci-transitional
    + plugged into PCI slot
      - shows up as vendor1/device1
    + plugged into PCIe slot
      - doesn't work

  * virtio-*-pci-non-transitional
    + plugged into PCI slot
      - shows up as vendor2/device2
    + plugged into PCIe slot
      - shows up as vendor2/device2

  * virtio-*-pci
    + plugged into PCI slot
      - shows up as vendor1/device1
        (same as virtio-*-pci-transitional)
    + plugged into PCIe slot
      - shows up as vendor2/device2
        (same as virtio-*-pci-non-transitional)

Does that look about right?

Once all the various pieces have fallen into place, when adding a
device to a guest running a modern OS we would find out through
libosinfo that it supports vendor2/device2 (and vendor1/device1
too, I guess?) so we would choose the non-transitional variant and
plug it into PCIe when possible (q35) or PCI otherwise (pc); on
the other hand, an older guest OS like CentOS 6 will only advertise
support for vendor1/device1, so we'd have to use the transitional
variant instead and plug it into a PCI slot regardless of the
machine type, which more specifically means building a
pcie.0 <- pcie-root-port <- pcie-pci-bridge topology for q35
guests.

If all of the above is correct, then it sounds like a feasible
enough plan to me, though of course it be a long time before users
and management applications can rely on these new device types
being available in downstream distributions...

One thing that I'm very much not convinced about is the naming,
specifically leaving the virtio revision out: I get it that we
Should Never Need™ another major version of the spec, but I'm
afraid discounting the possibility outright might prove to be
shortsighted and come back to bite us later, so I'd much rather
keep it.

And once that's done, "non-transitional" (while matching the
language of the spec) starts to look a bit unnecessary when you
could simply have

  virtio-*-pci
  virtio-*-pci-1
  virtio-*-pci-1-transitional

instead. But I don't feel as strongly about this as I do about
keeping the virtio revision in the device name :)

-- 
Andrea Bolognani / Red Hat / Virtualization

  parent reply	other threads:[~2018-11-15 16:31 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-14 23:38 [Qemu-devel] [PATCH for-4.0 v2] virtio: Provide version-specific variants of virtio PCI devices Eduardo Habkost
2018-11-15  8:40 ` no-reply
2018-11-15 10:05 ` Daniel P. Berrangé
2018-11-15 10:50   ` Cornelia Huck
2018-11-15 10:52     ` Daniel P. Berrangé
2018-11-20  0:44     ` Eduardo Habkost
2018-11-20 10:46       ` Daniel P. Berrangé
2018-11-20 10:52       ` Cornelia Huck
2018-11-20 11:51         ` Eduardo Habkost
2018-11-15 11:21 ` Cornelia Huck
2018-11-15 15:01   ` Cornelia Huck
2018-11-27  0:35   ` Eduardo Habkost
2018-11-15 16:29 ` Andrea Bolognani [this message]
2018-11-16  3:45   ` Eduardo Habkost
2018-11-19 10:41     ` Cornelia Huck
2018-11-19 18:07       ` Michael S. Tsirkin
2018-11-19 18:32         ` Cornelia Huck
2018-11-19 18:42           ` Michael S. Tsirkin
2018-11-19 18:56             ` Cornelia Huck
2018-11-19 19:14               ` Michael S. Tsirkin
2018-11-20 12:27                 ` Andrea Bolognani
2018-11-20 19:14                   ` Michael S. Tsirkin
2018-11-21 16:20                     ` Andrea Bolognani
2018-11-19 21:32               ` Eduardo Habkost
2018-11-20 10:35                 ` Cornelia Huck
2018-11-19 21:47         ` Eduardo Habkost
2018-11-20  3:08           ` Michael S. Tsirkin
2018-11-20  3:22             ` Eduardo Habkost

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=c1b4a0ee39dfddeb19f1be46710c10cbefd3f07a.camel@redhat.com \
    --to=abologna@redhat.com \
    --cc=amit@kernel.org \
    --cc=arei.gonglei@huawei.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=ccarrara@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=crosa@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=famz@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=laine@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mreitz@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=wainersm@redhat.com \
    /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).