summaryrefslogtreecommitdiffstats
path: root/drivers/virtio
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2009-06-12 22:16:35 -0600
committerRusty Russell <rusty@rustcorp.com.au>2009-06-12 22:16:35 +0930
commitef688e151c00e5d529703be9a04fd506df8bc54e (patch)
tree841d0b0bcd8a5f72f8d8bdc455672d9a6e7468ca /drivers/virtio
parent20f77f5654042cf484d8964b618faf9d620f639b (diff)
downloadblackbird-op-linux-ef688e151c00e5d529703be9a04fd506df8bc54e.tar.gz
blackbird-op-linux-ef688e151c00e5d529703be9a04fd506df8bc54e.zip
virtio: meet virtio spec by finalizing features before using device
Virtio devices are supposed to negotiate features before they start using the device, but the current code doesn't do this. This is because the driver's probe() function invariably has to add buffers to a virtqueue, or probe the disk (virtio_blk). This currently doesn't matter since no existing backend is strict about the feature negotiation. But it's possible to imagine a future feature which completely changes how a device operates: in this case, we'd need to acknowledge it before using the device. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/virtio')
-rw-r--r--drivers/virtio/virtio.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index 018c070a357f..6b6810364860 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -118,13 +118,14 @@ static int virtio_dev_probe(struct device *_d)
if (device_features & (1 << i))
set_bit(i, dev->features);
+ dev->config->finalize_features(dev);
+
err = drv->probe(dev);
if (err)
add_status(dev, VIRTIO_CONFIG_S_FAILED);
- else {
- dev->config->finalize_features(dev);
+ else
add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK);
- }
+
return err;
}
OpenPOWER on IntegriCloud