virtio: cull virtio_bus_set_vdev_features
The only user of this function was virtio-ccw, and it should use virtio_set_features() like everybody else: We need to make sure that bad features are masked out properly, which this function did not do. Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
ad67a0f278
commit
a590fd5ba8
|
@ -400,8 +400,7 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)
|
||||||
ccw.cda + sizeof(features.features));
|
ccw.cda + sizeof(features.features));
|
||||||
features.features = ldl_le_phys(&address_space_memory, ccw.cda);
|
features.features = ldl_le_phys(&address_space_memory, ccw.cda);
|
||||||
if (features.index < ARRAY_SIZE(dev->host_features)) {
|
if (features.index < ARRAY_SIZE(dev->host_features)) {
|
||||||
virtio_bus_set_vdev_features(&dev->bus, features.features);
|
virtio_set_features(vdev, features.features);
|
||||||
vdev->guest_features = features.features;
|
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* If the guest supports more feature bits, assert that it
|
* If the guest supports more feature bits, assert that it
|
||||||
|
|
|
@ -109,20 +109,6 @@ uint32_t virtio_bus_get_vdev_features(VirtioBusState *bus,
|
||||||
return k->get_features(vdev, requested_features);
|
return k->get_features(vdev, requested_features);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the features of the plugged device. */
|
|
||||||
void virtio_bus_set_vdev_features(VirtioBusState *bus,
|
|
||||||
uint32_t requested_features)
|
|
||||||
{
|
|
||||||
VirtIODevice *vdev = virtio_bus_get_device(bus);
|
|
||||||
VirtioDeviceClass *k;
|
|
||||||
|
|
||||||
assert(vdev != NULL);
|
|
||||||
k = VIRTIO_DEVICE_GET_CLASS(vdev);
|
|
||||||
if (k->set_features != NULL) {
|
|
||||||
k->set_features(vdev, requested_features);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get bad features of the plugged device. */
|
/* Get bad features of the plugged device. */
|
||||||
uint32_t virtio_bus_get_vdev_bad_features(VirtioBusState *bus)
|
uint32_t virtio_bus_get_vdev_bad_features(VirtioBusState *bus)
|
||||||
{
|
{
|
||||||
|
|
|
@ -84,9 +84,6 @@ size_t virtio_bus_get_vdev_config_len(VirtioBusState *bus);
|
||||||
/* Get the features of the plugged device. */
|
/* Get the features of the plugged device. */
|
||||||
uint32_t virtio_bus_get_vdev_features(VirtioBusState *bus,
|
uint32_t virtio_bus_get_vdev_features(VirtioBusState *bus,
|
||||||
uint32_t requested_features);
|
uint32_t requested_features);
|
||||||
/* Set the features of the plugged device. */
|
|
||||||
void virtio_bus_set_vdev_features(VirtioBusState *bus,
|
|
||||||
uint32_t requested_features);
|
|
||||||
/* Get bad features of the plugged device. */
|
/* Get bad features of the plugged device. */
|
||||||
uint32_t virtio_bus_get_vdev_bad_features(VirtioBusState *bus);
|
uint32_t virtio_bus_get_vdev_bad_features(VirtioBusState *bus);
|
||||||
/* Get config of the plugged device. */
|
/* Get config of the plugged device. */
|
||||||
|
|
Loading…
Reference in a new issue