linux-stable/drivers/vdpa
Eli Cohen 28ad17a5e9 vdpa/mlx5: Fix memory key MTT population
[ Upstream commit 710eb8e32d ]

map_direct_mr() assumed that the number of scatter/gather entries
returned by dma_map_sg_attrs() was equal to the number of segments in
the sgl list. This led to wrong population of the mkey object. Fix this
by properly referring to the returned value.

The hardware expects each MTT entry to contain the DMA address of a
contiguous block of memory of size (1 << mr->log_size) bytes.
dma_map_sg_attrs() can coalesce several sg entries into a single
scatter/gather entry of contiguous DMA range so we need to scan the list
and refer to the size of each s/g entry.

In addition, get rid of fill_sg() which effect is overwritten by
populate_mtts().

Fixes: 94abbccdf2 ("vdpa/mlx5: Add shared memory registration code")
Signed-off-by: Eli Cohen <elic@nvidia.com>
Link: https://lore.kernel.org/r/20210107071845.GA224876@mtl-vdi-166.wap.labs.mlnx
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-02-10 09:29:12 +01:00
..
ifcvf vdpa: ifcvf: free config irq in ifcvf_free_irq() 2020-08-26 08:13:59 -04:00
mlx5 vdpa/mlx5: Fix memory key MTT population 2021-02-10 09:29:12 +01:00
vdpa_sim vhost,vdpa: fixes 2020-10-31 14:41:48 -07:00
Kconfig vdpa: mlx5: fix vdpa/vhost dependencies 2020-12-02 04:09:56 -05:00
Makefile vdpa/mlx5: Add support library for mlx5 VDPA implementation 2020-08-05 19:00:23 -04:00
vdpa.c vdpa: remove hard coded virtq num 2020-08-05 18:39:18 -04:00