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

Re: [Minios-devel] [UNIKRAFT PATCH v3 04/14] plat/drivers: Register virtio-blk with libukblkdev


  • To: Roxana Nicolescu <nicolescu.roxana1996@xxxxxxxxx>, "minios-devel@xxxxxxxxxxxxx" <minios-devel@xxxxxxxxxxxxx>
  • From: Justin He <Justin.He@xxxxxxx>
  • Date: Wed, 11 Mar 2020 01:45:27 +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=v3PuUKErmOAG39d58qGKCFqKRdyGyy+b0Ip9AOHqtXQ=; b=kwzkgEcEwulWLk8A7APGZ4D9MqhHMO0QUS2Xpk8abx7wMIojDKbNZWvChs/AEuqhRSc5834i/67Po/IcF1bAvlI/SAr/biAO9D+qNITL/5sF5bh9eUmnpogk0OMgakqXhiU1nL6kUpbPYWTimFKnGeqWSPiszipwL5K2DL3Xu9EAlGiUkmemTCpDLb/vsoPCw1yQFXbkaZqOX3Cr0yPjV8Vbh+ArUodPliAXgUZ40N7o32NyByNGBrM0cSKD7h8pdnMIyTOjm62vh8Fu5MsAWezJ9+IXTSnh51Txbh66oXohyLgGKGtxvLAx/UIJ/bvjogFaNANeqpbZk4DZxxezVw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nh3W4hSl/Jh+DZU+L2BiwjRs2KppTSMF4RDap1eprcTa9c9OcfcvRxlY5fuH9WdIJlJ80NCSWmZbeTvS0AmaAOxFiv6Ba4pe6ZRDOhZ1MWoi7IlAYSxhIFCxa4nnZKUj4SM9Lwua/w+aBWx/rm7gBSexKNfLFvZ8ypkTvpLHdmcZDIoHqwSOUtPh4KHfhtAKnqPA7mzJdlXESeA9rNYWOW+AKf21kk4Qm5rUe0evS6T6AQsr3hFeznGLJcmKATj9scdrRyVbtfOOvj95t6AR49zNJwxFIdOHM/b+Swwf75b6DnKHh+gBrElk8q6iD9K7Z7gPd/XgLywj6X0NNR94Cg==
  • 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;
  • Delivery-date: Wed, 11 Mar 2020 01:45:41 +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: AQHV8yzwAooCihn0tEGAxCn2jFX0GahCpgwg
  • Thread-topic: [UNIKRAFT PATCH v3 04/14] plat/drivers: Register virtio-blk with libukblkdev

LGTM except for one minor issue below, but you can fix it in the future.

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 04/14] plat/drivers: Register virtio-blk with
> libukblkdev
>
> This patch registers virtio-blk with libukblkdev.
>
> Signed-off-by: Roxana Nicolescu <nicolescu.roxana1996@xxxxxxxxx>
> ---
>  plat/drivers/virtio/virtio_blk.c | 38 ++++++++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)
>
> diff --git a/plat/drivers/virtio/virtio_blk.c 
> b/plat/drivers/virtio/virtio_blk.c
> index 89fd1779..884f86d9 100644
> --- a/plat/drivers/virtio/virtio_blk.c
> +++ b/plat/drivers/virtio/virtio_blk.c
> @@ -19,20 +19,58 @@
>   */
>  /* Taken and adapted from virtio-net because of consistency reason. */
>
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <string.h>
> +#include <uk/print.h>
> +#include <errno.h>
> +#include <fcntl.h>
>  #include <virtio/virtio_bus.h>
>  #include <virtio/virtio_ids.h>
> +#include <uk/blkdev.h>
> +#include <uk/blkdev_driver.h>
>
>  #define DRIVER_NAME"virtio-blk"
>
> +#define to_virtioblkdev(bdev) \
> +__containerof(bdev, struct virtio_blk_device, blkdev)
> +
> +
>  static struct uk_alloc *a;
> +static const char *drv_name = DRIVER_NAME;
> +
> +struct virtio_blk_device {
> +/* Pointer to Unikraft Block Device */
> +struct uk_blkdev blkdev;
How about using struct uk_blkdev* Instead of struct uk_blkdev here?
Although it is not a big issue now, struct * make it more graceful.

> +/* The blkdevice identifier */
> +__u16 uid;
> +};
>
>  static int virtio_blk_add_dev(struct virtio_dev *vdev)
>  {
> +struct virtio_blk_device *vbdev;
>  int rc = 0;
>
>  UK_ASSERT(vdev != NULL);
>
> +vbdev = uk_calloc(a, 1, sizeof(*vbdev));
> +if (!vbdev)
> +return -ENOMEM;
> +
> +rc = uk_blkdev_drv_register(&vbdev->blkdev, a, drv_name);
> +if (rc < 0) {
> +uk_pr_err("Failed to register virtio_blk device: %d\n", rc);
> +goto err_out;
> +}
> +
> +vbdev->uid = rc;
> +uk_pr_info("Virtio-blk device registered with libukblkdev\n");
> +
> +out:
>  return rc;
> +err_out:
> +uk_free(a, vbdev);
> +goto out;
>  }
>
>  static int virtio_blk_drv_init(struct uk_alloc *drv_allocator)
> --
> 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®.