[PATCH v1 0/8] Virtio features acknowledged by guest

Maxim Davydov posted 8 patches 2 years, 7 months ago
Test checkpatch failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20210901090804.7139-1-maxim.davydov@virtuozzo.com
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Laurent Vivier <lvivier@redhat.com>, Hanna Reitz <hreitz@redhat.com>, Eduardo Habkost <ehabkost@redhat.com>, Jason Wang <jasowang@redhat.com>, Raphael Norwitz <raphael.norwitz@nutanix.com>, Paolo Bonzini <pbonzini@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, David Hildenbrand <david@redhat.com>, Amit Shah <amit@kernel.org>, Fam Zheng <fam@euphon.net>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Kevin Wolf <kwolf@redhat.com>
hw/block/virtio-blk.c          |  20 ++++---
hw/char/virtio-serial-bus.c    |   5 +-
hw/core/qdev-properties.c      |  32 +++++++++++
hw/display/vhost-user-gpu.c    |   3 +-
hw/display/virtio-gpu.c        |   8 +--
hw/net/virtio-net.c            | 118 +++++++++++++++++++++++++----------------
hw/scsi/vhost-scsi.c           |   6 +--
hw/scsi/vhost-user-scsi.c      |  18 +++----
hw/scsi/virtio-scsi.c          |  10 ++--
hw/virtio/virtio-balloon.c     |  20 ++++---
hw/virtio/virtio.c             |   2 +-
include/hw/qdev-properties.h   |   5 ++
include/hw/virtio/virtio-gpu.h |  10 ++--
include/hw/virtio/virtio.h     |  39 +++++++++-----
14 files changed, 193 insertions(+), 103 deletions(-)
[PATCH v1 0/8] Virtio features acknowledged by guest
Posted by Maxim Davydov 2 years, 7 months ago
In some situations (for instance, debug), we want to be able to see the
features that were confirmed by the guest. At the same time, we would like
to do this safely, without the possibility of setting bits of guest
features from the outside.

Maxim Davydov (8):
  qdev-properties: Add read-only 64 bit property
  virtio: Add tracking of the common virtio guest features
  virtio-gpu: Add tracking of the virtio guest feature bits
  virtio-serial: Add tracking of the virtio guest feature bits
  virtio-net: Add tracking of the virtio guest feature bits
  scsi: Add tracking of the acknowledged feature bits
  virtio-blk: Add tracking of the virtio guest feature bits
  virtio-balloon: Add tracking of the virtio guest feature bits

 hw/block/virtio-blk.c          |  20 ++++---
 hw/char/virtio-serial-bus.c    |   5 +-
 hw/core/qdev-properties.c      |  32 +++++++++++
 hw/display/vhost-user-gpu.c    |   3 +-
 hw/display/virtio-gpu.c        |   8 +--
 hw/net/virtio-net.c            | 118 +++++++++++++++++++++++++----------------
 hw/scsi/vhost-scsi.c           |   6 +--
 hw/scsi/vhost-user-scsi.c      |  18 +++----
 hw/scsi/virtio-scsi.c          |  10 ++--
 hw/virtio/virtio-balloon.c     |  20 ++++---
 hw/virtio/virtio.c             |   2 +-
 include/hw/qdev-properties.h   |   5 ++
 include/hw/virtio/virtio-gpu.h |  10 ++--
 include/hw/virtio/virtio.h     |  39 +++++++++-----
 14 files changed, 193 insertions(+), 103 deletions(-)

-- 
1.8.3.1


Re: [PATCH v1 0/8] Virtio features acknowledged by guest
Posted by Stefan Hajnoczi 2 years, 7 months ago
On Wed, Sep 01, 2021 at 12:07:56PM +0300, Maxim Davydov wrote:
> In some situations (for instance, debug), we want to be able to see the
> features that were confirmed by the guest. At the same time, we would like
> to do this safely, without the possibility of setting bits of guest
> features from the outside.
> 
> Maxim Davydov (8):
>   qdev-properties: Add read-only 64 bit property
>   virtio: Add tracking of the common virtio guest features
>   virtio-gpu: Add tracking of the virtio guest feature bits
>   virtio-serial: Add tracking of the virtio guest feature bits
>   virtio-net: Add tracking of the virtio guest feature bits
>   scsi: Add tracking of the acknowledged feature bits
>   virtio-blk: Add tracking of the virtio guest feature bits
>   virtio-balloon: Add tracking of the virtio guest feature bits
> 
>  hw/block/virtio-blk.c          |  20 ++++---
>  hw/char/virtio-serial-bus.c    |   5 +-
>  hw/core/qdev-properties.c      |  32 +++++++++++
>  hw/display/vhost-user-gpu.c    |   3 +-
>  hw/display/virtio-gpu.c        |   8 +--
>  hw/net/virtio-net.c            | 118 +++++++++++++++++++++++++----------------
>  hw/scsi/vhost-scsi.c           |   6 +--
>  hw/scsi/vhost-user-scsi.c      |  18 +++----
>  hw/scsi/virtio-scsi.c          |  10 ++--
>  hw/virtio/virtio-balloon.c     |  20 ++++---
>  hw/virtio/virtio.c             |   2 +-
>  include/hw/qdev-properties.h   |   5 ++
>  include/hw/virtio/virtio-gpu.h |  10 ++--
>  include/hw/virtio/virtio.h     |  39 +++++++++-----
>  14 files changed, 193 insertions(+), 103 deletions(-)

Hi Maxim,
The VIRTIO specification is designed to allow more than 64 feature bits.
Currently all feature bits fit into 64 bits but that may not be the case
in the future. Please use a representation that is capable of expanding
in the future.

The Linux guest drivers have a string sysfs attribute that is formatted
in binary ('0' and '1' characters). It's not easy for humans to read but
it is capable of growing in the future.

Also, please take a look at Jonah Palmer's patch series that adds
commands to introspect VIRTIO devices:
https://lore.kernel.org/qemu-devel/1626086137-16292-1-git-send-email-jonah.palmer@oracle.com/

I have CCed Jonah in case there is overlap between the two series that
you can work together on.

Stefan