<div dir="ltr">On Wed, May 6, 2020 at 10:59 PM Chun-Kuang Hu <<a href="mailto:chunkuang.hu@kernel.org">chunkuang.hu@kernel.org</a>> wrote:<br>><br>> Hi, Anand:<br>><br>> Anand Mistry <<a href="mailto:amistry@chromium.org">amistry@chromium.org</a>> 於 2020年5月6日 週三 下午7:03寫道:<br>> ><br>> > On Wed, May 6, 2020 at 10:25 AM Chun-Kuang Hu <<a href="mailto:chunkuang.hu@kernel.org">chunkuang.hu@kernel.org</a>> wrote:<br>> > ><br>> > > Hi, Anand,<br>> > ><br>> > > Chun-Kuang Hu <<a href="mailto:chunkuang.hu@kernel.org">chunkuang.hu@kernel.org</a>> 於 2020年4月29日 週三 上午12:37寫道:<br>> > > ><br>> > > > Hi, Anand,<br>> > > ><br>> > > > Anand K. Mistry <<a href="mailto:amistry@chromium.org">amistry@chromium.org</a>> 於 2020年4月28日 週二 上午9:54寫道:<br>> > > > ><br>> > > > > On Sun, 26 Apr 2020 at 18:04, Chun-Kuang Hu <<a href="mailto:chunkuang.hu@kernel.org">chunkuang.hu@kernel.org</a>> wrote:<br>> > > > > ><br>> > > > > > Hi, Anand:<br>> > > > > ><br>> > > > > > Anand K Mistry <<a href="mailto:amistry@chromium.org">amistry@chromium.org</a>> 於 2020年4月20日 週一 下午2:09寫道:<br>> > > > > > ><br>> > > > > > > If dma_map_sg() merges pages when creating the mapping, only the first<br>> > > > > > > entries will have a valid sg_dma_address() and sg_dma_len(), followed by<br>> > > > > > > entries with sg_dma_len() == 0.<br>> > > > > > ><br>> > > > > > > Signed-off-by: Anand K Mistry <<a href="mailto:amistry@google.com">amistry@google.com</a>><br>> > ><br>> > > Author should sign off this patch, please give a sign off tag by author.<br>> ><br>> > Sorry, email issues meant i sent the patch from a different account.<br>> > Should I re-send the<br>> > patch from the same account as the sign-off line? I'm still working my<br>> > way through the kernel patch process.<br>> ><br>><br>> If you want to use chromium account, you could simply reply this email<br>> with a sign-off-by tag of chromium account.<br><br>Ack. As path of least resistance, here:<br><br>Signed-off-by: Anand K Mistry <<a href="mailto:amistry@chromium.org">amistry@chromium.org</a>><br><br><br>><br>> Regards,<br>> Chun-Kuang.<br>><br>> > ><br>> > > Regards,<br>> > > Chun-Kuang.<br>> > ><br>> > > > > > > ---<br>> > > > > > >  drivers/gpu/drm/mediatek/mtk_drm_gem.c | 3 +++<br>> > > > > > >  1 file changed, 3 insertions(+)<br>> > > > > > ><br>> > > > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c b/drivers/gpu/drm/mediatek/mtk_drm_gem.c<br>> > > > > > > index b04a3c2b111e09..f8fd8b98c30e3d 100644<br>> > > > > > > --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c<br>> > > > > > > +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c<br>> > > > > > > @@ -224,6 +224,9 @@ struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev,<br>> > > > > > ><br>> > > > > > >         expected = sg_dma_address(sg->sgl);<br>> > > > > > >         for_each_sg(sg->sgl, s, sg->nents, i) {<br>> > > > > > > +               if (!sg_dma_len(s))<br>> > > > > > > +                       break;<br>> > > > > ><br>> > > > > > I think this should be 'continue'<br>> > > > ><br>> > > > > scatterlist.h has the comment:<br>> > > > > /*<br>> > > > >  * These macros should be used after a dma_map_sg call has been done<br>> > > > >  * to get bus addresses of each of the SG entries and their lengths.<br>> > > > >  * You should only work with the number of sg entries dma_map_sg<br>> > > > >  * returns, or alternatively stop on the first sg_dma_len(sg) which<br>> > > > >  * is 0.<br>> > > > >  */<br>> > > > ><br>> > > > > So breaking on the first sg_dma_len(sg) == 0 appears to be (one of)<br>> > > > > the documented approach.<br>> > > > ><br>> > > ><br>> > > > Okay, you're right. So<br>> > > ><br>> > > > Reviewed-by: Chun-Kuang Hu <<a href="mailto:chunkuang.hu@kernel.org">chunkuang.hu@kernel.org</a>><br>> > > ><br>> > > > > ><br>> > > > > > Regards,<br>> > > > > > Chun-Kuang.<br>> > > > > ><br>> > > > > > > +<br>> > > > > > >                 if (sg_dma_address(s) != expected) {<br>> > > > > > >                         DRM_ERROR("sg_table is not contiguous");<br>> > > > > > >                         ret = -EINVAL;<br>> > > > > > > --<br>> > > > > > > 2.26.1.301.g55bc3eb7cb9-goog<br>> > > > > > ><br>> > > > > > ><br>> > > > > > > _______________________________________________<br>> > > > > > > Linux-mediatek mailing list<br>> > > > > > > <a href="mailto:Linux-mediatek@lists.infradead.org">Linux-mediatek@lists.infradead.org</a><br>> > > > > > > <a href="http://lists.infradead.org/mailman/listinfo/linux-mediatek">http://lists.infradead.org/mailman/listinfo/linux-mediatek</a></div>