* [PATCH] drm/mediatek: stop iterating dma addresses when sg_dma_len() == 0
@ 2020-04-20 6:08 Anand K Mistry
2020-04-26 8:03 ` Chun-Kuang Hu
0 siblings, 1 reply; 11+ messages in thread
From: Anand K Mistry @ 2020-04-20 6:08 UTC (permalink / raw)
To: linux-mediatek; +Cc: matthias.bgg, dri-devel, linux-arm-kernel, Anand K Mistry
If dma_map_sg() merges pages when creating the mapping, only the first
entries will have a valid sg_dma_address() and sg_dma_len(), followed by
entries with sg_dma_len() == 0.
Signed-off-by: Anand K Mistry <amistry@google.com>
---
drivers/gpu/drm/mediatek/mtk_drm_gem.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
index b04a3c2b111e09..f8fd8b98c30e3d 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
@@ -224,6 +224,9 @@ struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev,
expected = sg_dma_address(sg->sgl);
for_each_sg(sg->sgl, s, sg->nents, i) {
+ if (!sg_dma_len(s))
+ break;
+
if (sg_dma_address(s) != expected) {
DRM_ERROR("sg_table is not contiguous");
ret = -EINVAL;
--
2.26.1.301.g55bc3eb7cb9-goog
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/mediatek: stop iterating dma addresses when sg_dma_len() == 0
2020-04-20 6:08 [PATCH] drm/mediatek: stop iterating dma addresses when sg_dma_len() == 0 Anand K Mistry
@ 2020-04-26 8:03 ` Chun-Kuang Hu
2020-04-28 1:49 ` Anand K. Mistry
2020-04-28 1:54 ` Anand K. Mistry
0 siblings, 2 replies; 11+ messages in thread
From: Chun-Kuang Hu @ 2020-04-26 8:03 UTC (permalink / raw)
To: Anand K Mistry
Cc: Anand K Mistry, DRI Development,
moderated list:ARM/Mediatek SoC support, Matthias Brugger,
Linux ARM
Hi, Anand:
Anand K Mistry <amistry@chromium.org> 於 2020年4月20日 週一 下午2:09寫道:
>
> If dma_map_sg() merges pages when creating the mapping, only the first
> entries will have a valid sg_dma_address() and sg_dma_len(), followed by
> entries with sg_dma_len() == 0.
>
> Signed-off-by: Anand K Mistry <amistry@google.com>
> ---
> drivers/gpu/drm/mediatek/mtk_drm_gem.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> index b04a3c2b111e09..f8fd8b98c30e3d 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> @@ -224,6 +224,9 @@ struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev,
>
> expected = sg_dma_address(sg->sgl);
> for_each_sg(sg->sgl, s, sg->nents, i) {
> + if (!sg_dma_len(s))
> + break;
I think this should be 'continue'
Regards,
Chun-Kuang.
> +
> if (sg_dma_address(s) != expected) {
> DRM_ERROR("sg_table is not contiguous");
> ret = -EINVAL;
> --
> 2.26.1.301.g55bc3eb7cb9-goog
>
>
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/mediatek: stop iterating dma addresses when sg_dma_len() == 0
2020-04-26 8:03 ` Chun-Kuang Hu
@ 2020-04-28 1:49 ` Anand K. Mistry
2020-04-28 1:54 ` Anand K. Mistry
1 sibling, 0 replies; 11+ messages in thread
From: Anand K. Mistry @ 2020-04-28 1:49 UTC (permalink / raw)
To: Chun-Kuang Hu
Cc: Matthias Brugger, moderated list:ARM/Mediatek SoC support,
Linux ARM, DRI Development
[-- Attachment #1.1: Type: text/plain, Size: 2013 bytes --]
On Sun, 26 Apr 2020 at 18:04, Chun-Kuang Hu <chunkuang.hu@kernel.org> wrote:
> Hi, Anand:
>
> Anand K Mistry <amistry@chromium.org> 於 2020年4月20日 週一 下午2:09寫道:
> >
> > If dma_map_sg() merges pages when creating the mapping, only the first
> > entries will have a valid sg_dma_address() and sg_dma_len(), followed by
> > entries with sg_dma_len() == 0.
> >
> > Signed-off-by: Anand K Mistry <amistry@google.com>
> > ---
> > drivers/gpu/drm/mediatek/mtk_drm_gem.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > index b04a3c2b111e09..f8fd8b98c30e3d 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > @@ -224,6 +224,9 @@ struct drm_gem_object
> *mtk_gem_prime_import_sg_table(struct drm_device *dev,
> >
> > expected = sg_dma_address(sg->sgl);
> > for_each_sg(sg->sgl, s, sg->nents, i) {
> > + if (!sg_dma_len(s))
> > + break;
>
> I think this should be 'continue'
>
scatterlist.h has the comment:
/*
* These macros should be used after a dma_map_sg call has been done
* to get bus addresses of each of the SG entries and their lengths.
* You should only work with the number of sg entries dma_map_sg
* returns, or alternatively stop on the first sg_dma_len(sg) which
* is 0.
*/
So breaking on the first sg_dma_len(sg) == 0 appears to be (one of) the
documented approach.
> Regards,
> Chun-Kuang.
>
> > +
> > if (sg_dma_address(s) != expected) {
> > DRM_ERROR("sg_table is not contiguous");
> > ret = -EINVAL;
> > --
> > 2.26.1.301.g55bc3eb7cb9-goog
> >
> >
> > _______________________________________________
> > Linux-mediatek mailing list
> > Linux-mediatek@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-mediatek
>
[-- Attachment #1.2: Type: text/html, Size: 3040 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/mediatek: stop iterating dma addresses when sg_dma_len() == 0
2020-04-26 8:03 ` Chun-Kuang Hu
2020-04-28 1:49 ` Anand K. Mistry
@ 2020-04-28 1:54 ` Anand K. Mistry
2020-04-28 16:37 ` Chun-Kuang Hu
1 sibling, 1 reply; 11+ messages in thread
From: Anand K. Mistry @ 2020-04-28 1:54 UTC (permalink / raw)
To: Chun-Kuang Hu
Cc: Matthias Brugger, moderated list:ARM/Mediatek SoC support,
Linux ARM, DRI Development
On Sun, 26 Apr 2020 at 18:04, Chun-Kuang Hu <chunkuang.hu@kernel.org> wrote:
>
> Hi, Anand:
>
> Anand K Mistry <amistry@chromium.org> 於 2020年4月20日 週一 下午2:09寫道:
> >
> > If dma_map_sg() merges pages when creating the mapping, only the first
> > entries will have a valid sg_dma_address() and sg_dma_len(), followed by
> > entries with sg_dma_len() == 0.
> >
> > Signed-off-by: Anand K Mistry <amistry@google.com>
> > ---
> > drivers/gpu/drm/mediatek/mtk_drm_gem.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > index b04a3c2b111e09..f8fd8b98c30e3d 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > @@ -224,6 +224,9 @@ struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev,
> >
> > expected = sg_dma_address(sg->sgl);
> > for_each_sg(sg->sgl, s, sg->nents, i) {
> > + if (!sg_dma_len(s))
> > + break;
>
> I think this should be 'continue'
scatterlist.h has the comment:
/*
* These macros should be used after a dma_map_sg call has been done
* to get bus addresses of each of the SG entries and their lengths.
* You should only work with the number of sg entries dma_map_sg
* returns, or alternatively stop on the first sg_dma_len(sg) which
* is 0.
*/
So breaking on the first sg_dma_len(sg) == 0 appears to be (one of)
the documented approach.
>
> Regards,
> Chun-Kuang.
>
> > +
> > if (sg_dma_address(s) != expected) {
> > DRM_ERROR("sg_table is not contiguous");
> > ret = -EINVAL;
> > --
> > 2.26.1.301.g55bc3eb7cb9-goog
> >
> >
> > _______________________________________________
> > Linux-mediatek mailing list
> > Linux-mediatek@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-mediatek
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/mediatek: stop iterating dma addresses when sg_dma_len() == 0
2020-04-28 1:54 ` Anand K. Mistry
@ 2020-04-28 16:37 ` Chun-Kuang Hu
2020-05-06 0:25 ` Chun-Kuang Hu
0 siblings, 1 reply; 11+ messages in thread
From: Chun-Kuang Hu @ 2020-04-28 16:37 UTC (permalink / raw)
To: Anand K. Mistry
Cc: Chun-Kuang Hu, DRI Development,
moderated list:ARM/Mediatek SoC support, Matthias Brugger,
Linux ARM
Hi, Anand,
Anand K. Mistry <amistry@chromium.org> 於 2020年4月28日 週二 上午9:54寫道:
>
> On Sun, 26 Apr 2020 at 18:04, Chun-Kuang Hu <chunkuang.hu@kernel.org> wrote:
> >
> > Hi, Anand:
> >
> > Anand K Mistry <amistry@chromium.org> 於 2020年4月20日 週一 下午2:09寫道:
> > >
> > > If dma_map_sg() merges pages when creating the mapping, only the first
> > > entries will have a valid sg_dma_address() and sg_dma_len(), followed by
> > > entries with sg_dma_len() == 0.
> > >
> > > Signed-off-by: Anand K Mistry <amistry@google.com>
> > > ---
> > > drivers/gpu/drm/mediatek/mtk_drm_gem.c | 3 +++
> > > 1 file changed, 3 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > index b04a3c2b111e09..f8fd8b98c30e3d 100644
> > > --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > @@ -224,6 +224,9 @@ struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev,
> > >
> > > expected = sg_dma_address(sg->sgl);
> > > for_each_sg(sg->sgl, s, sg->nents, i) {
> > > + if (!sg_dma_len(s))
> > > + break;
> >
> > I think this should be 'continue'
>
> scatterlist.h has the comment:
> /*
> * These macros should be used after a dma_map_sg call has been done
> * to get bus addresses of each of the SG entries and their lengths.
> * You should only work with the number of sg entries dma_map_sg
> * returns, or alternatively stop on the first sg_dma_len(sg) which
> * is 0.
> */
>
> So breaking on the first sg_dma_len(sg) == 0 appears to be (one of)
> the documented approach.
>
Okay, you're right. So
Reviewed-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
> >
> > Regards,
> > Chun-Kuang.
> >
> > > +
> > > if (sg_dma_address(s) != expected) {
> > > DRM_ERROR("sg_table is not contiguous");
> > > ret = -EINVAL;
> > > --
> > > 2.26.1.301.g55bc3eb7cb9-goog
> > >
> > >
> > > _______________________________________________
> > > Linux-mediatek mailing list
> > > Linux-mediatek@lists.infradead.org
> > > http://lists.infradead.org/mailman/listinfo/linux-mediatek
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/mediatek: stop iterating dma addresses when sg_dma_len() == 0
2020-04-28 16:37 ` Chun-Kuang Hu
@ 2020-05-06 0:25 ` Chun-Kuang Hu
2020-05-06 11:03 ` Anand Mistry
0 siblings, 1 reply; 11+ messages in thread
From: Chun-Kuang Hu @ 2020-05-06 0:25 UTC (permalink / raw)
To: Chun-Kuang Hu
Cc: DRI Development, moderated list:ARM/Mediatek SoC support,
Matthias Brugger, Linux ARM, Anand K. Mistry
Hi, Anand,
Chun-Kuang Hu <chunkuang.hu@kernel.org> 於 2020年4月29日 週三 上午12:37寫道:
>
> Hi, Anand,
>
> Anand K. Mistry <amistry@chromium.org> 於 2020年4月28日 週二 上午9:54寫道:
> >
> > On Sun, 26 Apr 2020 at 18:04, Chun-Kuang Hu <chunkuang.hu@kernel.org> wrote:
> > >
> > > Hi, Anand:
> > >
> > > Anand K Mistry <amistry@chromium.org> 於 2020年4月20日 週一 下午2:09寫道:
> > > >
> > > > If dma_map_sg() merges pages when creating the mapping, only the first
> > > > entries will have a valid sg_dma_address() and sg_dma_len(), followed by
> > > > entries with sg_dma_len() == 0.
> > > >
> > > > Signed-off-by: Anand K Mistry <amistry@google.com>
Author should sign off this patch, please give a sign off tag by author.
Regards,
Chun-Kuang.
> > > > ---
> > > > drivers/gpu/drm/mediatek/mtk_drm_gem.c | 3 +++
> > > > 1 file changed, 3 insertions(+)
> > > >
> > > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > index b04a3c2b111e09..f8fd8b98c30e3d 100644
> > > > --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > @@ -224,6 +224,9 @@ struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev,
> > > >
> > > > expected = sg_dma_address(sg->sgl);
> > > > for_each_sg(sg->sgl, s, sg->nents, i) {
> > > > + if (!sg_dma_len(s))
> > > > + break;
> > >
> > > I think this should be 'continue'
> >
> > scatterlist.h has the comment:
> > /*
> > * These macros should be used after a dma_map_sg call has been done
> > * to get bus addresses of each of the SG entries and their lengths.
> > * You should only work with the number of sg entries dma_map_sg
> > * returns, or alternatively stop on the first sg_dma_len(sg) which
> > * is 0.
> > */
> >
> > So breaking on the first sg_dma_len(sg) == 0 appears to be (one of)
> > the documented approach.
> >
>
> Okay, you're right. So
>
> Reviewed-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
>
> > >
> > > Regards,
> > > Chun-Kuang.
> > >
> > > > +
> > > > if (sg_dma_address(s) != expected) {
> > > > DRM_ERROR("sg_table is not contiguous");
> > > > ret = -EINVAL;
> > > > --
> > > > 2.26.1.301.g55bc3eb7cb9-goog
> > > >
> > > >
> > > > _______________________________________________
> > > > Linux-mediatek mailing list
> > > > Linux-mediatek@lists.infradead.org
> > > > http://lists.infradead.org/mailman/listinfo/linux-mediatek
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/mediatek: stop iterating dma addresses when sg_dma_len() == 0
2020-05-06 0:25 ` Chun-Kuang Hu
@ 2020-05-06 11:03 ` Anand Mistry
2020-05-06 12:58 ` Chun-Kuang Hu
0 siblings, 1 reply; 11+ messages in thread
From: Anand Mistry @ 2020-05-06 11:03 UTC (permalink / raw)
To: Chun-Kuang Hu
Cc: Anand K Mistry, DRI Development,
moderated list:ARM/Mediatek SoC support, Matthias Brugger,
Linux ARM
On Wed, May 6, 2020 at 10:25 AM Chun-Kuang Hu <chunkuang.hu@kernel.org> wrote:
>
> Hi, Anand,
>
> Chun-Kuang Hu <chunkuang.hu@kernel.org> 於 2020年4月29日 週三 上午12:37寫道:
> >
> > Hi, Anand,
> >
> > Anand K. Mistry <amistry@chromium.org> 於 2020年4月28日 週二 上午9:54寫道:
> > >
> > > On Sun, 26 Apr 2020 at 18:04, Chun-Kuang Hu <chunkuang.hu@kernel.org> wrote:
> > > >
> > > > Hi, Anand:
> > > >
> > > > Anand K Mistry <amistry@chromium.org> 於 2020年4月20日 週一 下午2:09寫道:
> > > > >
> > > > > If dma_map_sg() merges pages when creating the mapping, only the first
> > > > > entries will have a valid sg_dma_address() and sg_dma_len(), followed by
> > > > > entries with sg_dma_len() == 0.
> > > > >
> > > > > Signed-off-by: Anand K Mistry <amistry@google.com>
>
> Author should sign off this patch, please give a sign off tag by author.
Sorry, email issues meant i sent the patch from a different account.
Should I re-send the
patch from the same account as the sign-off line? I'm still working my
way through the kernel patch process.
>
> Regards,
> Chun-Kuang.
>
> > > > > ---
> > > > > drivers/gpu/drm/mediatek/mtk_drm_gem.c | 3 +++
> > > > > 1 file changed, 3 insertions(+)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > > index b04a3c2b111e09..f8fd8b98c30e3d 100644
> > > > > --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > > +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > > @@ -224,6 +224,9 @@ struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev,
> > > > >
> > > > > expected = sg_dma_address(sg->sgl);
> > > > > for_each_sg(sg->sgl, s, sg->nents, i) {
> > > > > + if (!sg_dma_len(s))
> > > > > + break;
> > > >
> > > > I think this should be 'continue'
> > >
> > > scatterlist.h has the comment:
> > > /*
> > > * These macros should be used after a dma_map_sg call has been done
> > > * to get bus addresses of each of the SG entries and their lengths.
> > > * You should only work with the number of sg entries dma_map_sg
> > > * returns, or alternatively stop on the first sg_dma_len(sg) which
> > > * is 0.
> > > */
> > >
> > > So breaking on the first sg_dma_len(sg) == 0 appears to be (one of)
> > > the documented approach.
> > >
> >
> > Okay, you're right. So
> >
> > Reviewed-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
> >
> > > >
> > > > Regards,
> > > > Chun-Kuang.
> > > >
> > > > > +
> > > > > if (sg_dma_address(s) != expected) {
> > > > > DRM_ERROR("sg_table is not contiguous");
> > > > > ret = -EINVAL;
> > > > > --
> > > > > 2.26.1.301.g55bc3eb7cb9-goog
> > > > >
> > > > >
> > > > > _______________________________________________
> > > > > Linux-mediatek mailing list
> > > > > Linux-mediatek@lists.infradead.org
> > > > > http://lists.infradead.org/mailman/listinfo/linux-mediatek
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/mediatek: stop iterating dma addresses when sg_dma_len() == 0
2020-05-06 11:03 ` Anand Mistry
@ 2020-05-06 12:58 ` Chun-Kuang Hu
2020-05-07 11:56 ` Anand Mistry
2020-05-07 12:04 ` Anand Mistry
0 siblings, 2 replies; 11+ messages in thread
From: Chun-Kuang Hu @ 2020-05-06 12:58 UTC (permalink / raw)
To: Anand Mistry
Cc: Chun-Kuang Hu, Anand K Mistry, DRI Development,
moderated list:ARM/Mediatek SoC support, Matthias Brugger,
Linux ARM
Hi, Anand:
Anand Mistry <amistry@chromium.org> 於 2020年5月6日 週三 下午7:03寫道:
>
> On Wed, May 6, 2020 at 10:25 AM Chun-Kuang Hu <chunkuang.hu@kernel.org> wrote:
> >
> > Hi, Anand,
> >
> > Chun-Kuang Hu <chunkuang.hu@kernel.org> 於 2020年4月29日 週三 上午12:37寫道:
> > >
> > > Hi, Anand,
> > >
> > > Anand K. Mistry <amistry@chromium.org> 於 2020年4月28日 週二 上午9:54寫道:
> > > >
> > > > On Sun, 26 Apr 2020 at 18:04, Chun-Kuang Hu <chunkuang.hu@kernel.org> wrote:
> > > > >
> > > > > Hi, Anand:
> > > > >
> > > > > Anand K Mistry <amistry@chromium.org> 於 2020年4月20日 週一 下午2:09寫道:
> > > > > >
> > > > > > If dma_map_sg() merges pages when creating the mapping, only the first
> > > > > > entries will have a valid sg_dma_address() and sg_dma_len(), followed by
> > > > > > entries with sg_dma_len() == 0.
> > > > > >
> > > > > > Signed-off-by: Anand K Mistry <amistry@google.com>
> >
> > Author should sign off this patch, please give a sign off tag by author.
>
> Sorry, email issues meant i sent the patch from a different account.
> Should I re-send the
> patch from the same account as the sign-off line? I'm still working my
> way through the kernel patch process.
>
If you want to use chromium account, you could simply reply this email
with a sign-off-by tag of chromium account.
Regards,
Chun-Kuang.
> >
> > Regards,
> > Chun-Kuang.
> >
> > > > > > ---
> > > > > > drivers/gpu/drm/mediatek/mtk_drm_gem.c | 3 +++
> > > > > > 1 file changed, 3 insertions(+)
> > > > > >
> > > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > > > index b04a3c2b111e09..f8fd8b98c30e3d 100644
> > > > > > --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > > > +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > > > @@ -224,6 +224,9 @@ struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev,
> > > > > >
> > > > > > expected = sg_dma_address(sg->sgl);
> > > > > > for_each_sg(sg->sgl, s, sg->nents, i) {
> > > > > > + if (!sg_dma_len(s))
> > > > > > + break;
> > > > >
> > > > > I think this should be 'continue'
> > > >
> > > > scatterlist.h has the comment:
> > > > /*
> > > > * These macros should be used after a dma_map_sg call has been done
> > > > * to get bus addresses of each of the SG entries and their lengths.
> > > > * You should only work with the number of sg entries dma_map_sg
> > > > * returns, or alternatively stop on the first sg_dma_len(sg) which
> > > > * is 0.
> > > > */
> > > >
> > > > So breaking on the first sg_dma_len(sg) == 0 appears to be (one of)
> > > > the documented approach.
> > > >
> > >
> > > Okay, you're right. So
> > >
> > > Reviewed-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
> > >
> > > > >
> > > > > Regards,
> > > > > Chun-Kuang.
> > > > >
> > > > > > +
> > > > > > if (sg_dma_address(s) != expected) {
> > > > > > DRM_ERROR("sg_table is not contiguous");
> > > > > > ret = -EINVAL;
> > > > > > --
> > > > > > 2.26.1.301.g55bc3eb7cb9-goog
> > > > > >
> > > > > >
> > > > > > _______________________________________________
> > > > > > Linux-mediatek mailing list
> > > > > > Linux-mediatek@lists.infradead.org
> > > > > > http://lists.infradead.org/mailman/listinfo/linux-mediatek
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/mediatek: stop iterating dma addresses when sg_dma_len() == 0
2020-05-06 12:58 ` Chun-Kuang Hu
@ 2020-05-07 11:56 ` Anand Mistry
2020-05-09 13:38 ` Chun-Kuang Hu
2020-05-07 12:04 ` Anand Mistry
1 sibling, 1 reply; 11+ messages in thread
From: Anand Mistry @ 2020-05-07 11:56 UTC (permalink / raw)
To: Chun-Kuang Hu
Cc: Anand K Mistry, DRI Development,
moderated list:ARM/Mediatek SoC support, Matthias Brugger,
Linux ARM
[-- Attachment #1.1: Type: text/plain, Size: 3868 bytes --]
On Wed, May 6, 2020 at 10:59 PM Chun-Kuang Hu <chunkuang.hu@kernel.org>
wrote:
>
> Hi, Anand:
>
> Anand Mistry <amistry@chromium.org> 於 2020年5月6日 週三 下午7:03寫道:
> >
> > On Wed, May 6, 2020 at 10:25 AM Chun-Kuang Hu <chunkuang.hu@kernel.org>
wrote:
> > >
> > > Hi, Anand,
> > >
> > > Chun-Kuang Hu <chunkuang.hu@kernel.org> 於 2020年4月29日 週三 上午12:37寫道:
> > > >
> > > > Hi, Anand,
> > > >
> > > > Anand K. Mistry <amistry@chromium.org> 於 2020年4月28日 週二 上午9:54寫道:
> > > > >
> > > > > On Sun, 26 Apr 2020 at 18:04, Chun-Kuang Hu <
chunkuang.hu@kernel.org> wrote:
> > > > > >
> > > > > > Hi, Anand:
> > > > > >
> > > > > > Anand K Mistry <amistry@chromium.org> 於 2020年4月20日 週一 下午2:09寫道:
> > > > > > >
> > > > > > > If dma_map_sg() merges pages when creating the mapping, only
the first
> > > > > > > entries will have a valid sg_dma_address() and sg_dma_len(),
followed by
> > > > > > > entries with sg_dma_len() == 0.
> > > > > > >
> > > > > > > Signed-off-by: Anand K Mistry <amistry@google.com>
> > >
> > > Author should sign off this patch, please give a sign off tag by
author.
> >
> > Sorry, email issues meant i sent the patch from a different account.
> > Should I re-send the
> > patch from the same account as the sign-off line? I'm still working my
> > way through the kernel patch process.
> >
>
> If you want to use chromium account, you could simply reply this email
> with a sign-off-by tag of chromium account.
Ack. As path of least resistance, here:
Signed-off-by: Anand K Mistry <amistry@chromium.org>
>
> Regards,
> Chun-Kuang.
>
> > >
> > > Regards,
> > > Chun-Kuang.
> > >
> > > > > > > ---
> > > > > > > drivers/gpu/drm/mediatek/mtk_drm_gem.c | 3 +++
> > > > > > > 1 file changed, 3 insertions(+)
> > > > > > >
> > > > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > > > > index b04a3c2b111e09..f8fd8b98c30e3d 100644
> > > > > > > --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > > > > +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > > > > @@ -224,6 +224,9 @@ struct drm_gem_object
*mtk_gem_prime_import_sg_table(struct drm_device *dev,
> > > > > > >
> > > > > > > expected = sg_dma_address(sg->sgl);
> > > > > > > for_each_sg(sg->sgl, s, sg->nents, i) {
> > > > > > > + if (!sg_dma_len(s))
> > > > > > > + break;
> > > > > >
> > > > > > I think this should be 'continue'
> > > > >
> > > > > scatterlist.h has the comment:
> > > > > /*
> > > > > * These macros should be used after a dma_map_sg call has been
done
> > > > > * to get bus addresses of each of the SG entries and their
lengths.
> > > > > * You should only work with the number of sg entries dma_map_sg
> > > > > * returns, or alternatively stop on the first sg_dma_len(sg)
which
> > > > > * is 0.
> > > > > */
> > > > >
> > > > > So breaking on the first sg_dma_len(sg) == 0 appears to be (one
of)
> > > > > the documented approach.
> > > > >
> > > >
> > > > Okay, you're right. So
> > > >
> > > > Reviewed-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
> > > >
> > > > > >
> > > > > > Regards,
> > > > > > Chun-Kuang.
> > > > > >
> > > > > > > +
> > > > > > > if (sg_dma_address(s) != expected) {
> > > > > > > DRM_ERROR("sg_table is not
contiguous");
> > > > > > > ret = -EINVAL;
> > > > > > > --
> > > > > > > 2.26.1.301.g55bc3eb7cb9-goog
> > > > > > >
> > > > > > >
> > > > > > > _______________________________________________
> > > > > > > Linux-mediatek mailing list
> > > > > > > Linux-mediatek@lists.infradead.org
> > > > > > > http://lists.infradead.org/mailman/listinfo/linux-mediatek
[-- Attachment #1.2: Type: text/html, Size: 6156 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/mediatek: stop iterating dma addresses when sg_dma_len() == 0
2020-05-06 12:58 ` Chun-Kuang Hu
2020-05-07 11:56 ` Anand Mistry
@ 2020-05-07 12:04 ` Anand Mistry
1 sibling, 0 replies; 11+ messages in thread
From: Anand Mistry @ 2020-05-07 12:04 UTC (permalink / raw)
To: Chun-Kuang Hu
Cc: Anand K Mistry, DRI Development,
moderated list:ARM/Mediatek SoC support, Matthias Brugger,
Linux ARM
On Wed, May 6, 2020 at 10:59 PM Chun-Kuang Hu <chunkuang.hu@kernel.org> wrote:
>
> Hi, Anand:
>
> Anand Mistry <amistry@chromium.org> 於 2020年5月6日 週三 下午7:03寫道:
> >
> > On Wed, May 6, 2020 at 10:25 AM Chun-Kuang Hu <chunkuang.hu@kernel.org> wrote:
> > >
> > > Hi, Anand,
> > >
> > > Chun-Kuang Hu <chunkuang.hu@kernel.org> 於 2020年4月29日 週三 上午12:37寫道:
> > > >
> > > > Hi, Anand,
> > > >
> > > > Anand K. Mistry <amistry@chromium.org> 於 2020年4月28日 週二 上午9:54寫道:
> > > > >
> > > > > On Sun, 26 Apr 2020 at 18:04, Chun-Kuang Hu <chunkuang.hu@kernel.org> wrote:
> > > > > >
> > > > > > Hi, Anand:
> > > > > >
> > > > > > Anand K Mistry <amistry@chromium.org> 於 2020年4月20日 週一 下午2:09寫道:
> > > > > > >
> > > > > > > If dma_map_sg() merges pages when creating the mapping, only the first
> > > > > > > entries will have a valid sg_dma_address() and sg_dma_len(), followed by
> > > > > > > entries with sg_dma_len() == 0.
> > > > > > >
> > > > > > > Signed-off-by: Anand K Mistry <amistry@google.com>
> > >
> > > Author should sign off this patch, please give a sign off tag by author.
> >
> > Sorry, email issues meant i sent the patch from a different account.
> > Should I re-send the
> > patch from the same account as the sign-off line? I'm still working my
> > way through the kernel patch process.
> >
>
> If you want to use chromium account, you could simply reply this email
> with a sign-off-by tag of chromium account.
Ack. This is fine for now. I'll try doing it better with the next patch.
Signed-off-by: Anand K Mistry <amistry@chromium.org>
>
> Regards,
> Chun-Kuang.
>
> > >
> > > Regards,
> > > Chun-Kuang.
> > >
> > > > > > > ---
> > > > > > > drivers/gpu/drm/mediatek/mtk_drm_gem.c | 3 +++
> > > > > > > 1 file changed, 3 insertions(+)
> > > > > > >
> > > > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > > > > index b04a3c2b111e09..f8fd8b98c30e3d 100644
> > > > > > > --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > > > > +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > > > > @@ -224,6 +224,9 @@ struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev,
> > > > > > >
> > > > > > > expected = sg_dma_address(sg->sgl);
> > > > > > > for_each_sg(sg->sgl, s, sg->nents, i) {
> > > > > > > + if (!sg_dma_len(s))
> > > > > > > + break;
> > > > > >
> > > > > > I think this should be 'continue'
> > > > >
> > > > > scatterlist.h has the comment:
> > > > > /*
> > > > > * These macros should be used after a dma_map_sg call has been done
> > > > > * to get bus addresses of each of the SG entries and their lengths.
> > > > > * You should only work with the number of sg entries dma_map_sg
> > > > > * returns, or alternatively stop on the first sg_dma_len(sg) which
> > > > > * is 0.
> > > > > */
> > > > >
> > > > > So breaking on the first sg_dma_len(sg) == 0 appears to be (one of)
> > > > > the documented approach.
> > > > >
> > > >
> > > > Okay, you're right. So
> > > >
> > > > Reviewed-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
> > > >
> > > > > >
> > > > > > Regards,
> > > > > > Chun-Kuang.
> > > > > >
> > > > > > > +
> > > > > > > if (sg_dma_address(s) != expected) {
> > > > > > > DRM_ERROR("sg_table is not contiguous");
> > > > > > > ret = -EINVAL;
> > > > > > > --
> > > > > > > 2.26.1.301.g55bc3eb7cb9-goog
> > > > > > >
> > > > > > >
> > > > > > > _______________________________________________
> > > > > > > Linux-mediatek mailing list
> > > > > > > Linux-mediatek@lists.infradead.org
> > > > > > > http://lists.infradead.org/mailman/listinfo/linux-mediatek
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/mediatek: stop iterating dma addresses when sg_dma_len() == 0
2020-05-07 11:56 ` Anand Mistry
@ 2020-05-09 13:38 ` Chun-Kuang Hu
0 siblings, 0 replies; 11+ messages in thread
From: Chun-Kuang Hu @ 2020-05-09 13:38 UTC (permalink / raw)
To: Anand Mistry
Cc: Chun-Kuang Hu, Anand K Mistry, DRI Development,
moderated list:ARM/Mediatek SoC support, Matthias Brugger,
Linux ARM
Hi, Anand:
Anand Mistry <amistry@chromium.org> 於 2020年5月7日 週四 下午7:56寫道:
>
> On Wed, May 6, 2020 at 10:59 PM Chun-Kuang Hu <chunkuang.hu@kernel.org> wrote:
> >
> > Hi, Anand:
> >
> > Anand Mistry <amistry@chromium.org> 於 2020年5月6日 週三 下午7:03寫道:
> > >
> > > On Wed, May 6, 2020 at 10:25 AM Chun-Kuang Hu <chunkuang.hu@kernel.org> wrote:
> > > >
> > > > Hi, Anand,
> > > >
> > > > Chun-Kuang Hu <chunkuang.hu@kernel.org> 於 2020年4月29日 週三 上午12:37寫道:
> > > > >
> > > > > Hi, Anand,
> > > > >
> > > > > Anand K. Mistry <amistry@chromium.org> 於 2020年4月28日 週二 上午9:54寫道:
> > > > > >
> > > > > > On Sun, 26 Apr 2020 at 18:04, Chun-Kuang Hu <chunkuang.hu@kernel.org> wrote:
> > > > > > >
> > > > > > > Hi, Anand:
> > > > > > >
> > > > > > > Anand K Mistry <amistry@chromium.org> 於 2020年4月20日 週一 下午2:09寫道:
> > > > > > > >
> > > > > > > > If dma_map_sg() merges pages when creating the mapping, only the first
> > > > > > > > entries will have a valid sg_dma_address() and sg_dma_len(), followed by
> > > > > > > > entries with sg_dma_len() == 0.
> > > > > > > >
> > > > > > > > Signed-off-by: Anand K Mistry <amistry@google.com>
> > > >
> > > > Author should sign off this patch, please give a sign off tag by author.
> > >
> > > Sorry, email issues meant i sent the patch from a different account.
> > > Should I re-send the
> > > patch from the same account as the sign-off line? I'm still working my
> > > way through the kernel patch process.
> > >
> >
> > If you want to use chromium account, you could simply reply this email
> > with a sign-off-by tag of chromium account.
>
> Ack. As path of least resistance, here:
>
> Signed-off-by: Anand K Mistry <amistry@chromium.org>
>
Applied to mediatek-drm-next [1], thanks.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next
Regards,
Chun-Kuang.
>
> >
> > Regards,
> > Chun-Kuang.
> >
> > > >
> > > > Regards,
> > > > Chun-Kuang.
> > > >
> > > > > > > > ---
> > > > > > > > drivers/gpu/drm/mediatek/mtk_drm_gem.c | 3 +++
> > > > > > > > 1 file changed, 3 insertions(+)
> > > > > > > >
> > > > > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > > > > > index b04a3c2b111e09..f8fd8b98c30e3d 100644
> > > > > > > > --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > > > > > +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
> > > > > > > > @@ -224,6 +224,9 @@ struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev,
> > > > > > > >
> > > > > > > > expected = sg_dma_address(sg->sgl);
> > > > > > > > for_each_sg(sg->sgl, s, sg->nents, i) {
> > > > > > > > + if (!sg_dma_len(s))
> > > > > > > > + break;
> > > > > > >
> > > > > > > I think this should be 'continue'
> > > > > >
> > > > > > scatterlist.h has the comment:
> > > > > > /*
> > > > > > * These macros should be used after a dma_map_sg call has been done
> > > > > > * to get bus addresses of each of the SG entries and their lengths.
> > > > > > * You should only work with the number of sg entries dma_map_sg
> > > > > > * returns, or alternatively stop on the first sg_dma_len(sg) which
> > > > > > * is 0.
> > > > > > */
> > > > > >
> > > > > > So breaking on the first sg_dma_len(sg) == 0 appears to be (one of)
> > > > > > the documented approach.
> > > > > >
> > > > >
> > > > > Okay, you're right. So
> > > > >
> > > > > Reviewed-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
> > > > >
> > > > > > >
> > > > > > > Regards,
> > > > > > > Chun-Kuang.
> > > > > > >
> > > > > > > > +
> > > > > > > > if (sg_dma_address(s) != expected) {
> > > > > > > > DRM_ERROR("sg_table is not contiguous");
> > > > > > > > ret = -EINVAL;
> > > > > > > > --
> > > > > > > > 2.26.1.301.g55bc3eb7cb9-goog
> > > > > > > >
> > > > > > > >
> > > > > > > > _______________________________________________
> > > > > > > > Linux-mediatek mailing list
> > > > > > > > Linux-mediatek@lists.infradead.org
> > > > > > > > http://lists.infradead.org/mailman/listinfo/linux-mediatek
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2020-05-09 13:39 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-20 6:08 [PATCH] drm/mediatek: stop iterating dma addresses when sg_dma_len() == 0 Anand K Mistry
2020-04-26 8:03 ` Chun-Kuang Hu
2020-04-28 1:49 ` Anand K. Mistry
2020-04-28 1:54 ` Anand K. Mistry
2020-04-28 16:37 ` Chun-Kuang Hu
2020-05-06 0:25 ` Chun-Kuang Hu
2020-05-06 11:03 ` Anand Mistry
2020-05-06 12:58 ` Chun-Kuang Hu
2020-05-07 11:56 ` Anand Mistry
2020-05-09 13:38 ` Chun-Kuang Hu
2020-05-07 12:04 ` Anand Mistry
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).