mbox series

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

Message ID 20210901090804.7139-1-maxim.davydov@virtuozzo.com (mailing list archive)
Headers show
Series Virtio features acknowledged by guest | expand

Message

Maxim Davydov Sept. 1, 2021, 9:07 a.m. UTC
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(-)

Comments

Stefan Hajnoczi Sept. 2, 2021, 12:34 p.m. UTC | #1
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