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

Re: [Minios-devel] [UNIKRAFT PATCH v3 09/14] plat/drivers: Enable/disable interrupts on virtio block queues


  • To: Roxana Nicolescu <nicolescu.roxana1996@xxxxxxxxx>, "minios-devel@xxxxxxxxxxxxx" <minios-devel@xxxxxxxxxxxxx>
  • From: Justin He <Justin.He@xxxxxxx>
  • Date: Wed, 11 Mar 2020 05:00:54 +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=2eYwCuNi7+NK4YP/1mBWVroqs9SKf3+6a2B/umFWN7M=; b=TJ9bEU0iuo/3pJMxniB6ICQYsY8XFyXujRXeAHIu3lWB/43l3wNHzZrviGvlRc6z6H2OZMH2Sy/2WNNIkoYceK9OLLZ/g8gQ9lCKv79arc7PaOnLFyeF6GTU4fS6p+foAH9O9rlnpH95UVj6cwVZ6KhkLWwa5sUR4CtaXZEyryjttT62pk9tRmHFhx4N0rBWmpY2LaW0Tx8zJa9eXXOo3xR02DoAPeooetaHCCb4+ltMX+MoTILJYR9D94/sh1DUawr5D1HHDPUFSx4IW/7UJVx36hXObzy7yd7n7x43RNsEu4I8bLO3Yo9cUigap5XPaXVpwHoRtV4nE7V9VCFkLg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A8ENDXiG0bL6FZkI9q1fHcm09i/4xrLDDvNEZDruG4kXSPk8FvD2473zXY3pxIwxQHNh4eFXIfZIMyn7sUNcp+UZpeVFiY8di2zDY/FZboZS7ssKgqcFGvohLF62d6tuWVTo0elYL6Em92KS21lFIv+dyZYwWNlP1n0Prh3C/7YWKinA7Vm1n2hu2DblZ1mpA9KSsRmJfBHfhqbd8XffbHvnQm5n5CkrwdvjuCY0kFz2MT60AvkyXIMSRps3Jzj49mNylakMD4SjcJRGPACl02H9jw2dqqS/wrHClSSDzQXYYrQrNIZcybBzZ+jwVUk/38lCZmU3ayY1PO/dMI/MJg==
  • 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 05:01:10 +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: AQHV8yz0vl7TyLAOWkeCa3ZZLxi9DKhC3YxQ
  • Thread-topic: [UNIKRAFT PATCH v3 09/14] plat/drivers: Enable/disable interrupts on virtio block queues

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

> -----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 09/14] plat/drivers: Enable/disable interrupts
> on virtio block queues
>
> This patch introduces support for the user to enable/disable interrupts
> on queues.
>
> Signed-off-by: Roxana Nicolescu <nicolescu.roxana1996@xxxxxxxxx>
> ---
>  plat/drivers/virtio/virtio_blk.c | 49 ++++++++++++++++++++++++++++++++
>  1 file changed, 49 insertions(+)
>
> diff --git a/plat/drivers/virtio/virtio_blk.c 
> b/plat/drivers/virtio/virtio_blk.c
> index 46d3236f..cb732135 100644
> --- a/plat/drivers/virtio/virtio_blk.c
> +++ b/plat/drivers/virtio/virtio_blk.c
> @@ -35,6 +35,11 @@
>  #define DRIVER_NAME"virtio-blk"
>  #define DEFAULT_SECTOR_SIZE512
>
> +#defineVTBLK_INTR_EN(1 << 0)
> +#defineVTBLK_INTR_EN_MASK(1)
> +#defineVTBLK_INTR_USR_EN(1 << 1)
> +#defineVTBLK_INTR_USR_EN_MASK(2)
> +
>  #define to_virtioblkdev(bdev) \
>  __containerof(bdev, struct virtio_blk_device, blkdev)
>
> @@ -86,6 +91,8 @@ struct uk_blkdev_queue {
>  uint16_t max_nb_desc;
>  /* The nr. of descriptor user configured */
>  uint16_t nb_desc;
> +/* The flag to interrupt on the queue */
> +uint8_t intr_enabled;
>  /* Reference to virtio_blk_device  */
>  struct virtio_blk_device *vbd;
>  /* The scatter list and its associated fragments */
> @@ -102,11 +109,51 @@ static int virtio_blkdev_recv_done(struct virtqueue
> *vq, void *priv)
>
>  queue = (struct uk_blkdev_queue *) priv;
>
> +/* Disable the interrupt for the ring */
> +virtqueue_intr_disable(vq);
> +queue->intr_enabled &= ~(VTBLK_INTR_EN);
> +
>  uk_blkdev_drv_queue_event(&queue->vbd->blkdev, queue-
> >lqueue_id);
>
>  return 1;
>  }
>
> +static int virtio_blkdev_queue_intr_enable(struct uk_blkdev *dev,
> +struct uk_blkdev_queue *queue)
> +{
> +int rc = 0;
> +
> +UK_ASSERT(dev);
> +
> +/* If the interrupt is enabled */
> +if (queue->intr_enabled & VTBLK_INTR_EN)
> +return 0;
> +
> +/**
> + * Enable the user configuration bit. This would cause the interrupt
> to
> + * be enabled automatically, if the interrupt could not be enabled
> now
> + * due to data in the queue.
> + */
> +queue->intr_enabled = VTBLK_INTR_USR_EN;
> +rc = virtqueue_intr_enable(queue->vq);
> +if (!rc)
> +queue->intr_enabled |= VTBLK_INTR_EN;
> +
> +return rc;
> +}
> +
> +static int virtio_blkdev_queue_intr_disable(struct uk_blkdev *dev,
> +struct uk_blkdev_queue *queue)
> +{
> +UK_ASSERT(dev);
> +UK_ASSERT(queue);
> +
> +virtqueue_intr_disable(queue->vq);
> +queue->intr_enabled &= ~(VTBLK_INTR_USR_EN | VTBLK_INTR_EN);
> +
> +return 0;
> +}
> +
>  /**
>   * This function setup the vring infrastructure.
>   */
> @@ -459,6 +506,8 @@ static const struct uk_blkdev_ops virtio_blkdev_ops =
> {
>  .dev_configure = virtio_blkdev_configure,
>  .queue_get_info = virtio_blkdev_queue_info_get,
>  .queue_setup = virtio_blkdev_queue_setup,
> +.queue_intr_enable = virtio_blkdev_queue_intr_enable,
> +.queue_intr_disable = virtio_blkdev_queue_intr_disable,
>  .queue_release = virtio_blkdev_queue_release,
>  .dev_unconfigure = virtio_blkdev_unconfigure,
>  };
> --
> 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®.