All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org, Gonglei <arei.gonglei@huawei.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Amit Shah" <amit@kernel.org>,
	"Andrea Bolognani" <abologna@redhat.com>,
	"Cleber Rosa" <crosa@redhat.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Fam Zheng" <famz@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 12:21:55 +0100	[thread overview]
Message-ID: <20181115122155.7a15df7d.cohuck@redhat.com> (raw)
In-Reply-To: <20181114233831.10374-1-ehabkost@redhat.com>

On Wed, 14 Nov 2018 21:38:31 -0200
Eduardo Habkost <ehabkost@redhat.com> wrote:

> diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
> index 813082b0d7..1d2a11504f 100644
> --- a/hw/virtio/virtio-pci.h
> +++ b/hw/virtio/virtio-pci.h

(...)

> +/**
> + * VirtioPCIDeviceTypeInfo:
> + *
> + * Template for virtio PCI device types.  See virtio_pci_types_register()
> + * for details.
> + */
> +typedef struct VirtioPCIDeviceTypeInfo {
> +    /* Prefix for the class names */
> +    const char *name_prefix;

<bikeshed>Maybe call this the vpci_name instead? It's not really a
prefix in the way I would usually use the term, but rather a type name
with a possible suffix tacked onto it.</bikeshed>

> +    /* Parent type.  If NULL, TYPE_VIRTIO_PCI is used */
> +    const char *parent;
> +    /* If modern_only is true, only <name_prefix> type will be registered */
> +    bool modern_only;
> +
> +    /* Same as TypeInfo fields: */
> +    size_t instance_size;
> +    void (*instance_init)(Object *obj);
> +    void (*class_init)(ObjectClass *klass, void *data);
> +} VirtioPCIDeviceTypeInfo;
> +
> +/*
> + * Register virtio-pci types.  Each virtio-pci device type will be available
> + * in 3 flavors:
> + * - <prefix>-transitional: modern device supporting legacy drivers
> + *   - Supports Conventional PCI buses only
> + * - <prefix>-non-transitional: modern-only
> + *   - Supports Conventional PCI and PCI Express buses
> + * - <prefix>: virtio version configurable, legacy driver support
> + *                  automatically selected when device is plugged
> + *   _ This was the only flavor supported until QEMU 3.1

s/_/-/
s/until/up to/ ?

> + *   - Supports Conventional PCI and PCI Express buses
> + *
> + * All the types above will inherit from "<prefix>-base", so generic
> + * code can use "<prefix>-base" on type casts.
> + *
> + * We need a separate "<prefix>-base" type instead of making all types inherit
> + * from <prefix> for two reasons:
> + * 1) <prefix> will implement INTERFACE_PCIE_DEVICE, but
> + *    <prefix>-transitional won't.
> + * 2) <prefix> will have the "disable-legacy" and "disable-modern" properties,
> + *    <prefix>-transitional and <prefix>-non-transitional won't.

<bikeshed>I'd formulate this rather as "x implements/has something, y
and z do not", as the code actually does that (and does not just intend
to do so :)</bikeshed>

> + */
> +void virtio_pci_types_register(const VirtioPCIDeviceTypeInfo *t);
> +
>  #endif

(...)

> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> index a954799267..0fa248d68c 100644
> --- a/hw/virtio/virtio-pci.c
> +++ b/hw/virtio/virtio-pci.c

(...)

> +static void virtio_pci_1_0_instance_init(Object *obj)

Ditch the _0? I don't expect this to change the name when virtio 1.1
arrives.

> +{
> +    VirtIOPCIProxy *proxy = VIRTIO_PCI(obj);
> +
> +    proxy->disable_legacy = ON_OFF_AUTO_ON;
> +    proxy->disable_modern = false;
> +}

(...)

After a quick look, this seems fine; have not actually tried to run it
yet.

  parent reply	other threads:[~2018-11-15 11:22 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 [this message]
2018-11-15 15:01   ` Cornelia Huck
2018-11-27  0:35   ` Eduardo Habkost
2018-11-15 16:29 ` Andrea Bolognani
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=20181115122155.7a15df7d.cohuck@redhat.com \
    --to=cohuck@redhat.com \
    --cc=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=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 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.