lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210421074422.GB97533@mtl-vdi-166.wap.labs.mlnx>
Date:   Wed, 21 Apr 2021 10:44:22 +0300
From:   Eli Cohen <elic@...dia.com>
To:     Jason Wang <jasowang@...hat.com>
CC:     <mst@...hat.com>, <virtualization@...ts.linux-foundation.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/7] virtio_pci_modern: introduce helper to map vq notify
 area

On Thu, Apr 15, 2021 at 03:31:41AM -0400, Jason Wang wrote:
> This patch factors out the logic of vq notify area mapping. Following
> patches will switch to use this common helpers for both virtio_pci
> library and virtio-pci vDPA driver.
> 
> Signed-off-by: Jason Wang <jasowang@...hat.com>

Reviewed-by: Eli Cohen <elic@...dia.com>

> ---
>  drivers/virtio/virtio_pci_modern_dev.c | 35 ++++++++++++++++++++++++++
>  include/linux/virtio_pci_modern.h      |  2 ++
>  2 files changed, 37 insertions(+)
> 
> diff --git a/drivers/virtio/virtio_pci_modern_dev.c b/drivers/virtio/virtio_pci_modern_dev.c
> index cbd667496bb1..28cb5847fafa 100644
> --- a/drivers/virtio/virtio_pci_modern_dev.c
> +++ b/drivers/virtio/virtio_pci_modern_dev.c
> @@ -593,6 +593,41 @@ u16 vp_modern_get_queue_notify_off(struct virtio_pci_modern_device *mdev,
>  }
>  EXPORT_SYMBOL_GPL(vp_modern_get_queue_notify_off);
>  
> +/*
> + * vp_modern_map_vq_notify - map notification area for a
> + * specific virtqueue
> + * @mdev: the modern virtio-pci device
> + * @index: the queue index
> + *
> + * Returns the address of the notification area
> + */
> +void *vp_modern_map_vq_notify(struct virtio_pci_modern_device *mdev,
> +			      u16 index)
> +{
> +	u16 off = vp_modern_get_queue_notify_off(mdev, index);
> +
> +	if (mdev->notify_base) {
> +		/* offset should not wrap */
> +		if ((u64)off * mdev->notify_offset_multiplier + 2
> +			> mdev->notify_len) {
> +			dev_warn(&mdev->pci_dev->dev,
> +				 "bad notification offset %u (x %u) "
> +				 "for queue %u > %zd",
> +				 off, mdev->notify_offset_multiplier,
> +				 index, mdev->notify_len);
> +			return NULL;
> +		}
> +		return (void __force *)mdev->notify_base +
> +			off * mdev->notify_offset_multiplier;
> +	} else {
> +		return (void __force *)vp_modern_map_capability(mdev,
> +				       mdev->notify_map_cap, 2, 2,
> +				       off * mdev->notify_offset_multiplier, 2,
> +				       NULL);
> +	}
> +}
> +EXPORT_SYMBOL_GPL(vp_modern_map_vq_notify);
> +
>  MODULE_VERSION("0.1");
>  MODULE_DESCRIPTION("Modern Virtio PCI Device");
>  MODULE_AUTHOR("Jason Wang <jasowang@...hat.com>");
> diff --git a/include/linux/virtio_pci_modern.h b/include/linux/virtio_pci_modern.h
> index f26acbeec965..1b95d39b00fc 100644
> --- a/include/linux/virtio_pci_modern.h
> +++ b/include/linux/virtio_pci_modern.h
> @@ -106,6 +106,8 @@ void __iomem *vp_modern_map_capability(struct virtio_pci_modern_device *mdev, in
>  				       u32 align,
>  				       u32 start, u32 size,
>  				       size_t *len);
> +void *vp_modern_map_vq_notify(struct virtio_pci_modern_device *mdev,
> +                              u16 index);
>  int vp_modern_probe(struct virtio_pci_modern_device *mdev);
>  void vp_modern_remove(struct virtio_pci_modern_device *mdev);
>  #endif
> -- 
> 2.18.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ