virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Yongji Xie <xieyongji@bytedance.com>
Cc: virtualization <virtualization@lists.linux-foundation.org>
Subject: Re: [PATCH] vdpa_sim: Fix incorrect size passed to alloc_iova()
Date: Mon, 9 Aug 2021 05:35:16 -0400	[thread overview]
Message-ID: <20210809053449-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CACycT3s9ZKGhXquuVBiOEmEELCMgqVw1no7JpA8_J3maCKKqxA@mail.gmail.com>

On Mon, Aug 09, 2021 at 05:18:13PM +0800, Yongji Xie wrote:
> On Mon, Aug 9, 2021 at 5:04 PM Stefano Garzarella <sgarzare@redhat.com> wrote:
> >
> > On Mon, Aug 09, 2021 at 02:02:57PM +0800, Xie Yongji wrote:
> > >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 <xieyongji@bytedance.com>
> > >---
> > > 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.0
> > >
> >
> > We 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

      parent reply	other threads:[~2021-08-09  9:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210809060257.99-1-xieyongji@bytedance.com>
2021-08-09  9:04 ` [PATCH] vdpa_sim: Fix incorrect size passed to alloc_iova() Stefano Garzarella
     [not found]   ` <CACycT3s9ZKGhXquuVBiOEmEELCMgqVw1no7JpA8_J3maCKKqxA@mail.gmail.com>
2021-08-09  9:35     ` Michael S. Tsirkin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210809053449-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xieyongji@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).