From: Nicolas Dufresne <nicolas@ndufresne.ca> To: Andrzej Pietrasiewicz <andrzej.p@collabora.com>, linux-media@vger.kernel.org Cc: linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, Mauro Carvalho Chehab <mchehab@kernel.org>, Ezequiel Garcia <ezequiel@collabora.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, kernel@collabora.com Subject: Re: [PATCH] media: rkvdec: Add required padding Date: Thu, 27 Oct 2022 09:31:02 -0400 [thread overview] Message-ID: <85205ab7833ec260447e1f68b9264acbf3130112.camel@ndufresne.ca> (raw) In-Reply-To: <20221027080217.6290-1-andrzej.p@collabora.com> Le jeudi 27 octobre 2022 à 10:02 +0200, Andrzej Pietrasiewicz a écrit : > The addresses of two elements of the segmap[][] member are passed to the > hardware which expects 128-bit aligned addresses. However, without this > patch offsetof(struct rkvdec_vp9_priv_tbl, segmap[0]) is an odd number > (2421) but the hardware just ignores the 5 least significant bits of the > address. As a result, the hardware writes the segmentation map to incorrect > locations. > > Inserting 11 bytes of padding corrects this situation by making the said > addresses divisible by 16 (i.e. aligned on a 128-bit boundary). > > Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> For backport purposes, perhaps add ? Fixes: f25709c4ff15 ("media: rkvdec: Add the VP9 backend") > --- > drivers/staging/media/rkvdec/rkvdec-vp9.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/staging/media/rkvdec/rkvdec-vp9.c b/drivers/staging/media/rkvdec/rkvdec-vp9.c > index d8c1c0db15c7..cfae99b40ccb 100644 > --- a/drivers/staging/media/rkvdec/rkvdec-vp9.c > +++ b/drivers/staging/media/rkvdec/rkvdec-vp9.c > @@ -84,6 +84,8 @@ struct rkvdec_vp9_probs { > struct rkvdec_vp9_inter_frame_probs inter; > struct rkvdec_vp9_intra_only_frame_probs intra_only; > }; > + /* 128 bit alignment */ > + u8 padding1[11]; > }; > > /* Data structure describing auxiliary buffer format. */ > @@ -1006,6 +1008,7 @@ static int rkvdec_vp9_start(struct rkvdec_ctx *ctx) > > ctx->priv = vp9_ctx; > > + BUILD_BUG_ON(sizeof(priv_tbl->probs) % 16); /* ensure probs size is 128-bit aligned */ > priv_tbl = dma_alloc_coherent(rkvdec->dev, sizeof(*priv_tbl), > &vp9_ctx->priv_tbl.dma, GFP_KERNEL); > if (!priv_tbl) {
WARNING: multiple messages have this Message-ID (diff)
From: Nicolas Dufresne <nicolas@ndufresne.ca> To: Andrzej Pietrasiewicz <andrzej.p@collabora.com>, linux-media@vger.kernel.org Cc: linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, Mauro Carvalho Chehab <mchehab@kernel.org>, Ezequiel Garcia <ezequiel@collabora.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, kernel@collabora.com Subject: Re: [PATCH] media: rkvdec: Add required padding Date: Thu, 27 Oct 2022 09:31:02 -0400 [thread overview] Message-ID: <85205ab7833ec260447e1f68b9264acbf3130112.camel@ndufresne.ca> (raw) In-Reply-To: <20221027080217.6290-1-andrzej.p@collabora.com> Le jeudi 27 octobre 2022 à 10:02 +0200, Andrzej Pietrasiewicz a écrit : > The addresses of two elements of the segmap[][] member are passed to the > hardware which expects 128-bit aligned addresses. However, without this > patch offsetof(struct rkvdec_vp9_priv_tbl, segmap[0]) is an odd number > (2421) but the hardware just ignores the 5 least significant bits of the > address. As a result, the hardware writes the segmentation map to incorrect > locations. > > Inserting 11 bytes of padding corrects this situation by making the said > addresses divisible by 16 (i.e. aligned on a 128-bit boundary). > > Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> For backport purposes, perhaps add ? Fixes: f25709c4ff15 ("media: rkvdec: Add the VP9 backend") > --- > drivers/staging/media/rkvdec/rkvdec-vp9.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/staging/media/rkvdec/rkvdec-vp9.c b/drivers/staging/media/rkvdec/rkvdec-vp9.c > index d8c1c0db15c7..cfae99b40ccb 100644 > --- a/drivers/staging/media/rkvdec/rkvdec-vp9.c > +++ b/drivers/staging/media/rkvdec/rkvdec-vp9.c > @@ -84,6 +84,8 @@ struct rkvdec_vp9_probs { > struct rkvdec_vp9_inter_frame_probs inter; > struct rkvdec_vp9_intra_only_frame_probs intra_only; > }; > + /* 128 bit alignment */ > + u8 padding1[11]; > }; > > /* Data structure describing auxiliary buffer format. */ > @@ -1006,6 +1008,7 @@ static int rkvdec_vp9_start(struct rkvdec_ctx *ctx) > > ctx->priv = vp9_ctx; > > + BUILD_BUG_ON(sizeof(priv_tbl->probs) % 16); /* ensure probs size is 128-bit aligned */ > priv_tbl = dma_alloc_coherent(rkvdec->dev, sizeof(*priv_tbl), > &vp9_ctx->priv_tbl.dma, GFP_KERNEL); > if (!priv_tbl) { _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip
next prev parent reply other threads:[~2022-10-27 13:31 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-10-27 8:02 [PATCH] media: rkvdec: Add required padding Andrzej Pietrasiewicz 2022-10-27 8:02 ` Andrzej Pietrasiewicz 2022-10-27 13:31 ` Nicolas Dufresne [this message] 2022-10-27 13:31 ` Nicolas Dufresne
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=85205ab7833ec260447e1f68b9264acbf3130112.camel@ndufresne.ca \ --to=nicolas@ndufresne.ca \ --cc=andrzej.p@collabora.com \ --cc=ezequiel@collabora.com \ --cc=gregkh@linuxfoundation.org \ --cc=kernel@collabora.com \ --cc=linux-media@vger.kernel.org \ --cc=linux-rockchip@lists.infradead.org \ --cc=linux-staging@lists.linux.dev \ --cc=mchehab@kernel.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.