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] [day] [month] [year] [list]
Message-ID: <21c3bf84-7caf-cc64-2432-b19f46622fb9@redhat.com>
Date:   Fri, 4 Jun 2021 10:31:55 +0800
From:   Jason Wang <jasowang@...hat.com>
To:     Eli Cohen <elic@...dia.com>, mst@...hat.com,
        virtualization@...ts.linux-foundation.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] vdpa/mlx5: Add support for doorbell bypassing


在 2021/6/3 下午4:11, Eli Cohen 写道:
> Implement mlx5_get_vq_notification() to return the doorbell address.
> Since the notification area is mapped to userspace, make sure that the
> BAR size is at least PAGE_SIZE large.
>
> Signed-off-by: Eli Cohen <elic@...dia.com>
> ---
> v0 --> v1:
>    Make sure SF bar size is not smaller than PAGE_SIZE
> v1 --> v2:
>    Remove test on addr alignment since it's alrady done by the caller.


Acked-by: Jason Wang <jasowang@...hat.com>


>
>   drivers/vdpa/mlx5/core/mlx5_vdpa.h |  1 +
>   drivers/vdpa/mlx5/core/resources.c |  1 +
>   drivers/vdpa/mlx5/net/mlx5_vnet.c  | 14 ++++++++++++++
>   3 files changed, 16 insertions(+)
>
> diff --git a/drivers/vdpa/mlx5/core/mlx5_vdpa.h b/drivers/vdpa/mlx5/core/mlx5_vdpa.h
> index 09a16a3d1b2a..0002b2136b48 100644
> --- a/drivers/vdpa/mlx5/core/mlx5_vdpa.h
> +++ b/drivers/vdpa/mlx5/core/mlx5_vdpa.h
> @@ -42,6 +42,7 @@ struct mlx5_vdpa_resources {
>   	u32 pdn;
>   	struct mlx5_uars_page *uar;
>   	void __iomem *kick_addr;
> +	u64 phys_kick_addr;
>   	u16 uid;
>   	u32 null_mkey;
>   	bool valid;
> diff --git a/drivers/vdpa/mlx5/core/resources.c b/drivers/vdpa/mlx5/core/resources.c
> index 836ab9ef0fa6..d4606213f88a 100644
> --- a/drivers/vdpa/mlx5/core/resources.c
> +++ b/drivers/vdpa/mlx5/core/resources.c
> @@ -253,6 +253,7 @@ int mlx5_vdpa_alloc_resources(struct mlx5_vdpa_dev *mvdev)
>   		goto err_key;
>   
>   	kick_addr = mdev->bar_addr + offset;
> +	res->phys_kick_addr = kick_addr;
>   
>   	res->kick_addr = ioremap(kick_addr, PAGE_SIZE);
>   	if (!res->kick_addr) {
> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> index 689d3fa61e08..bc33f2c523d3 100644
> --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> @@ -1879,8 +1879,22 @@ static void mlx5_vdpa_free(struct vdpa_device *vdev)
>   
>   static struct vdpa_notification_area mlx5_get_vq_notification(struct vdpa_device *vdev, u16 idx)
>   {
> +	struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev);
>   	struct vdpa_notification_area ret = {};
> +	struct mlx5_vdpa_net *ndev;
> +	phys_addr_t addr;
>   
> +	/* If SF BAR size is smaller than PAGE_SIZE, do not use direct
> +	 * notification to avoid the risk of mapping pages that contain BAR of more
> +	 * than one SF
> +	 */
> +	if (MLX5_CAP_GEN(mvdev->mdev, log_min_sf_size) + 12 < PAGE_SHIFT)
> +		return ret;
> +
> +	ndev = to_mlx5_vdpa_ndev(mvdev);
> +	addr = (phys_addr_t)ndev->mvdev.res.phys_kick_addr;
> +	ret.addr = addr;
> +	ret.size = PAGE_SIZE;
>   	return ret;
>   }
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ