[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH 01/12] plat/virtio: Skeleton for virtio block driver
This patch introduces the virtio block driver skeleton. Signed-off-by: Roxana Nicolescu <nicolescu.roxana1996@xxxxxxxxx> --- plat/drivers/virtio/virtio_blk.c | 59 ++++++++++++++++++++++++++++++++++++++++ plat/kvm/Config.uk | 9 ++++++ plat/kvm/Makefile.uk | 12 ++++++++ 3 files changed, 80 insertions(+) create mode 100644 plat/drivers/virtio/virtio_blk.c diff --git a/plat/drivers/virtio/virtio_blk.c b/plat/drivers/virtio/virtio_blk.c new file mode 100644 index 00000000..296f99a8 --- /dev/null +++ b/plat/drivers/virtio/virtio_blk.c @@ -0,0 +1,59 @@ +/* + * Authors: Roxana Nicolescu <nicolescu.roxana1996@xxxxxxxxx> + * + * Copyright (c) 2019, University Politehnica of Bucharest. + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted, provided + * that the above copyright notice and this permission notice appear + * in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ +/* Taken and adapted from virtio-net because of consistency reason. */ + +#include <virtio/virtio_bus.h> +#include <virtio/virtio_ids.h> + +#define DRIVER_NAME "virtio-blk" + +static struct uk_alloc *a; +static const char *drv_name = DRIVER_NAME; + +static int virtio_blk_add_dev(struct virtio_dev *vdev) +{ + int rc = 0; + + UK_ASSERT(vdev != NULL); + + return rc; +} + +static int virtio_blk_drv_init(struct uk_alloc *drv_allocator) +{ + /* driver initialization */ + if (!drv_allocator) + return -EINVAL; + + a = drv_allocator; + return 0; +} + +static const struct virtio_dev_id vblk_dev_id[] = { + {VIRTIO_ID_BLOCK}, + {VIRTIO_ID_INVALID} /* List Terminator */ +}; + +static struct virtio_driver vblk_drv = { + .dev_ids = vblk_dev_id, + .init = virtio_blk_drv_init, + .add_dev = virtio_blk_add_dev +}; +VIRTIO_BUS_REGISTER_DRIVER(&vblk_drv); diff --git a/plat/kvm/Config.uk b/plat/kvm/Config.uk index 5a6dfc14..5697016f 100644 --- a/plat/kvm/Config.uk +++ b/plat/kvm/Config.uk @@ -79,5 +79,14 @@ config VIRTIO_NET select LIBUKSGLIST help Virtual network driver. + +config VIRTIO_BLK + bool "Virtio Block device" + default n + depends on LIBUKBLKDEV + select VIRTIO_BUS + select LIBUKSGLIST + help + Virtual block driver. endmenu endif diff --git a/plat/kvm/Makefile.uk b/plat/kvm/Makefile.uk index 633348ab..048f72b3 100644 --- a/plat/kvm/Makefile.uk +++ b/plat/kvm/Makefile.uk @@ -10,6 +10,7 @@ $(eval $(call addplatlib,kvm,libkvmplat)) $(eval $(call addplatlib_s,kvm,libkvmpci,$(CONFIG_KVM_PCI))) $(eval $(call addplatlib_s,kvm,libkvmvirtio,$(CONFIG_VIRTIO_BUS))) $(eval $(call addplatlib_s,kvm,libkvmvirtionet,$(CONFIG_VIRTIO_NET))) +$(eval $(call addplatlib_s,kvm,libkvmvirtioblk,$(CONFIG_VIRTIO_BLK))) ## ## Platform library definitions @@ -115,3 +116,14 @@ LIBKVMVIRTIONET_ASINCLUDES-y += -I$(UK_PLAT_DRIVERS_BASE)/include LIBKVMVIRTIONET_CINCLUDES-y += -I$(UK_PLAT_DRIVERS_BASE)/include LIBKVMVIRTIONET_SRCS-y +=\ $(UK_PLAT_DRIVERS_BASE)/virtio/virtio_net.c +## +## Virtio Blk library definition +## +LIBKVMVIRTIOBLK_ASINCLUDES-y += -I$(LIBKVMPLAT_BASE)/include +LIBKVMVIRTIOBLK_CINCLUDES-y += -I$(LIBKVMPLAT_BASE)/include +LIBKVMVIRTIOBLK_ASINCLUDES-y += -I$(UK_PLAT_COMMON_BASE)/include +LIBKVMVIRTIOBLK_CINCLUDES-y += -I$(UK_PLAT_COMMON_BASE)/include +LIBKVMVIRTIOBLK_ASINCLUDES-y += -I$(UK_PLAT_DRIVERS_BASE)/include +LIBKVMVIRTIOBLK_CINCLUDES-y += -I$(UK_PLAT_DRIVERS_BASE)/include +LIBKVMVIRTIOBLK_SRCS-y +=\ + $(UK_PLAT_DRIVERS_BASE)/virtio/virtio_blk.c -- 2.11.0 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |