From: "Michael S. Tsirkin" <mst@redhat.com>
To: David Hildenbrand <dahi@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org,
Cornelia Huck <cornelia.huck@de.ibm.com>,
Rusty Russell <rusty@rustcorp.com.au>,
virtualization@lists.linux-foundation.org,
Ohad Ben-Cohen <ohad@wizery.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
linux390@de.ibm.com, Martin Schwidefsky <schwidefsky@de.ibm.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Nikhil Rao <nikhil.rao@intel.com>,
Siva Yerramreddy <yshivakrishna@gmail.com>,
lguest@lists.ozlabs.org, linux-s390@vger.kernel.org
Subject: Re: [PATCH RFC v2 3/4] virtio: allow finalize_features to fail
Date: Mon, 8 Dec 2014 09:30:58 +0200 [thread overview]
Message-ID: <20141208073058.GG18208@redhat.com> (raw)
In-Reply-To: <20141205105354.2cf1bfc9@thinkpad-w530>
On Fri, Dec 05, 2014 at 10:53:54AM +0100, David Hildenbrand wrote:
> > This will make it easy for transports to validate features and return
> > failure.
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> > include/linux/virtio_config.h | 3 ++-
> > drivers/lguest/lguest_device.c | 4 +++-
> > drivers/misc/mic/card/mic_virtio.c | 4 +++-
> > drivers/remoteproc/remoteproc_virtio.c | 4 +++-
> > drivers/s390/kvm/kvm_virtio.c | 4 +++-
> > drivers/s390/kvm/virtio_ccw.c | 6 ++++--
> > drivers/virtio/virtio.c | 4 +++-
> > drivers/virtio/virtio_mmio.c | 4 +++-
> > drivers/virtio/virtio_pci.c | 4 +++-
> > 9 files changed, 27 insertions(+), 10 deletions(-)
> >
> > diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
> > index 1fa5faa..7979f85 100644
> > --- a/include/linux/virtio_config.h
> > +++ b/include/linux/virtio_config.h
> > @@ -47,6 +47,7 @@
> > * vdev: the virtio_device
> > * This gives the final feature bits for the device: it can change
> > * the dev->feature bits if it wants.
> > + * Returns 0 on success or error status
>
> "Returns 0 on success, otherwise the error status."
It's what other functions say.
I'm ok with changing this but let's do it in a separate patch.
> > * @bus_name: return the bus name associated with the device
> > * vdev: the virtio_device
> > * This returns a pointer to the bus name a la pci_name from which
> > @@ -68,7 +69,7 @@ struct virtio_config_ops {
> > const char *names[]);
> > void (*del_vqs)(struct virtio_device *);
> > u64 (*get_features)(struct virtio_device *vdev);
> > - void (*finalize_features)(struct virtio_device *vdev);
> > + int (*finalize_features)(struct virtio_device *vdev);
> > const char *(*bus_name)(struct virtio_device *vdev);
> > int (*set_vq_affinity)(struct virtqueue *vq, int cpu);
> > };
>
> ...
>
> >
> > static void virtio_ccw_get_config(struct virtio_device *vdev,
> > diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
> > index 6b4c1113..7ddebbc 100644
> > --- a/drivers/virtio/virtio.c
> > +++ b/drivers/virtio/virtio.c
> > @@ -211,7 +211,9 @@ static int virtio_dev_probe(struct device *_d)
> > if (device_features & (1ULL << i))
> > __virtio_set_bit(dev, i);
> >
> > - dev->config->finalize_features(dev);
> > + err = dev->config->finalize_features(dev);
> > + if (err)
> > + goto err;
> >
> > if (virtio_has_feature(dev, VIRTIO_F_VERSION_1)) {
> > add_status(dev, VIRTIO_CONFIG_S_FEATURES_OK);
> > diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
> > index aec1dae..5219210 100644
> > --- a/drivers/virtio/virtio_mmio.c
> > +++ b/drivers/virtio/virtio_mmio.c
> > @@ -152,7 +152,7 @@ static u64 vm_get_features(struct virtio_device *vdev)
> > return readl(vm_dev->base + VIRTIO_MMIO_HOST_FEATURES);
> > }
> >
>
> Do we have to take care of fails in virtio_device_restore()?
>
> Otherwise looks good to me.
>
> David
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: David Hildenbrand <dahi@linux.vnet.ibm.com>
Cc: linux-s390@vger.kernel.org, lguest@lists.ozlabs.org,
Siva Yerramreddy <yshivakrishna@gmail.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org,
Christian Borntraeger <borntraeger@de.ibm.com>,
linux390@de.ibm.com, Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: Re: [PATCH RFC v2 3/4] virtio: allow finalize_features to fail
Date: Mon, 8 Dec 2014 09:30:58 +0200 [thread overview]
Message-ID: <20141208073058.GG18208@redhat.com> (raw)
In-Reply-To: <20141205105354.2cf1bfc9@thinkpad-w530>
On Fri, Dec 05, 2014 at 10:53:54AM +0100, David Hildenbrand wrote:
> > This will make it easy for transports to validate features and return
> > failure.
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> > include/linux/virtio_config.h | 3 ++-
> > drivers/lguest/lguest_device.c | 4 +++-
> > drivers/misc/mic/card/mic_virtio.c | 4 +++-
> > drivers/remoteproc/remoteproc_virtio.c | 4 +++-
> > drivers/s390/kvm/kvm_virtio.c | 4 +++-
> > drivers/s390/kvm/virtio_ccw.c | 6 ++++--
> > drivers/virtio/virtio.c | 4 +++-
> > drivers/virtio/virtio_mmio.c | 4 +++-
> > drivers/virtio/virtio_pci.c | 4 +++-
> > 9 files changed, 27 insertions(+), 10 deletions(-)
> >
> > diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
> > index 1fa5faa..7979f85 100644
> > --- a/include/linux/virtio_config.h
> > +++ b/include/linux/virtio_config.h
> > @@ -47,6 +47,7 @@
> > * vdev: the virtio_device
> > * This gives the final feature bits for the device: it can change
> > * the dev->feature bits if it wants.
> > + * Returns 0 on success or error status
>
> "Returns 0 on success, otherwise the error status."
It's what other functions say.
I'm ok with changing this but let's do it in a separate patch.
> > * @bus_name: return the bus name associated with the device
> > * vdev: the virtio_device
> > * This returns a pointer to the bus name a la pci_name from which
> > @@ -68,7 +69,7 @@ struct virtio_config_ops {
> > const char *names[]);
> > void (*del_vqs)(struct virtio_device *);
> > u64 (*get_features)(struct virtio_device *vdev);
> > - void (*finalize_features)(struct virtio_device *vdev);
> > + int (*finalize_features)(struct virtio_device *vdev);
> > const char *(*bus_name)(struct virtio_device *vdev);
> > int (*set_vq_affinity)(struct virtqueue *vq, int cpu);
> > };
>
> ...
>
> >
> > static void virtio_ccw_get_config(struct virtio_device *vdev,
> > diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
> > index 6b4c1113..7ddebbc 100644
> > --- a/drivers/virtio/virtio.c
> > +++ b/drivers/virtio/virtio.c
> > @@ -211,7 +211,9 @@ static int virtio_dev_probe(struct device *_d)
> > if (device_features & (1ULL << i))
> > __virtio_set_bit(dev, i);
> >
> > - dev->config->finalize_features(dev);
> > + err = dev->config->finalize_features(dev);
> > + if (err)
> > + goto err;
> >
> > if (virtio_has_feature(dev, VIRTIO_F_VERSION_1)) {
> > add_status(dev, VIRTIO_CONFIG_S_FEATURES_OK);
> > diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
> > index aec1dae..5219210 100644
> > --- a/drivers/virtio/virtio_mmio.c
> > +++ b/drivers/virtio/virtio_mmio.c
> > @@ -152,7 +152,7 @@ static u64 vm_get_features(struct virtio_device *vdev)
> > return readl(vm_dev->base + VIRTIO_MMIO_HOST_FEATURES);
> > }
> >
>
> Do we have to take care of fails in virtio_device_restore()?
>
> Otherwise looks good to me.
>
> David
next prev parent reply other threads:[~2014-12-08 7:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-04 18:44 [PATCH RFC v2 1/4] virtio: add API to detect legacy devices Michael S. Tsirkin
2014-12-04 18:44 ` Michael S. Tsirkin
2014-12-04 18:44 ` [PATCH RFC v2 2/4] virtio_ccw: legacy: don't negotiate rev 1/features Michael S. Tsirkin
2014-12-04 18:44 ` Michael S. Tsirkin
2014-12-04 18:44 ` [PATCH RFC v2 3/4] virtio: allow finalize_features to fail Michael S. Tsirkin
2014-12-04 18:44 ` Michael S. Tsirkin
2014-12-05 9:53 ` David Hildenbrand
2014-12-05 9:53 ` David Hildenbrand
2014-12-08 7:30 ` Michael S. Tsirkin [this message]
2014-12-08 7:30 ` Michael S. Tsirkin
2014-12-04 18:44 ` [PATCH RFC v2 4/4] virtio_ccw: rev 1 devices set VIRTIO_F_VERSION_1 Michael S. Tsirkin
2014-12-04 18:44 ` Michael S. Tsirkin
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=20141208073058.GG18208@redhat.com \
--to=mst@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=dahi@linux.vnet.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=lguest@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux390@de.ibm.com \
--cc=nikhil.rao@intel.com \
--cc=ohad@wizery.com \
--cc=rusty@rustcorp.com.au \
--cc=schwidefsky@de.ibm.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=yshivakrishna@gmail.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.