qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Apfelbaum <marcel@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>,
	qemu-devel@nongnu.org, cornelia.huck@de.ibm.com,
	vkaplans@redhat.com, qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 1/2] virtio: Add function to check whether backend supports VIRTIO_1
Date: Sun, 11 Sep 2016 11:04:36 +0300	[thread overview]
Message-ID: <0cc674cf-373d-bffd-82d2-634b3b1875f5@redhat.com> (raw)
In-Reply-To: <20160909204714-mutt-send-email-mst@kernel.org>

On 09/09/2016 08:47 PM, Michael S. Tsirkin wrote:
> On Fri, Sep 09, 2016 at 08:00:31PM +0300, Marcel Apfelbaum wrote:
>> On 09/09/2016 04:10 PM, Maxime Coquelin wrote:
>>> This patch adds virtio_test_backend_virtio_1() function to
>>> check whether backend supports VIRTIO_F_VERSION_1 before the
>>> negociation takes place.
>>>
>>> Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
>>> Cc: Marcel Apfelbaum <marcel@redhat.com>
>>> Cc: Michael S. Tsirkin <mst@redhat.com>
>>> Cc: qemu-stable@nongnu.org
>>> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>>> ---
>>>  hw/virtio/virtio.c         | 13 +++++++++++++
>>>  include/hw/virtio/virtio.h |  1 +
>>>  2 files changed, 14 insertions(+)
>>>
>>> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
>>> index 74c085c..8b30b69 100644
>>> --- a/hw/virtio/virtio.c
>>> +++ b/hw/virtio/virtio.c
>>> @@ -1481,6 +1481,19 @@ void virtio_vmstate_save(QEMUFile *f, void *opaque, size_t size)
>>>      virtio_save(VIRTIO_DEVICE(opaque), f);
>>>  }
>>>
>>> +bool virtio_test_backend_virtio_1(VirtIODevice *vdev, Error **errp)
>>> +{
>>> +    VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
>>> +    uint64_t feature;
>>> +
>>
>> I would set "feature = 0" even if doesn't really matter.
>> Anyway:
>>
>> Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
>>
>> Thanks,
>> Marcel
>
> why wouldn't it matter? Looks like an uninitialized variable to me.

because it adds a flag, then it checks only if this specific flag is
negotiated, but uninitialized variables are never a good idea.

Thanks,
Marcel

>
>>> +    virtio_add_feature(&feature, VIRTIO_F_VERSION_1);
>>> +
>>> +    assert(k->get_features != NULL);
>>> +    feature = k->get_features(vdev, feature, errp);
>>> +
>>> +    return virtio_has_feature(feature, VIRTIO_F_VERSION_1);
>>> +}
>>> +
>>>  static int virtio_set_features_nocheck(VirtIODevice *vdev, uint64_t val)
>>>  {
>>>      VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
>>> diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
>>> index d2490c1..3a31754 100644
>>> --- a/include/hw/virtio/virtio.h
>>> +++ b/include/hw/virtio/virtio.h
>>> @@ -235,6 +235,7 @@ int virtio_set_status(VirtIODevice *vdev, uint8_t val);
>>>  void virtio_reset(void *opaque);
>>>  void virtio_update_irq(VirtIODevice *vdev);
>>>  int virtio_set_features(VirtIODevice *vdev, uint64_t val);
>>> +bool virtio_test_backend_virtio_1(VirtIODevice *vdev, Error **errp);
>>>
>>>  /* Base devices.  */
>>>  typedef struct VirtIOBlkConf VirtIOBlkConf;
>>>

  parent reply	other threads:[~2016-09-11  8:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-09 13:10 [Qemu-devel] [PATCH v2 0/2] virtio-pci: Improve device plugging whith legacy backends Maxime Coquelin
2016-09-09 13:10 ` [Qemu-devel] [PATCH v2 1/2] virtio: Add function to check whether backend supports VIRTIO_1 Maxime Coquelin
2016-09-09 17:00   ` Marcel Apfelbaum
2016-09-09 17:47     ` Michael S. Tsirkin
2016-09-09 17:49       ` Maxime Coquelin
2016-09-11  8:04       ` Marcel Apfelbaum [this message]
2016-09-12 12:28   ` Cornelia Huck
2016-09-12 16:42     ` Maxime Coquelin
2016-09-12 16:54       ` Michael S. Tsirkin
2016-09-09 13:10 ` [Qemu-devel] [PATCH v2 2/2] virtio-pci: Disable modern interface if backend without VIRTIO_F_VERSION_1 Maxime Coquelin
2016-09-09 17:04   ` Marcel Apfelbaum
2016-09-09 17:48   ` Michael S. Tsirkin
2016-09-09 17:56     ` Maxime Coquelin

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=0cc674cf-373d-bffd-82d2-634b3b1875f5@redhat.com \
    --to=marcel@redhat.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=vkaplans@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).