virtio: further feature bit cleanup
cover virtio: further feature bit cleanup
We can git rid of most of the feature bit manipulation by transports (except virtio-pci needing to advertise BAD_FEATURE).
Passed sniff tests with virtio-ccw and s390-virtio.
Patches are on top of "virtio: move host_features".
Cornelia Huck (2):
virtio-ccw: Don't advertise VIRTIO_F_BAD_FEATURE
virtio: move VIRTIO_F_NOTIFY_ON_EMPTY into core
hw/s390x/virtio-ccw.c | 4 ---- hw/virtio/virtio-mmio.c | 10 ---------- hw/virtio/virtio-pci.c | 1 - include/hw/virtio/virtio.h | 10 ++++++---- 4 files changed, 6 insertions(+), 19 deletions(-)
Signature · 1 line
2.3.7
PATCH 1/2 virtio-ccw: Don't advertise VIRTIO_F_BAD_FEATURE
This was copied from virtio-pci, but it doesn't make much sense for ccw, as it doesn't have to handle the broken implementations this bit is supposed to deal with. Remove it.
--- hw/s390x/virtio-ccw.c | 1 - 1 file changed, 1 deletion(-)
hw/s390x/virtio-ccw.c +0 -1
@@ -1414,7 +1414,6 @@ static void virtio_ccw_device_plugged(DeviceState *d) sch->id.cu_model =virtio_bus_get_vdev_id (&dev->bus);virtio_add_feature (&vdev->host_features,VIRTIO_F_NOTIFY_ON_EMPTY ); -virtio_add_feature (&vdev->host_features,VIRTIO_F_BAD_FEATURE );css_generate_sch_crws (sch->cssid, sch->ssid, sch->schid, d->hotplugged,1 );
Signature · 1 line
2.3.7
PATCH 2/2 virtio: move VIRTIO_F_NOTIFY_ON_EMPTY into core
In reply to Cornelia HuckNearly all transports have been offering VIRTIO_F_NOTIFY_ON_EMPTY, s390-virtio being the exception. There's no reason why it shouldn't offer it as well, though (handling is done in core anyway), so let's move it to the common virtio features.
While we're changing it anyway, fix the indentation for the DEFINE_VIRTIO_COMMON_FEATURES macro.
--- hw/s390x/virtio-ccw.c | 3 --- hw/virtio/virtio-mmio.c | 10 ---------- hw/virtio/virtio-pci.c | 1 - include/hw/virtio/virtio.h | 10 ++++++---- 4 files changed, 6 insertions(+), 18 deletions(-)
hw/s390x/virtio-ccw.c +0 -3
@@ -1409,12 +1409,9 @@ static void virtio_ccw_device_plugged(DeviceState *d) {VirtioCcwDevice *dev =VIRTIO_CCW_DEVICE (d);SubchDev *sch = dev->sch; -VirtIODevice *vdev =virtio_ccw_get_vdev (sch); sch->id.cu_model =virtio_bus_get_vdev_id (&dev->bus); -virtio_add_feature (&vdev->host_features,VIRTIO_F_NOTIFY_ON_EMPTY ); -css_generate_sch_crws (sch->cssid, sch->ssid, sch->schid, d->hotplugged,1 ); }
hw/virtio/virtio-mmio.c +0 -10
@@ -336,15 +336,6 @@ static void virtio_mmio_reset(DeviceState *d)/* virtio-mmio device */ -/* This is called by virtio-bus just after the device is plugged. */ -static void virtio_mmio_device_plugged (DeviceState *opaque) -{ -VirtIOMMIOProxy *proxy =VIRTIO_MMIO (opaque); -VirtIODevice *vdev =virtio_bus_get_device (&proxy->bus); - -virtio_add_feature (&vdev->host_features,VIRTIO_F_NOTIFY_ON_EMPTY ); -} -static void virtio_mmio_realizefn (DeviceState *d,Error **errp) {VirtIOMMIOProxy *proxy =VIRTIO_MMIO (d);
@@ -384,7 +375,6 @@ static void virtio_mmio_bus_class_init(ObjectClass *klass, void *data) k->notify = virtio_mmio_update_irq; k->save_config = virtio_mmio_save_config; k->load_config = virtio_mmio_load_config; - k->device_plugged = virtio_mmio_device_plugged; k->has_variable_vring_alignment = true; bus_class->max_dev =1 ; }
hw/virtio/virtio-pci.c +0 -1
@@ -953,7 +953,6 @@ static void virtio_pci_device_plugged(DeviceState *d) proxy->flags &= ~VIRTIO_PCI_FLAG_USE_IOEVENTFD ; } -virtio_add_feature (&vdev->host_features,VIRTIO_F_NOTIFY_ON_EMPTY );virtio_add_feature (&vdev->host_features,VIRTIO_F_BAD_FEATURE ); }
include/hw/virtio/virtio.h +6 -4
@@ -193,10 +193,12 @@ typedef struct VirtIOSCSIConf VirtIOSCSIConf;typedef struct VirtIORNGConf VirtIORNGConf ;#define DEFINE_VIRTIO_COMMON_FEATURES (_state, _field) \ - DEFINE_PROP_BIT("indirect_desc", _state, _field, \ - VIRTIO_RING_F_INDIRECT_DESC, true), \ - DEFINE_PROP_BIT("event_idx", _state, _field, \ - VIRTIO_RING_F_EVENT_IDX, true) + DEFINE_PROP_BIT("indirect_desc", _state, _field, \ + VIRTIO_RING_F_INDIRECT_DESC, true), \ + DEFINE_PROP_BIT("event_idx", _state, _field, \ + VIRTIO_RING_F_EVENT_IDX, true), \ + DEFINE_PROP_BIT("notify_on_empty", _state, _field, \ + VIRTIO_F_NOTIFY_ON_EMPTY, true)hwaddr virtio_queue_get_desc_addr (VirtIODevice *vdev,int n);hwaddr virtio_queue_get_avail_addr (VirtIODevice *vdev,int n);
Signature · 1 line
2.3.7