Re: [PATCH] vdpa_sim: Fix incorrect size passed to alloc_iova()
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: 2021-08-09 09:35:29
On Mon, Aug 09, 2021 at 05:18:13PM +0800, Yongji Xie wrote:
On Mon, Aug 9, 2021 at 5:04 PM Stefano Garzarella [off-list ref] wrote:quoted
On Mon, Aug 09, 2021 at 02:02:57PM +0800, Xie Yongji wrote:quoted
The size passed to alloc_iova() should be the size of page frames to allocate rather than size in bytes. Fixes: 4080fc106750 ("vdpa_sim: use iova module to allocate IOVA addresses") Signed-off-by: Xie Yongji <redacted> --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c index 14e024de5cbf..1ccf615221fe 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c@@ -137,7 +137,8 @@ static dma_addr_t vdpasim_map_range(struct vdpasim *vdpasim, phys_addr_t paddr, int ret; /* We set the limit_pfn to the maximum (ULONG_MAX - 1) */ - iova = alloc_iova(&vdpasim->iova, size, ULONG_MAX - 1, true); + iova = alloc_iova(&vdpasim->iova, size >> iova_shift(&vdpasim->iova), + ULONG_MAX - 1, true); if (!iova) return DMA_MAPPING_ERROR; --2.11.0We invoked init_iova_domain() with granularity = 1, so it should be correct to use the size in bytes.Oh, yes. I missed the byte granularity. Thanks, Yongji
Ok pls post with corrected description and dropped Fixes tag. -- MST _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization