diff mbox series

[v2,2/5] virtio: Set "start_on_kick" for legacy devices

Message ID 20190604073459.15651-3-xieyongji@baidu.com (mailing list archive)
State New, archived
Headers show
Series virtio: fix some issues of "started" and "start_on_kick" flag | expand

Commit Message

Yongji Xie June 4, 2019, 7:34 a.m. UTC
From: Xie Yongji <xieyongji@baidu.com>

Besides virtio 1.0 transitional devices, we should also
set "start_on_kick" flag for legacy devices (virtio 0.9).

Signed-off-by: Xie Yongji <xieyongji@baidu.com>
---
 hw/virtio/virtio.c         | 2 --
 include/hw/virtio/virtio.h | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

Comments

Greg Kurz June 5, 2019, 6:42 a.m. UTC | #1
On Tue,  4 Jun 2019 15:34:56 +0800
elohimes@gmail.com wrote:

> From: Xie Yongji <xieyongji@baidu.com>
> 
> Besides virtio 1.0 transitional devices, we should also
> set "start_on_kick" flag for legacy devices (virtio 0.9).
> 
> Signed-off-by: Xie Yongji <xieyongji@baidu.com>
> ---

Patch looks good but it would be even better if applied
earlier so that it doesn't revert lines added by the
previous patch...

>  hw/virtio/virtio.c         | 2 --
>  include/hw/virtio/virtio.h | 2 +-
>  2 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
> index 6508b2faad..6ec45d8f0a 100644
> --- a/hw/virtio/virtio.c
> +++ b/hw/virtio/virtio.c
> @@ -2080,7 +2080,6 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val)
>          }
>  
>          if (!vdev->started &&
> -            virtio_host_has_feature(vdev, VIRTIO_F_VERSION_1) &&

... here and...
>              !virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
>              vdev->start_on_kick = true;
>          }
> @@ -2236,7 +2235,6 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
>      }
>  
>      if (!vdev->started &&
> -        virtio_host_has_feature(vdev, VIRTIO_F_VERSION_1) &&

... here.

>          !virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
>          vdev->start_on_kick = true;
>      }
> diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
> index 27c0efc3d0..303242b3c2 100644
> --- a/include/hw/virtio/virtio.h
> +++ b/include/hw/virtio/virtio.h
> @@ -106,7 +106,7 @@ struct VirtIODevice
>      bool vm_running;
>      bool broken; /* device in invalid state, needs reset */
>      bool started;
> -    bool start_on_kick; /* virtio 1.0 transitional devices support that */
> +    bool start_on_kick; /* when virtio 1.0 feature has not been negotiated */
>      VMChangeStateEntry *vmstate;
>      char *bus_name;
>      uint8_t device_endian;
Yongji Xie June 5, 2019, 6:49 a.m. UTC | #2
On Wed, 5 Jun 2019 at 14:42, Greg Kurz <groug@kaod.org> wrote:
>
> On Tue,  4 Jun 2019 15:34:56 +0800
> elohimes@gmail.com wrote:
>
> > From: Xie Yongji <xieyongji@baidu.com>
> >
> > Besides virtio 1.0 transitional devices, we should also
> > set "start_on_kick" flag for legacy devices (virtio 0.9).
> >
> > Signed-off-by: Xie Yongji <xieyongji@baidu.com>
> > ---
>
> Patch looks good but it would be even better if applied
> earlier so that it doesn't revert lines added by the
> previous patch...
>

Fine with me. Will do it in v3.

Thanks,
Yongji
Greg Kurz June 5, 2019, 7:14 a.m. UTC | #3
On Wed, 5 Jun 2019 14:49:34 +0800
Yongji Xie <elohimes@gmail.com> wrote:

> On Wed, 5 Jun 2019 at 14:42, Greg Kurz <groug@kaod.org> wrote:
> >
> > On Tue,  4 Jun 2019 15:34:56 +0800
> > elohimes@gmail.com wrote:
> >  
> > > From: Xie Yongji <xieyongji@baidu.com>
> > >
> > > Besides virtio 1.0 transitional devices, we should also
> > > set "start_on_kick" flag for legacy devices (virtio 0.9).
> > >
> > > Signed-off-by: Xie Yongji <xieyongji@baidu.com>
> > > ---  
> >
> > Patch looks good but it would be even better if applied
> > earlier so that it doesn't revert lines added by the
> > previous patch...
> >  
> 
> Fine with me. Will do it in v3.
> 

Hold on before posting, I've just learned about hw_compat_4_0_1 while
reviewing patch 5... need so more time to understand the impact.

Cheers,

--
Greg

> Thanks,
> Yongji
Yongji Xie June 5, 2019, 7:16 a.m. UTC | #4
On Wed, 5 Jun 2019 at 15:14, Greg Kurz <groug@kaod.org> wrote:
>
> On Wed, 5 Jun 2019 14:49:34 +0800
> Yongji Xie <elohimes@gmail.com> wrote:
>
> > On Wed, 5 Jun 2019 at 14:42, Greg Kurz <groug@kaod.org> wrote:
> > >
> > > On Tue,  4 Jun 2019 15:34:56 +0800
> > > elohimes@gmail.com wrote:
> > >
> > > > From: Xie Yongji <xieyongji@baidu.com>
> > > >
> > > > Besides virtio 1.0 transitional devices, we should also
> > > > set "start_on_kick" flag for legacy devices (virtio 0.9).
> > > >
> > > > Signed-off-by: Xie Yongji <xieyongji@baidu.com>
> > > > ---
> > >
> > > Patch looks good but it would be even better if applied
> > > earlier so that it doesn't revert lines added by the
> > > previous patch...
> > >
> >
> > Fine with me. Will do it in v3.
> >
>
> Hold on before posting, I've just learned about hw_compat_4_0_1 while
> reviewing patch 5... need so more time to understand the impact.
>

Sure.

Thanks,
Yongji
diff mbox series

Patch

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 6508b2faad..6ec45d8f0a 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2080,7 +2080,6 @@  int virtio_set_features(VirtIODevice *vdev, uint64_t val)
         }
 
         if (!vdev->started &&
-            virtio_host_has_feature(vdev, VIRTIO_F_VERSION_1) &&
             !virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
             vdev->start_on_kick = true;
         }
@@ -2236,7 +2235,6 @@  int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
     }
 
     if (!vdev->started &&
-        virtio_host_has_feature(vdev, VIRTIO_F_VERSION_1) &&
         !virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
         vdev->start_on_kick = true;
     }
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 27c0efc3d0..303242b3c2 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -106,7 +106,7 @@  struct VirtIODevice
     bool vm_running;
     bool broken; /* device in invalid state, needs reset */
     bool started;
-    bool start_on_kick; /* virtio 1.0 transitional devices support that */
+    bool start_on_kick; /* when virtio 1.0 feature has not been negotiated */
     VMChangeStateEntry *vmstate;
     char *bus_name;
     uint8_t device_endian;