[PATCH v14 5/8] qmp: decode feature & status bits in virtio-status
From: Laurent Vivier Display feature names instead of bitmaps for host, guest, and backend for VirtIODevices. Display status names instead of bitmaps for VirtIODevices. Display feature names instead of bitmaps for backend, protocol, acked, and features (hdev->features) for vhost devices. Decode features according to device ID. Decode statuses according to configuration status bitmap (config_status_map). Decode vhost user protocol features according to vhost user protocol bitmap (vhost_user_protocol_map). Transport features are on the first line. Undecoded bits (if any) are stored in a separate field. Signed-off-by: Jonah Palmer --- hw/block/virtio-blk.c | 29 hw/char/virtio-serial-bus.c| 11 ++ hw/display/virtio-gpu.c| 18 ++ hw/input/virtio-input.c| 10 ++ hw/net/virtio-net.c| 47 + hw/scsi/virtio-scsi.c | 17 ++ hw/virtio/vhost-user-fs.c | 10 ++ hw/virtio/vhost-user-i2c.c | 14 ++ hw/virtio/vhost-vsock-common.c | 10 ++ hw/virtio/virtio-balloon.c | 14 ++ hw/virtio/virtio-crypto.c | 10 ++ hw/virtio/virtio-iommu.c | 14 ++ hw/virtio/virtio-mem.c | 11 ++ hw/virtio/virtio.c | 302 - include/hw/virtio/vhost.h | 3 + include/hw/virtio/virtio.h | 19 +++ qapi/virtio.json | 156 ++--- 17 files changed, 667 insertions(+), 28 deletions(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 27c71ad316..f104603040 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qapi-visit-virtio.h" #include "qemu/iov.h" #include "qemu/module.h" #include "qemu/error-report.h" @@ -33,10 +34,38 @@ #include "migration/qemu-file-types.h" #include "hw/virtio/virtio-access.h" #include "qemu/coroutine.h" +#include "standard-headers/linux/vhost_types.h" /* Config size before the discard support (hide associated config fields) */ #define VIRTIO_BLK_CFG_SIZE offsetof(struct virtio_blk_config, \ max_discard_sectors) + +qmp_virtio_feature_map_t blk_map[] = { +#define FEATURE_ENTRY(name) \ +{ VIRTIO_BLK_F_##name, #name } +FEATURE_ENTRY(SIZE_MAX), +FEATURE_ENTRY(SEG_MAX), +FEATURE_ENTRY(GEOMETRY), +FEATURE_ENTRY(RO), +FEATURE_ENTRY(BLK_SIZE), +FEATURE_ENTRY(TOPOLOGY), +FEATURE_ENTRY(MQ), +FEATURE_ENTRY(DISCARD), +FEATURE_ENTRY(WRITE_ZEROES), +#ifndef VIRTIO_BLK_NO_LEGACY +FEATURE_ENTRY(BARRIER), +FEATURE_ENTRY(SCSI), +FEATURE_ENTRY(FLUSH), +FEATURE_ENTRY(CONFIG_WCE), +#endif /* !VIRTIO_BLK_NO_LEGACY */ +#undef FEATURE_ENTRY +#define FEATURE_ENTRY(name) \ +{ VHOST_F_##name, #name } +FEATURE_ENTRY(LOG_ALL), +#undef FEATURE_ENTRY +{ -1, "" } +}; + /* * Starting from the discard feature, we can use this array to properly * set the config size depending on the features enabled. diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index 7d4601cb5d..fbb31a2b16 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qapi-visit-virtio.h" #include "qemu/iov.h" #include "qemu/main-loop.h" #include "qemu/module.h" @@ -32,6 +33,16 @@ #include "hw/virtio/virtio-serial.h" #include "hw/virtio/virtio-access.h" +qmp_virtio_feature_map_t serial_map[] = { +#define FEATURE_ENTRY(name) \ +{ VIRTIO_CONSOLE_F_##name, #name } +FEATURE_ENTRY(SIZE), +FEATURE_ENTRY(MULTIPORT), +FEATURE_ENTRY(EMERG_WRITE), +#undef FEATURE_ENTRY +{ -1, "" } +}; + static struct VirtIOSerialDevices { QLIST_HEAD(, VirtIOSerial) devices; } vserdevices; diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 529b5246b2..0bd5dc6232 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -29,10 +29,28 @@ #include "qemu/log.h" #include "qemu/module.h" #include "qapi/error.h" +#include "qapi/qapi-visit-virtio.h" #include "qemu/error-report.h" +#include "standard-headers/linux/vhost_types.h" #define VIRTIO_GPU_VM_VERSION 1 +qmp_virtio_feature_map_t gpu_map[] = { +#define FEATURE_ENTRY(name) \ +{ VIRTIO_GPU_F_##name, #name } +FEATURE_ENTRY(VIRGL), +FEATURE_ENTRY(EDID), +FEATURE_ENTRY(RESOURCE_UUID), +FEATURE_ENTRY(RESOURCE_BLOB), +FEATURE_ENTRY(CONTEXT_INIT), +#undef FEATURE_ENTRY +#define FEATURE_ENTRY(name) \ +{ VHOST_F_##name, #name } +FEATURE_ENTRY(LOG_ALL), +#undef FEATURE_ENTRY +{ -1, "" } +}; + static struct virtio_gpu_simple_resource* virtio_gpu_find_resource(VirtIOGPU *g, uint32_t resource_id); static struct virtio_gpu_simple_resource * diff --git a/hw/input/virtio-input.c b/hw/input/virtio-input.c index 5b5398b3ca..fe0ed6d5b4 100644 --- a/hw/input/virtio-input.c +++ b/hw/input/virtio-input.c @@ -6,6 +6,7 @@ #include "qemu/osdep.h" #incl
Re: [PATCH v14 5/8] qmp: decode feature & status bits in virtio-status
On Fri, Apr 01, 2022 at 09:23:22AM -0400, Jonah Palmer wrote: > From: Laurent Vivier > > Display feature names instead of bitmaps for host, guest, and > backend for VirtIODevices. > > Display status names instead of bitmaps for VirtIODevices. > > Display feature names instead of bitmaps for backend, protocol, > acked, and features (hdev->features) for vhost devices. > > Decode features according to device ID. Decode statuses > according to configuration status bitmap (config_status_map). > Decode vhost user protocol features according to vhost user > protocol bitmap (vhost_user_protocol_map). > > Transport features are on the first line. Undecoded bits (if > any) are stored in a separate field. > > Signed-off-by: Jonah Palmer So this has several problems that I missed previously. First, sign off from poster is missing. > --- > hw/block/virtio-blk.c | 29 > hw/char/virtio-serial-bus.c| 11 ++ > hw/display/virtio-gpu.c| 18 ++ > hw/input/virtio-input.c| 10 ++ > hw/net/virtio-net.c| 47 + > hw/scsi/virtio-scsi.c | 17 ++ > hw/virtio/vhost-user-fs.c | 10 ++ > hw/virtio/vhost-user-i2c.c | 14 ++ > hw/virtio/vhost-vsock-common.c | 10 ++ > hw/virtio/virtio-balloon.c | 14 ++ > hw/virtio/virtio-crypto.c | 10 ++ > hw/virtio/virtio-iommu.c | 14 ++ > hw/virtio/virtio-mem.c | 11 ++ > hw/virtio/virtio.c | 302 - > include/hw/virtio/vhost.h | 3 + > include/hw/virtio/virtio.h | 19 +++ > qapi/virtio.json | 156 ++--- > 17 files changed, 667 insertions(+), 28 deletions(-) > > diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c > index 27c71ad316..f104603040 100644 > --- a/hw/block/virtio-blk.c > +++ b/hw/block/virtio-blk.c > @@ -13,6 +13,7 @@ > > #include "qemu/osdep.h" > #include "qapi/error.h" > +#include "qapi/qapi-visit-virtio.h" > #include "qemu/iov.h" > #include "qemu/module.h" > #include "qemu/error-report.h" > @@ -33,10 +34,38 @@ > #include "migration/qemu-file-types.h" > #include "hw/virtio/virtio-access.h" > #include "qemu/coroutine.h" > +#include "standard-headers/linux/vhost_types.h" > > /* Config size before the discard support (hide associated config fields) */ > #define VIRTIO_BLK_CFG_SIZE offsetof(struct virtio_blk_config, \ > max_discard_sectors) > + > +qmp_virtio_feature_map_t blk_map[] = { > +#define FEATURE_ENTRY(name) \ > +{ VIRTIO_BLK_F_##name, #name } > +FEATURE_ENTRY(SIZE_MAX), > +FEATURE_ENTRY(SEG_MAX), > +FEATURE_ENTRY(GEOMETRY), > +FEATURE_ENTRY(RO), > +FEATURE_ENTRY(BLK_SIZE), > +FEATURE_ENTRY(TOPOLOGY), > +FEATURE_ENTRY(MQ), > +FEATURE_ENTRY(DISCARD), > +FEATURE_ENTRY(WRITE_ZEROES), > +#ifndef VIRTIO_BLK_NO_LEGACY > +FEATURE_ENTRY(BARRIER), > +FEATURE_ENTRY(SCSI), > +FEATURE_ENTRY(FLUSH), > +FEATURE_ENTRY(CONFIG_WCE), > +#endif /* !VIRTIO_BLK_NO_LEGACY */ > +#undef FEATURE_ENTRY > +#define FEATURE_ENTRY(name) \ > +{ VHOST_F_##name, #name } > +FEATURE_ENTRY(LOG_ALL), > +#undef FEATURE_ENTRY > +{ -1, "" } > +}; > + > /* > * Starting from the discard feature, we can use this array to properly > * set the config size depending on the features enabled. > diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c > index 7d4601cb5d..fbb31a2b16 100644 > --- a/hw/char/virtio-serial-bus.c > +++ b/hw/char/virtio-serial-bus.c > @@ -20,6 +20,7 @@ > > #include "qemu/osdep.h" > #include "qapi/error.h" > +#include "qapi/qapi-visit-virtio.h" > #include "qemu/iov.h" > #include "qemu/main-loop.h" > #include "qemu/module.h" > @@ -32,6 +33,16 @@ > #include "hw/virtio/virtio-serial.h" > #include "hw/virtio/virtio-access.h" > > +qmp_virtio_feature_map_t serial_map[] = { > +#define FEATURE_ENTRY(name) \ > +{ VIRTIO_CONSOLE_F_##name, #name } > +FEATURE_ENTRY(SIZE), > +FEATURE_ENTRY(MULTIPORT), > +FEATURE_ENTRY(EMERG_WRITE), > +#undef FEATURE_ENTRY > +{ -1, "" } > +}; > + > static struct VirtIOSerialDevices { > QLIST_HEAD(, VirtIOSerial) devices; > } vserdevices; > diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c > index 529b5246b2..0bd5dc6232 100644 > --- a/hw/display/virtio-gpu.c > +++ b/hw/display/virtio-gpu.c > @@ -29,10 +29,28 @@ > #include "qemu/log.h" > #include "qemu/module.h" > #include "qapi/error.h" > +#include "qapi/qapi-visit-virtio.h" > #include "qemu/error-report.h" > +#include "standard-headers/linux/vhost_types.h" > > #define VIRTIO_GPU_VM_VERSION 1 > > +qmp_virtio_feature_map_t gpu_map[] = { > +#define FEATURE_ENTRY(name) \ > +{ VIRTIO_GPU_F_##name, #name } > +FEATURE_ENTRY(VIRGL), > +FEATURE_ENTRY(EDID), > +FEATURE_ENTRY(RESOURCE_UUID), > +FEATURE_ENTRY(RESOURCE_BLOB), > +FEATURE_ENTRY(CONTEXT_INIT), > +#undef FEATURE_ENTRY > +#define FEATURE_ENTRY(name) \ > +{ VHOST
Re: [PATCH v14 5/8] qmp: decode feature & status bits in virtio-status
On 5/16/22 16:26, Michael S. Tsirkin wrote: On Fri, Apr 01, 2022 at 09:23:22AM -0400, Jonah Palmer wrote: From: Laurent Vivier Display feature names instead of bitmaps for host, guest, and backend for VirtIODevices. Display status names instead of bitmaps for VirtIODevices. Display feature names instead of bitmaps for backend, protocol, acked, and features (hdev->features) for vhost devices. Decode features according to device ID. Decode statuses according to configuration status bitmap (config_status_map). Decode vhost user protocol features according to vhost user protocol bitmap (vhost_user_protocol_map). Transport features are on the first line. Undecoded bits (if any) are stored in a separate field. Signed-off-by: Jonah Palmer So this has several problems that I missed previously. First, sign off from poster is missing. My apologies, will add missing Laurent's SOB in correct order for patches 3-8. --- hw/block/virtio-blk.c | 29 hw/char/virtio-serial-bus.c| 11 ++ hw/display/virtio-gpu.c| 18 ++ hw/input/virtio-input.c| 10 ++ hw/net/virtio-net.c| 47 + hw/scsi/virtio-scsi.c | 17 ++ hw/virtio/vhost-user-fs.c | 10 ++ hw/virtio/vhost-user-i2c.c | 14 ++ hw/virtio/vhost-vsock-common.c | 10 ++ hw/virtio/virtio-balloon.c | 14 ++ hw/virtio/virtio-crypto.c | 10 ++ hw/virtio/virtio-iommu.c | 14 ++ hw/virtio/virtio-mem.c | 11 ++ hw/virtio/virtio.c | 302 - include/hw/virtio/vhost.h | 3 + include/hw/virtio/virtio.h | 19 +++ qapi/virtio.json | 156 ++--- 17 files changed, 667 insertions(+), 28 deletions(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 27c71ad316..f104603040 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qapi-visit-virtio.h" #include "qemu/iov.h" #include "qemu/module.h" #include "qemu/error-report.h" @@ -33,10 +34,38 @@ #include "migration/qemu-file-types.h" #include "hw/virtio/virtio-access.h" #include "qemu/coroutine.h" +#include "standard-headers/linux/vhost_types.h" /* Config size before the discard support (hide associated config fields) */ #define VIRTIO_BLK_CFG_SIZE offsetof(struct virtio_blk_config, \ max_discard_sectors) + +qmp_virtio_feature_map_t blk_map[] = { +#define FEATURE_ENTRY(name) \ +{ VIRTIO_BLK_F_##name, #name } +FEATURE_ENTRY(SIZE_MAX), +FEATURE_ENTRY(SEG_MAX), +FEATURE_ENTRY(GEOMETRY), +FEATURE_ENTRY(RO), +FEATURE_ENTRY(BLK_SIZE), +FEATURE_ENTRY(TOPOLOGY), +FEATURE_ENTRY(MQ), +FEATURE_ENTRY(DISCARD), +FEATURE_ENTRY(WRITE_ZEROES), +#ifndef VIRTIO_BLK_NO_LEGACY +FEATURE_ENTRY(BARRIER), +FEATURE_ENTRY(SCSI), +FEATURE_ENTRY(FLUSH), +FEATURE_ENTRY(CONFIG_WCE), +#endif /* !VIRTIO_BLK_NO_LEGACY */ +#undef FEATURE_ENTRY +#define FEATURE_ENTRY(name) \ +{ VHOST_F_##name, #name } +FEATURE_ENTRY(LOG_ALL), +#undef FEATURE_ENTRY +{ -1, "" } +}; + /* * Starting from the discard feature, we can use this array to properly * set the config size depending on the features enabled. diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index 7d4601cb5d..fbb31a2b16 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qapi-visit-virtio.h" #include "qemu/iov.h" #include "qemu/main-loop.h" #include "qemu/module.h" @@ -32,6 +33,16 @@ #include "hw/virtio/virtio-serial.h" #include "hw/virtio/virtio-access.h" +qmp_virtio_feature_map_t serial_map[] = { +#define FEATURE_ENTRY(name) \ +{ VIRTIO_CONSOLE_F_##name, #name } +FEATURE_ENTRY(SIZE), +FEATURE_ENTRY(MULTIPORT), +FEATURE_ENTRY(EMERG_WRITE), +#undef FEATURE_ENTRY +{ -1, "" } +}; + static struct VirtIOSerialDevices { QLIST_HEAD(, VirtIOSerial) devices; } vserdevices; diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 529b5246b2..0bd5dc6232 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -29,10 +29,28 @@ #include "qemu/log.h" #include "qemu/module.h" #include "qapi/error.h" +#include "qapi/qapi-visit-virtio.h" #include "qemu/error-report.h" +#include "standard-headers/linux/vhost_types.h" #define VIRTIO_GPU_VM_VERSION 1 +qmp_virtio_feature_map_t gpu_map[] = { +#define FEATURE_ENTRY(name) \ +{ VIRTIO_GPU_F_##name, #name } +FEATURE_ENTRY(VIRGL), +FEATURE_ENTRY(EDID), +FEATURE_ENTRY(RESOURCE_UUID), +FEATURE_ENTRY(RESOURCE_BLOB), +FEATURE_ENTRY(CONTEXT_INIT), +#undef FEATURE_ENTRY +#define FEATURE_ENTRY(name) \ +{ VHOST_F_##name, #name } +FEATURE_ENTRY(LOG_ALL), +#undef FEATURE_ENTRY +{ -1, "" } +}; + Now I
Re: [PATCH v14 5/8] qmp: decode feature & status bits in virtio-status
On Thu, May 19, 2022 at 02:30:43AM -0400, Jonah Palmer wrote: > > On 5/16/22 16:26, Michael S. Tsirkin wrote: > > On Fri, Apr 01, 2022 at 09:23:22AM -0400, Jonah Palmer wrote: > > From: Laurent Vivier > > Display feature names instead of bitmaps for host, guest, and > backend for VirtIODevices. > > Display status names instead of bitmaps for VirtIODevices. > > Display feature names instead of bitmaps for backend, protocol, > acked, and features (hdev->features) for vhost devices. > > Decode features according to device ID. Decode statuses > according to configuration status bitmap (config_status_map). > Decode vhost user protocol features according to vhost user > protocol bitmap (vhost_user_protocol_map). > > Transport features are on the first line. Undecoded bits (if > any) are stored in a separate field. > > Signed-off-by: Jonah Palmer > > > So this has several problems that I missed previously. > First, sign off from poster is missing. > > My apologies, will add missing Laurent's SOB in correct order for > patches 3-8. > > > > > > --- > hw/block/virtio-blk.c | 29 > hw/char/virtio-serial-bus.c| 11 ++ > hw/display/virtio-gpu.c| 18 ++ > hw/input/virtio-input.c| 10 ++ > hw/net/virtio-net.c| 47 + > hw/scsi/virtio-scsi.c | 17 ++ > hw/virtio/vhost-user-fs.c | 10 ++ > hw/virtio/vhost-user-i2c.c | 14 ++ > hw/virtio/vhost-vsock-common.c | 10 ++ > hw/virtio/virtio-balloon.c | 14 ++ > hw/virtio/virtio-crypto.c | 10 ++ > hw/virtio/virtio-iommu.c | 14 ++ > hw/virtio/virtio-mem.c | 11 ++ > hw/virtio/virtio.c | 302 > - > include/hw/virtio/vhost.h | 3 + > include/hw/virtio/virtio.h | 19 +++ > qapi/virtio.json | 156 ++--- > 17 files changed, 667 insertions(+), 28 deletions(-) > > diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c > index 27c71ad316..f104603040 100644 > --- a/hw/block/virtio-blk.c > +++ b/hw/block/virtio-blk.c > @@ -13,6 +13,7 @@ > > #include "qemu/osdep.h" > #include "qapi/error.h" > +#include "qapi/qapi-visit-virtio.h" > #include "qemu/iov.h" > #include "qemu/module.h" > #include "qemu/error-report.h" > @@ -33,10 +34,38 @@ > #include "migration/qemu-file-types.h" > #include "hw/virtio/virtio-access.h" > #include "qemu/coroutine.h" > +#include "standard-headers/linux/vhost_types.h" > > /* Config size before the discard support (hide associated config > fields) */ > #define VIRTIO_BLK_CFG_SIZE offsetof(struct virtio_blk_config, \ > max_discard_sectors) > + > +qmp_virtio_feature_map_t blk_map[] = { > +#define FEATURE_ENTRY(name) \ > +{ VIRTIO_BLK_F_##name, #name } > +FEATURE_ENTRY(SIZE_MAX), > +FEATURE_ENTRY(SEG_MAX), > +FEATURE_ENTRY(GEOMETRY), > +FEATURE_ENTRY(RO), > +FEATURE_ENTRY(BLK_SIZE), > +FEATURE_ENTRY(TOPOLOGY), > +FEATURE_ENTRY(MQ), > +FEATURE_ENTRY(DISCARD), > +FEATURE_ENTRY(WRITE_ZEROES), > +#ifndef VIRTIO_BLK_NO_LEGACY > +FEATURE_ENTRY(BARRIER), > +FEATURE_ENTRY(SCSI), > +FEATURE_ENTRY(FLUSH), > +FEATURE_ENTRY(CONFIG_WCE), > +#endif /* !VIRTIO_BLK_NO_LEGACY */ > +#undef FEATURE_ENTRY > +#define FEATURE_ENTRY(name) \ > +{ VHOST_F_##name, #name } > +FEATURE_ENTRY(LOG_ALL), > +#undef FEATURE_ENTRY > +{ -1, "" } > +}; > + > /* > * Starting from the discard feature, we can use this array to > properly > * set the config size depending on the features enabled. > diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c > index 7d4601cb5d..fbb31a2b16 100644 > --- a/hw/char/virtio-serial-bus.c > +++ b/hw/char/virtio-serial-bus.c > @@ -20,6 +20,7 @@ > > #include "qemu/osdep.h" > #include "qapi/error.h" > +#include "qapi/qapi-visit-virtio.h" > #include "qemu/iov.h" > #include "qemu/main-loop.h" > #include "qemu/module.h" > @@ -32,6 +33,16 @@ > #include "hw/virtio/virtio-serial.h" > #include "hw/virtio/virtio-access.h" > > +qmp_virtio_feature_map_t serial_map[] = { > +#define FEATURE_ENTRY(name) \ > +{ VIRTIO_CONSOLE_F_##name, #name } >
Re: [PATCH v14 5/8] qmp: decode feature & status bits in virtio-status
On Thu, May 19, 2022 at 02:30:43AM -0400, Jonah Palmer wrote: > > On 5/16/22 16:26, Michael S. Tsirkin wrote: > > On Fri, Apr 01, 2022 at 09:23:22AM -0400, Jonah Palmer wrote: > > From: Laurent Vivier > > Display feature names instead of bitmaps for host, guest, and > backend for VirtIODevices. > > Display status names instead of bitmaps for VirtIODevices. > > Display feature names instead of bitmaps for backend, protocol, > acked, and features (hdev->features) for vhost devices. > > Decode features according to device ID. Decode statuses > according to configuration status bitmap (config_status_map). > Decode vhost user protocol features according to vhost user > protocol bitmap (vhost_user_protocol_map). > > Transport features are on the first line. Undecoded bits (if > any) are stored in a separate field. > > Signed-off-by: Jonah Palmer > > > So this has several problems that I missed previously. > First, sign off from poster is missing. > > My apologies, will add missing Laurent's SOB in correct order for > patches 3-8. Were you going to repost? > > > > > --- > hw/block/virtio-blk.c | 29 > hw/char/virtio-serial-bus.c| 11 ++ > hw/display/virtio-gpu.c| 18 ++ > hw/input/virtio-input.c| 10 ++ > hw/net/virtio-net.c| 47 + > hw/scsi/virtio-scsi.c | 17 ++ > hw/virtio/vhost-user-fs.c | 10 ++ > hw/virtio/vhost-user-i2c.c | 14 ++ > hw/virtio/vhost-vsock-common.c | 10 ++ > hw/virtio/virtio-balloon.c | 14 ++ > hw/virtio/virtio-crypto.c | 10 ++ > hw/virtio/virtio-iommu.c | 14 ++ > hw/virtio/virtio-mem.c | 11 ++ > hw/virtio/virtio.c | 302 > - > include/hw/virtio/vhost.h | 3 + > include/hw/virtio/virtio.h | 19 +++ > qapi/virtio.json | 156 ++--- > 17 files changed, 667 insertions(+), 28 deletions(-) > > diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c > index 27c71ad316..f104603040 100644 > --- a/hw/block/virtio-blk.c > +++ b/hw/block/virtio-blk.c > @@ -13,6 +13,7 @@ > > #include "qemu/osdep.h" > #include "qapi/error.h" > +#include "qapi/qapi-visit-virtio.h" > #include "qemu/iov.h" > #include "qemu/module.h" > #include "qemu/error-report.h" > @@ -33,10 +34,38 @@ > #include "migration/qemu-file-types.h" > #include "hw/virtio/virtio-access.h" > #include "qemu/coroutine.h" > +#include "standard-headers/linux/vhost_types.h" > > /* Config size before the discard support (hide associated config > fields) */ > #define VIRTIO_BLK_CFG_SIZE offsetof(struct virtio_blk_config, \ > max_discard_sectors) > + > +qmp_virtio_feature_map_t blk_map[] = { > +#define FEATURE_ENTRY(name) \ > +{ VIRTIO_BLK_F_##name, #name } > +FEATURE_ENTRY(SIZE_MAX), > +FEATURE_ENTRY(SEG_MAX), > +FEATURE_ENTRY(GEOMETRY), > +FEATURE_ENTRY(RO), > +FEATURE_ENTRY(BLK_SIZE), > +FEATURE_ENTRY(TOPOLOGY), > +FEATURE_ENTRY(MQ), > +FEATURE_ENTRY(DISCARD), > +FEATURE_ENTRY(WRITE_ZEROES), > +#ifndef VIRTIO_BLK_NO_LEGACY > +FEATURE_ENTRY(BARRIER), > +FEATURE_ENTRY(SCSI), > +FEATURE_ENTRY(FLUSH), > +FEATURE_ENTRY(CONFIG_WCE), > +#endif /* !VIRTIO_BLK_NO_LEGACY */ > +#undef FEATURE_ENTRY > +#define FEATURE_ENTRY(name) \ > +{ VHOST_F_##name, #name } > +FEATURE_ENTRY(LOG_ALL), > +#undef FEATURE_ENTRY > +{ -1, "" } > +}; > + > /* > * Starting from the discard feature, we can use this array to > properly > * set the config size depending on the features enabled. > diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c > index 7d4601cb5d..fbb31a2b16 100644 > --- a/hw/char/virtio-serial-bus.c > +++ b/hw/char/virtio-serial-bus.c > @@ -20,6 +20,7 @@ > > #include "qemu/osdep.h" > #include "qapi/error.h" > +#include "qapi/qapi-visit-virtio.h" > #include "qemu/iov.h" > #include "qemu/main-loop.h" > #include "qemu/module.h" > @@ -32,6 +33,16 @@ > #include "hw/virtio/virtio-serial.h" > #include "hw/virtio/virtio-access.h" > > +qmp_virtio_feature_map_t serial_map[] = { > +#define FEATURE_ENTRY(name) \ > +{ VIRTIO_CONSOLE_F
Re: [PATCH v14 5/8] qmp: decode feature & status bits in virtio-status
On 6/10/22 01:41, Michael S. Tsirkin wrote: On Thu, May 19, 2022 at 02:30:43AM -0400, Jonah Palmer wrote: On 5/16/22 16:26, Michael S. Tsirkin wrote: On Fri, Apr 01, 2022 at 09:23:22AM -0400, Jonah Palmer wrote: From: Laurent Vivier Display feature names instead of bitmaps for host, guest, and backend for VirtIODevices. Display status names instead of bitmaps for VirtIODevices. Display feature names instead of bitmaps for backend, protocol, acked, and features (hdev->features) for vhost devices. Decode features according to device ID. Decode statuses according to configuration status bitmap (config_status_map). Decode vhost user protocol features according to vhost user protocol bitmap (vhost_user_protocol_map). Transport features are on the first line. Undecoded bits (if any) are stored in a separate field. Signed-off-by: Jonah Palmer So this has several problems that I missed previously. First, sign off from poster is missing. My apologies, will add missing Laurent's SOB in correct order for patches 3-8. Were you going to repost? Yes, and sorry for the delay. Trying to get these out ASAP. Jonah --- hw/block/virtio-blk.c | 29 hw/char/virtio-serial-bus.c| 11 ++ hw/display/virtio-gpu.c| 18 ++ hw/input/virtio-input.c| 10 ++ hw/net/virtio-net.c| 47 + hw/scsi/virtio-scsi.c | 17 ++ hw/virtio/vhost-user-fs.c | 10 ++ hw/virtio/vhost-user-i2c.c | 14 ++ hw/virtio/vhost-vsock-common.c | 10 ++ hw/virtio/virtio-balloon.c | 14 ++ hw/virtio/virtio-crypto.c | 10 ++ hw/virtio/virtio-iommu.c | 14 ++ hw/virtio/virtio-mem.c | 11 ++ hw/virtio/virtio.c | 302 - include/hw/virtio/vhost.h | 3 + include/hw/virtio/virtio.h | 19 +++ qapi/virtio.json | 156 ++--- 17 files changed, 667 insertions(+), 28 deletions(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 27c71ad316..f104603040 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qapi-visit-virtio.h" #include "qemu/iov.h" #include "qemu/module.h" #include "qemu/error-report.h" @@ -33,10 +34,38 @@ #include "migration/qemu-file-types.h" #include "hw/virtio/virtio-access.h" #include "qemu/coroutine.h" +#include "standard-headers/linux/vhost_types.h" /* Config size before the discard support (hide associated config fields) */ #define VIRTIO_BLK_CFG_SIZE offsetof(struct virtio_blk_config, \ max_discard_sectors) + +qmp_virtio_feature_map_t blk_map[] = { +#define FEATURE_ENTRY(name) \ +{ VIRTIO_BLK_F_##name, #name } +FEATURE_ENTRY(SIZE_MAX), +FEATURE_ENTRY(SEG_MAX), +FEATURE_ENTRY(GEOMETRY), +FEATURE_ENTRY(RO), +FEATURE_ENTRY(BLK_SIZE), +FEATURE_ENTRY(TOPOLOGY), +FEATURE_ENTRY(MQ), +FEATURE_ENTRY(DISCARD), +FEATURE_ENTRY(WRITE_ZEROES), +#ifndef VIRTIO_BLK_NO_LEGACY +FEATURE_ENTRY(BARRIER), +FEATURE_ENTRY(SCSI), +FEATURE_ENTRY(FLUSH), +FEATURE_ENTRY(CONFIG_WCE), +#endif /* !VIRTIO_BLK_NO_LEGACY */ +#undef FEATURE_ENTRY +#define FEATURE_ENTRY(name) \ +{ VHOST_F_##name, #name } +FEATURE_ENTRY(LOG_ALL), +#undef FEATURE_ENTRY +{ -1, "" } +}; + /* * Starting from the discard feature, we can use this array to properly * set the config size depending on the features enabled. diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index 7d4601cb5d..fbb31a2b16 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qapi-visit-virtio.h" #include "qemu/iov.h" #include "qemu/main-loop.h" #include "qemu/module.h" @@ -32,6 +33,16 @@ #include "hw/virtio/virtio-serial.h" #include "hw/virtio/virtio-access.h" +qmp_virtio_feature_map_t serial_map[] = { +#define FEATURE_ENTRY(name) \ +{ VIRTIO_CONSOLE_F_##name, #name } +FEATURE_E