On Wed, Apr 06, 2022 at 04:35:37PM +0800, Jason Wang wrote:
> This patch implements PCI version of synchronize_vqs().
> 
> Cc: Thomas Gleixner <[email protected]>
> Cc: Peter Zijlstra <[email protected]>
> Cc: "Paul E. McKenney" <[email protected]>
> Cc: Marc Zyngier <[email protected]>
> Signed-off-by: Jason Wang <[email protected]>

Please add implementations at least for ccw and mmio.

> ---
>  drivers/virtio/virtio_pci_common.c | 14 ++++++++++++++
>  drivers/virtio/virtio_pci_common.h |  2 ++
>  drivers/virtio/virtio_pci_legacy.c |  1 +
>  drivers/virtio/virtio_pci_modern.c |  2 ++
>  4 files changed, 19 insertions(+)
> 
> diff --git a/drivers/virtio/virtio_pci_common.c 
> b/drivers/virtio/virtio_pci_common.c
> index d724f676608b..b78c8bc93a97 100644
> --- a/drivers/virtio/virtio_pci_common.c
> +++ b/drivers/virtio/virtio_pci_common.c
> @@ -37,6 +37,20 @@ void vp_synchronize_vectors(struct virtio_device *vdev)
>               synchronize_irq(pci_irq_vector(vp_dev->pci_dev, i));
>  }
>  
> +void vp_synchronize_vqs(struct virtio_device *vdev)
> +{
> +     struct virtio_pci_device *vp_dev = to_vp_device(vdev);
> +     int i;
> +
> +     if (vp_dev->intx_enabled) {
> +             synchronize_irq(vp_dev->pci_dev->irq);
> +             return;
> +     }
> +
> +     for (i = 0; i < vp_dev->msix_vectors; ++i)
> +             synchronize_irq(pci_irq_vector(vp_dev->pci_dev, i));
> +}
> +
>  /* the notify function used when creating a virt queue */
>  bool vp_notify(struct virtqueue *vq)
>  {
> diff --git a/drivers/virtio/virtio_pci_common.h 
> b/drivers/virtio/virtio_pci_common.h
> index eb17a29fc7ef..2b84d5c1b5bc 100644
> --- a/drivers/virtio/virtio_pci_common.h
> +++ b/drivers/virtio/virtio_pci_common.h
> @@ -105,6 +105,8 @@ static struct virtio_pci_device *to_vp_device(struct 
> virtio_device *vdev)
>  void vp_synchronize_vectors(struct virtio_device *vdev);
>  /* the notify function used when creating a virt queue */
>  bool vp_notify(struct virtqueue *vq);
> +/* synchronize with callbacks */
> +void vp_synchronize_vqs(struct virtio_device *vdev);
>  /* the config->del_vqs() implementation */
>  void vp_del_vqs(struct virtio_device *vdev);
>  /* the config->find_vqs() implementation */
> diff --git a/drivers/virtio/virtio_pci_legacy.c 
> b/drivers/virtio/virtio_pci_legacy.c
> index 6f4e34ce96b8..5a9e62320edc 100644
> --- a/drivers/virtio/virtio_pci_legacy.c
> +++ b/drivers/virtio/virtio_pci_legacy.c
> @@ -192,6 +192,7 @@ static const struct virtio_config_ops 
> virtio_pci_config_ops = {
>       .reset          = vp_reset,
>       .find_vqs       = vp_find_vqs,
>       .del_vqs        = vp_del_vqs,
> +     .synchronize_vqs = vp_synchronize_vqs,
>       .get_features   = vp_get_features,
>       .finalize_features = vp_finalize_features,
>       .bus_name       = vp_bus_name,
> diff --git a/drivers/virtio/virtio_pci_modern.c 
> b/drivers/virtio/virtio_pci_modern.c
> index a2671a20ef77..584850389855 100644
> --- a/drivers/virtio/virtio_pci_modern.c
> +++ b/drivers/virtio/virtio_pci_modern.c
> @@ -394,6 +394,7 @@ static const struct virtio_config_ops 
> virtio_pci_config_nodev_ops = {
>       .reset          = vp_reset,
>       .find_vqs       = vp_modern_find_vqs,
>       .del_vqs        = vp_del_vqs,
> +     .synchronize_vqs = vp_synchronize_vqs,
>       .get_features   = vp_get_features,
>       .finalize_features = vp_finalize_features,
>       .bus_name       = vp_bus_name,
> @@ -411,6 +412,7 @@ static const struct virtio_config_ops 
> virtio_pci_config_ops = {
>       .reset          = vp_reset,
>       .find_vqs       = vp_modern_find_vqs,
>       .del_vqs        = vp_del_vqs,
> +     .synchronize_vqs = vp_synchronize_vqs,
>       .get_features   = vp_get_features,
>       .finalize_features = vp_finalize_features,
>       .bus_name       = vp_bus_name,
> -- 
> 2.25.1

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Reply via email to