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: <37f7982a-d065-1c2e-abcf-00e9fbc5732a@redhat.com>
Date:   Thu, 8 Apr 2021 17:44:47 +0800
From:   Jason Wang <jasowang@...hat.com>
To:     Eli Cohen <elic@...dia.com>, mst@...hat.com, parav@...dia.com,
        si-wei.liu@...cle.com, virtualization@...ts.linux-foundation.org,
        netdev@...r.kernel.org
Cc:     stable@...r.kernel.org
Subject: Re: [PATCH 2/5] vdpa/mlx5: Use the correct dma device when
 registering memory


在 2021/4/8 下午5:10, Eli Cohen 写道:
> In cases where the vdpa instance uses a SF (sub function), the DMA
> device is the parent device. Use a function to retrieve the correct DMA
> device.
>
> Fixes: 1958fc2f0712 ("net/mlx5: SF, Add auxiliary device driver")
> Signed-off-by: Eli Cohen <elic@...dia.com>
> Reviewed-by: Parav Pandit <parav@...dia.com>


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


> ---
>   drivers/vdpa/mlx5/core/mr.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5/core/mr.c
> index d300f799efcd..3908ff28eec0 100644
> --- a/drivers/vdpa/mlx5/core/mr.c
> +++ b/drivers/vdpa/mlx5/core/mr.c
> @@ -219,6 +219,11 @@ static void destroy_indirect_key(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_m
>   	mlx5_vdpa_destroy_mkey(mvdev, &mkey->mkey);
>   }
>   
> +static struct device *get_dma_device(struct mlx5_vdpa_dev *mvdev)
> +{
> +	return &mvdev->mdev->pdev->dev;
> +}
> +
>   static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr *mr,
>   			 struct vhost_iotlb *iotlb)
>   {
> @@ -234,7 +239,7 @@ static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr
>   	u64 pa;
>   	u64 paend;
>   	struct scatterlist *sg;
> -	struct device *dma = mvdev->mdev->device;
> +	struct device *dma = get_dma_device(mvdev);
>   
>   	for (map = vhost_iotlb_itree_first(iotlb, mr->start, mr->end - 1);
>   	     map; map = vhost_iotlb_itree_next(map, start, mr->end - 1)) {
> @@ -291,7 +296,7 @@ static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr
>   
>   static void unmap_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr *mr)
>   {
> -	struct device *dma = mvdev->mdev->device;
> +	struct device *dma = get_dma_device(mvdev);
>   
>   	destroy_direct_mr(mvdev, mr);
>   	dma_unmap_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ