[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH 08/12] plat/drivers: Start virtio block device



This patch introduces start/stop operations to virtio device.
This implies connection to backend by setting the DRIVER_OK status bit.

Signed-off-by: Roxana Nicolescu <nicolescu.roxana1996@xxxxxxxxx>
---
 plat/drivers/virtio/virtio_blk.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/plat/drivers/virtio/virtio_blk.c b/plat/drivers/virtio/virtio_blk.c
index fadca07a..e18ef805 100644
--- a/plat/drivers/virtio/virtio_blk.c
+++ b/plat/drivers/virtio/virtio_blk.c
@@ -378,6 +378,37 @@ exit:
        return rc;
 }
 
+static int virtio_blkdev_start(struct uk_blkdev *dev)
+{
+       struct virtio_blk_device *d;
+
+       UK_ASSERT(dev != NULL);
+
+       d = to_virtioblkdev(dev);
+       virtio_dev_drv_up(d->vdev);
+
+       uk_pr_info(DRIVER_NAME": %"__PRIu16" started\n", d->uid);
+
+       return 0;
+}
+
+static int virtio_blkdev_stop(struct uk_blkdev *dev)
+{
+       struct virtio_blk_device *d;
+       int rc = 0;
+
+       UK_ASSERT(dev != NULL);
+
+       d = to_virtioblkdev(dev);
+       rc = virtio_dev_reset(d->vdev);
+       if (rc) {
+               uk_pr_info(DRIVER_NAME": %"__PRIu16" stopped", d->uid);
+               goto out;
+       }
+
+       uk_pr_warn(DRIVER_NAME": %"__PRIu16" Start is not allowed!!!", d->uid);
+
+out:
        return rc;
 }
 
@@ -538,6 +569,8 @@ static const struct uk_blkdev_ops virtio_blkdev_ops = {
                .queue_get_info = virtio_blkdev_queue_info_get,
                .queue_setup = virtio_blkdev_queue_setup,
                .queue_intr_enable = virtio_blkdev_queue_intr_enable,
+               .dev_start = virtio_blkdev_start,
+               .dev_stop = virtio_blkdev_stop,
                .queue_intr_disable = virtio_blkdev_queue_intr_disable,
                .queue_release = virtio_blkdev_queue_release,
                .dev_close = virtio_blkdev_close,
-- 
2.11.0


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.