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

Re: [Minios-devel] [UNIKRAFT PATCH v3 03/14] plat/virtio: Skeleton for virtio block driver


  • To: Roxana Nicolescu <nicolescu.roxana1996@xxxxxxxxx>, "minios-devel@xxxxxxxxxxxxx" <minios-devel@xxxxxxxxxxxxx>
  • From: Justin He <Justin.He@xxxxxxx>
  • Date: Wed, 11 Mar 2020 01:38:21 +0000
  • Accept-language: en-US, zh-CN
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ouIJEMx851Xy03EWSy2cxATxV7l1CE8B4vAL/y0HRkI=; b=MJjSxYk6vr8ZNdKbyXYI739Bqq5ZmIYpKwhHvtTYts8GiZW524WqlUZGdBg+aL/UO/lAruM4jnzGJlsp1t8sflqeucSfuvJxpeTPrhK3kHNs86V+S2BuUSiHx3d2NO6EVL0N/+g/ArAPi7NcfjIbrBzGJ8SCUEHCva0RI2la2s477bv2foBoL+efOVS3uLxdbraoO+xKOrzyGA427hGGyBI0LdyVWa1VRtE3DG3Fpbm6eEm9tKc6AXjQhXwSpXZ4kYqFqj5pSQZzwP45acYD4DwZD1EwM1n0pYCcsf6Qbl9peBLAhRuPan81QeNIhU30Z1CmJsn/6aIRRoBDyKTnuw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oPNZoP8hlw+YLGPffy5qK3ue8fedbfuOm4DqnnWF2yJFNAkwGuIW33SAAQIgRupvaeY1jnmZ7YRZDnK5SYmC1OW/ZC3soSXVsIOXH4lARf1D4f0dpIcu+i2v5RZ9ldujz9eRXoRUkl5RmvlUWWHj2u4kyT1CRnBbxEFTehsmuUnS0AYKGG7bI7yW9o1G5Yt7mOlbCG2G4VPzPLwIbHeCiHB6e84egHtXF5Dpn2bu3RX46/dESq0t9zjFs3zndY6Bu3S2DsZXASaBiTFkNt5qBOT8B3P+CmP7m2EIvLsu7ohv2/KBYBpdmlAsq1dEkIno3JeFoogp0h72yJtRA6pQ+A==
  • Authentication-results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.xen.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xen.org; dmarc=bestguesspass action=none header.from=arm.com;
  • Authentication-results-original: spf=none (sender IP is ) smtp.mailfrom=Justin.He@xxxxxxx;
  • Cc: Felipe Huici <Felipe.Huici@xxxxxxxxx>, Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
  • Delivery-date: Wed, 11 Mar 2020 01:38:35 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: spf=none (sender IP is ) smtp.mailfrom=Justin.He@xxxxxxx;
  • Thread-index: AQHV8yzvNTqcas5dDUaiUFBVKh8RtKhCpBLQ
  • Thread-topic: [UNIKRAFT PATCH v3 03/14] plat/virtio: Skeleton for virtio block driver

LGTM except for the license statement. I thought Simon or Felipe need to
review the license part. Others e.g. functional, LGTM

Reviewed-by: Jia He <justin.he@xxxxxxx>

--
Cheers,
Justin (Jia He)


> -----Original Message-----
> From: Roxana Nicolescu <nicolescu.roxana1996@xxxxxxxxx>
> Sent: Friday, March 6, 2020 4:30 AM
> To: minios-devel@xxxxxxxxxxxxx
> Cc: Justin He <Justin.He@xxxxxxx>; Roxana Nicolescu
> <nicolescu.roxana1996@xxxxxxxxx>
> Subject: [UNIKRAFT PATCH v3 03/14] 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 | 58 ++++++++++++++++++++++++++++++++
>  plat/kvm/Config.uk               | 12 ++++++-
>  plat/kvm/Makefile.uk             | 12 +++++++
>  3 files changed, 81 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..89fd1779
> --- /dev/null
> +++ b/plat/drivers/virtio/virtio_blk.c
> @@ -0,0 +1,58 @@
> +/*
> + * 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 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 432cdd95..9aa8a632 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
> @@ -83,6 +83,16 @@ config VIRTIO_NET
>         help
>                Virtual network 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.
> +
>  config VIRTIO_9P
>         bool "Virtio 9P device"
>         default y if LIBUK9P
> diff --git a/plat/kvm/Makefile.uk b/plat/kvm/Makefile.uk
> index 63ed9950..7f07f22f 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)))
>  $(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)))
> @@ -139,6 +140,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

IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

_______________________________________________
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®.