[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH v2 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 | 12 ++++++- plat/kvm/Makefile.uk | 12 +++++++ 3 files changed, 82 insertions(+), 1 deletion(-) 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 47ae8e2f..6e404b94 100644 --- a/plat/kvm/Config.uk +++ b/plat/kvm/Config.uk @@ -65,7 +65,7 @@ config VIRTIO_BUS menu "Virtio" config VIRTIO_PCI bool "Virtio PCI device support" - default y if (VIRTIO_NET || VIRTIO_9P) + default y if (VIRTIO_NET || VIRTIO_9P || VIRTIO_BLK) default n depends on KVM_PCI select VIRTIO_BUS @@ -93,6 +93,16 @@ config VIRTIO_9P select LIBUKSGLIST help Virtio 9P driver. + +config VIRTIO_BLK + bool "Virtio Block Device" + default y if LIBUKBLKDEV + default n + depends on LIBUKBLKDEV + select VIRTIO_BUS + select LIBUKGLIST + help + Virtual block driver. endmenu config LIBGICV2 diff --git a/plat/kvm/Makefile.uk b/plat/kvm/Makefile.uk index e3910435..f520c8db 100644 --- a/plat/kvm/Makefile.uk +++ b/plat/kvm/Makefile.uk @@ -13,6 +13,7 @@ $(eval $(call addplatlib_s,kvm,libkvmvirtionet,$(CONFIG_VIRTIO_NET))) $(eval $(call addplatlib_s,kvm,libkvmvirtio9p,$(CONFIG_VIRTIO_9P))) $(eval $(call addplatlib_s,kvm,libkvmofw,$(CONFIG_LIBOFW))) $(eval $(call addplatlib_s,kvm,libkvmgicv2,$(CONFIG_LIBGICV2))) +$(eval $(call addplatlib_s,kvm,libkvmvirtioblk,$(CONFIG_VIRTIO_BLK))) ## ## Platform library definitions @@ -130,6 +131,17 @@ 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 ## ## Virtio 9P library definition -- 2.17.1 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |