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

Re: [Minios-devel] [UNIKRAFT PATCH v3 01/14] plat/virtio: Release an individual virtqueue


  • To: Roxana Nicolescu <nicolescu.roxana1996@xxxxxxxxx>, "minios-devel@xxxxxxxxxxxxx" <minios-devel@xxxxxxxxxxxxx>
  • From: Justin He <Justin.He@xxxxxxx>
  • Date: Wed, 11 Mar 2020 01:28:14 +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=HsRs60g7xGldwjZEAm01U/j7yksx9t638yu224NJSPM=; b=WdVnXiRzSp324sHj3vjOrc9mur4GYge9pfd3u7qjzvKaLOolaFMn9FoVn9htH5G2UAO6AOZAJ84laQ/3OuF/9UFWU5S57AVXJwlU9xsXXPedKG+Kc2WWVwzQ6lKEQ5bLWalTSYSmwO+HZ339djjdQ+7tICr/QrU8I3ileJvNE/OvXyiHAG1w/W0ti6wh+EeNE2wilYNE8pLa/hS/3nS9/0ft31242BkzoR084SMrGNatCCdVS8fzDGh2g1XUg6QWkT1IE4cDTuwFQUCgg3a//eogEEjjLD9t2xdqGg9VUPV0HoBANpHMM813WYnwHk+SAGnMXXpArSf/NNvd7v0vxg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jhvZAsorZPo2vCo2L1G3HOZwW2dmZl8VgrpJx5A2oTBEshOOI8wwZHAaU5jdSIJT2Y+mSVyg9dtMs4RwoT1s9L2WwamYX6MZkaC7sgJhpFACI7iezb626MQhy2xbv7yzqf+Lq2OXlMM0kZxvT+OwibZkydeWden44jM938X6taZ3I1Hj0TgBRpQfsUy30+fdJI0pIv+0aA1W9C2bLmC1iYyvkqqkJvskKmjqPYPnEbopTEMBfHgl8LTxHw33xDLo3p+KgP6BHtskmzCtwDfTW0E8nWIHFTofr9aLIAzD5rayRApMYJu6y77o0Bp3jM2xhcP0OqTQmx9Gi19bisKDOw==
  • 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:28:31 +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: AQHV8yzuuNNgtQI0vUuhk7W6zwmD8KhCofdQ
  • Thread-topic: [UNIKRAFT PATCH v3 01/14] plat/virtio: Release an individual virtqueue

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 01/14] plat/virtio: Release an individual
> virtqueue
>
> This patch introduces the release of an individual virtqueue.
>
> Signed-off-by: Roxana Nicolescu <nicolescu.roxana1996@xxxxxxxxx>
> ---
>  plat/drivers/include/virtio/virtio_bus.h | 21 +++++++++++++++++++
>  plat/drivers/virtio/virtio_pci.c         | 26 ++++++++++++++++++++++++
>  2 files changed, 47 insertions(+)
>
> diff --git a/plat/drivers/include/virtio/virtio_bus.h
> b/plat/drivers/include/virtio/virtio_bus.h
> index fcea5d63..56f0dafe 100644
> --- a/plat/drivers/include/virtio/virtio_bus.h
> +++ b/plat/drivers/include/virtio/virtio_bus.h
> @@ -104,6 +104,8 @@ struct virtio_config_ops {
>        __u16 queue_id,
>        virtqueue_callback_t callback,
>        struct uk_alloc *a);
> +void (*vq_release)(struct virtio_dev *vdev, struct virtqueue *vq,
> +struct uk_alloc *a);
>  };
>
>  /**
> @@ -316,6 +318,25 @@ static inline struct virtqueue
> *virtio_vqueue_setup(struct virtio_dev *vdev,
>  return vq;
>  }
>
> +/**
> + * A helper function to release an individual virtqueue.
> + * @param vdev
> + *Reference to the virtio device.
> + * @param vq
> + *Reference to the virtqueue.
> + * @param a
> + *A reference to the allocator.
> + */
> +static inline void virtio_vqueue_release(struct virtio_dev *vdev,
> +struct virtqueue *vq, struct uk_alloc *a)
> +{
> +UK_ASSERT(vdev);
> +UK_ASSERT(vq);
> +UK_ASSERT(a);
> +if (likely(vdev->cops->vq_release))
> +vdev->cops->vq_release(vdev, vq, a);
> +}
> +
>  static inline int virtio_has_features(__u64 features, __u8 bpos)
>  {
>  __u64 tmp_feature = 0;
> diff --git a/plat/drivers/virtio/virtio_pci.c 
> b/plat/drivers/virtio/virtio_pci.c
> index e398bfc6..c0c9032f 100644
> --- a/plat/drivers/virtio/virtio_pci.c
> +++ b/plat/drivers/virtio/virtio_pci.c
> @@ -92,6 +92,8 @@ static struct virtqueue *vpci_legacy_vq_setup(struct
> virtio_dev *vdev,
>        __u16 num_desc,
>        virtqueue_callback_t callback,
>        struct uk_alloc *a);
> +static void vpci_legacy_vq_release(struct virtio_dev *vdev,
> +struct virtqueue *vq, struct uk_alloc *a);
>  static int virtio_pci_handle(void *arg);
>  static int vpci_legacy_notify(struct virtio_dev *vdev, __u16 queue_id);
>  static int virtio_pci_legacy_add_dev(struct pci_device *pci_dev,
> @@ -110,6 +112,7 @@ static struct virtio_config_ops vpci_legacy_ops = {
>  .status_set   = vpci_legacy_pci_status_set,
>  .vqs_find     = vpci_legacy_pci_vq_find,
>  .vq_setup     = vpci_legacy_vq_setup,
> +.vq_release   = vpci_legacy_vq_release,
>  };
>
>  static int vpci_legacy_notify(struct virtio_dev *vdev, __u16 queue_id)
> @@ -188,6 +191,29 @@ err_exit:
>  return vq;
>  }
>
> +static void vpci_legacy_vq_release(struct virtio_dev *vdev,
> +struct virtqueue *vq, struct uk_alloc *a)
> +{
> +struct virtio_pci_dev *vpdev = NULL;
> +long flags;
> +
> +UK_ASSERT(vq != NULL);
> +UK_ASSERT(a != NULL);
> +vpdev = to_virtiopcidev(vdev);
> +
> +/* Select and deactivate the queue */
> +virtio_cwrite16((void *)(unsigned long)vpdev->pci_base_addr,
> +VIRTIO_PCI_QUEUE_SEL, vq->queue_id);
> +virtio_cwrite32((void *)(unsigned long)vpdev->pci_base_addr,
> +VIRTIO_PCI_QUEUE_PFN, 0);
> +
> +flags = ukplat_lcpu_save_irqf();
> +UK_TAILQ_REMOVE(&vpdev->vdev.vqs, vq, next);
> +ukplat_lcpu_restore_irqf(flags);
> +
> +virtqueue_destroy(vq, a);
> +}
> +
>  static int vpci_legacy_pci_vq_find(struct virtio_dev *vdev, __u16 num_vqs,
>     __u16 *qdesc_size)
>  {
> --
> 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®.