virtio: set FEATURES_OK
set FEATURES_OK as per virtio 1.0 spec Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
This commit is contained in:
Родитель
8906265215
Коммит
cb3f6d9da4
|
@ -160,6 +160,7 @@ static int virtio_dev_probe(struct device *_d)
|
||||||
struct virtio_device *dev = dev_to_virtio(_d);
|
struct virtio_device *dev = dev_to_virtio(_d);
|
||||||
struct virtio_driver *drv = drv_to_virtio(dev->dev.driver);
|
struct virtio_driver *drv = drv_to_virtio(dev->dev.driver);
|
||||||
u64 device_features;
|
u64 device_features;
|
||||||
|
unsigned status;
|
||||||
|
|
||||||
/* We have a driver! */
|
/* We have a driver! */
|
||||||
add_status(dev, VIRTIO_CONFIG_S_DRIVER);
|
add_status(dev, VIRTIO_CONFIG_S_DRIVER);
|
||||||
|
@ -183,18 +184,32 @@ static int virtio_dev_probe(struct device *_d)
|
||||||
|
|
||||||
dev->config->finalize_features(dev);
|
dev->config->finalize_features(dev);
|
||||||
|
|
||||||
err = drv->probe(dev);
|
if (virtio_has_feature(dev, VIRTIO_F_VERSION_1)) {
|
||||||
if (err)
|
add_status(dev, VIRTIO_CONFIG_S_FEATURES_OK);
|
||||||
add_status(dev, VIRTIO_CONFIG_S_FAILED);
|
status = dev->config->get_status(dev);
|
||||||
else {
|
if (!(status & VIRTIO_CONFIG_S_FEATURES_OK)) {
|
||||||
add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK);
|
dev_err(_d, "virtio: device refuses features: %x\n",
|
||||||
if (drv->scan)
|
status);
|
||||||
drv->scan(dev);
|
err = -ENODEV;
|
||||||
|
goto err;
|
||||||
virtio_config_enable(dev);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = drv->probe(dev);
|
||||||
|
if (err)
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK);
|
||||||
|
if (drv->scan)
|
||||||
|
drv->scan(dev);
|
||||||
|
|
||||||
|
virtio_config_enable(dev);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
err:
|
||||||
|
add_status(dev, VIRTIO_CONFIG_S_FAILED);
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int virtio_dev_remove(struct device *_d)
|
static int virtio_dev_remove(struct device *_d)
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
#define VIRTIO_CONFIG_S_DRIVER 2
|
#define VIRTIO_CONFIG_S_DRIVER 2
|
||||||
/* Driver has used its parts of the config, and is happy */
|
/* Driver has used its parts of the config, and is happy */
|
||||||
#define VIRTIO_CONFIG_S_DRIVER_OK 4
|
#define VIRTIO_CONFIG_S_DRIVER_OK 4
|
||||||
|
/* Driver has finished configuring features */
|
||||||
|
#define VIRTIO_CONFIG_S_FEATURES_OK 8
|
||||||
/* We've given up on this device. */
|
/* We've given up on this device. */
|
||||||
#define VIRTIO_CONFIG_S_FAILED 0x80
|
#define VIRTIO_CONFIG_S_FAILED 0x80
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче